"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
: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
# 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"]
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
_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}
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
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})
_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}
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)