From 126af57f9b2b09f1ab72c6a7f6dfce4e79d0480f Mon Sep 17 00:00:00 2001 From: Felipe Vicens Date: Wed, 5 Jun 2019 19:13:04 +0200 Subject: [PATCH] Fix bug #677 osm nsi-op-list name' and 'osm nsi-op-show id' returns null Change-Id: Ie20b1c2b28195b8e4e309623cf5b2619dd8e2459 Signed-off-by: Felipe Vicens --- osm_nbi/html_out.py | 2 +- osm_nbi/instance_topics.py | 20 ++++++++++---------- osm_nbi/nbi.py | 6 +++--- osm_nbi/validation.py | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/osm_nbi/html_out.py b/osm_nbi/html_out.py index 6f07d71..9adf6f5 100644 --- a/osm_nbi/html_out.py +++ b/osm_nbi/html_out.py @@ -119,7 +119,7 @@ html_nslcmop_body = """ """ html_nsilcmop_body = """ -nsilcm operations +nsilcm operations

diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index 8f2ac0d..48503a9 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -1184,7 +1184,7 @@ class NsiLcmOpTopic(BaseTopic): "isCancelPending": False, "links": { "self": "/osm/nsilcm/v1/nsi_lcm_op_occs/" + _id, - "nsInstance": "/osm/nsilcm/v1/netslice_instances/" + netsliceInstanceId, + "netsliceInstanceId": "/osm/nsilcm/v1/netslice_instances/" + netsliceInstanceId, } } return nsilcmop @@ -1209,7 +1209,7 @@ class NsiLcmOpTopic(BaseTopic): :param rollback: list to append created items at database in case a rollback must to be done :param session: contains "username", "admin", "force", "public", "project_id", "set_project" :param indata: descriptor with the parameters of the operation. It must contains among others - nsiInstanceId: _id of the nsir to perform the operation + netsliceInstanceId: _id of the nsir to perform the operation operation: it can be: instantiate, terminate, action, TODO: update, heal :param kwargs: used to override the indata descriptor :param headers: http request headers @@ -1219,12 +1219,12 @@ class NsiLcmOpTopic(BaseTopic): # Override descriptor with query string kwargs self._update_input_with_kwargs(indata, kwargs) operation = indata["lcmOperationType"] - nsiInstanceId = indata["nsiInstanceId"] + netsliceInstanceId = indata["netsliceInstanceId"] validate_input(indata, self.operation_schema[operation]) - # get nsi from nsiInstanceId + # get nsi from netsliceInstanceId _filter = self._get_project_filter(session) - _filter["_id"] = nsiInstanceId + _filter["_id"] = netsliceInstanceId nsir = self.db.get_one("nsis", _filter) del _filter["_id"] @@ -1235,11 +1235,11 @@ class NsiLcmOpTopic(BaseTopic): return None # a none in this case is used to indicate not instantiated. It can be removed if operation != "instantiate": raise EngineException("netslice_instance '{}' cannot be '{}' because it is not instantiated".format( - nsiInstanceId, operation), HTTPStatus.CONFLICT) + netsliceInstanceId, operation), HTTPStatus.CONFLICT) else: if operation == "instantiate" and not session["force"]: raise EngineException("netslice_instance '{}' cannot be '{}' because it is already instantiated". - format(nsiInstanceId, operation), HTTPStatus.CONFLICT) + format(netsliceInstanceId, operation), HTTPStatus.CONFLICT) # Creating all the NS_operation (nslcmop) # Get service list from db @@ -1252,7 +1252,7 @@ class NsiLcmOpTopic(BaseTopic): _filter["_admin.nsrs-detailed-list.ANYINDEX.shared"] = True _filter["_admin.nsrs-detailed-list.ANYINDEX.nsrId"] = nsr_item["nsrId"] _filter["_admin.nsrs-detailed-list.ANYINDEX.nslcmop_instantiate.ne"] = None - _filter["_id.ne"] = nsiInstanceId + _filter["_id.ne"] = netsliceInstanceId nsi = self.db.get_one("nsis", _filter, fail_on_empty=False, fail_on_more=False) if operation == "terminate": _update = {"_admin.nsrs-detailed-list.{}.nslcmop_instantiate".format(index): None} @@ -1280,7 +1280,7 @@ class NsiLcmOpTopic(BaseTopic): indata_ns["lcmOperationType"] = operation indata_ns["nsInstanceId"] = service["_id"] # Including netslice_id in the ns instantiate Operation - indata_ns["netsliceInstanceId"] = nsiInstanceId + indata_ns["netsliceInstanceId"] = netsliceInstanceId del indata_ns["key-pair-ref"] # Creating NS_LCM_OP with the flag slice_object=True to not trigger the service instantiation # message via kafka bus @@ -1302,7 +1302,7 @@ class NsiLcmOpTopic(BaseTopic): indata["nslcmops_ids"] = nslcmops self._check_nsi_operation(session, nsir, operation, indata) - nsilcmop_desc = self._create_nsilcmop(session, nsiInstanceId, operation, indata) + nsilcmop_desc = self._create_nsilcmop(session, netsliceInstanceId, operation, indata) self.format_on_new(nsilcmop_desc, session["project_id"], make_public=session["public"]) _id = self.db.create("nsilcmops", nsilcmop_desc) rollback.append({"topic": "nsilcmops", "_id": _id}) diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index cc56984..269af33 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -887,13 +887,13 @@ class Server(object): _id = self.engine.new_item(rollback, session, engine_topic, indata, kwargs) self._set_location_header(main_topic, version, topic, _id) indata["lcmOperationType"] = "instantiate" - indata["nsiInstanceId"] = _id + indata["netsliceInstanceId"] = _id nsilcmop_id = self.engine.new_item(rollback, session, "nsilcmops", indata, kwargs) outdata = {"id": _id, "nsilcmop_id": nsilcmop_id} elif topic == "netslice_instances" and item: indata["lcmOperationType"] = item - indata["nsiInstanceId"] = _id + indata["netsliceInstanceId"] = _id _id = self.engine.new_item(rollback, session, "nsilcmops", indata, kwargs) self._set_location_header(main_topic, version, "nsi_lcm_op_occs", _id) outdata = {"id": _id} @@ -926,7 +926,7 @@ class Server(object): elif topic == "netslice_instances_content" and not session["force"]: nsilcmop_desc = { "lcmOperationType": "terminate", - "nsiInstanceId": _id, + "netsliceInstanceId": _id, "autoremove": True } opp_id = self.engine.new_item(rollback, session, "nsilcmops", nsilcmop_desc, None) diff --git a/osm_nbi/validation.py b/osm_nbi/validation.py index acb53c0..a244ac1 100644 --- a/osm_nbi/validation.py +++ b/osm_nbi/validation.py @@ -712,7 +712,7 @@ nsi_instantiate = { "type": "object", "properties": { "lcmOperationType": string_schema, - "nsiInstanceId": id_schema, + "netsliceInstanceId": id_schema, "nsiName": name_schema, "nsiDescription": {"oneOf": [description_schema, null_schema]}, "nstId": string_schema, -- 2.25.1