return (
None,
None,
- None,
) # a none in this case is used to indicate not instantiated. It can be removed
if operation != "instantiate":
raise EngineException(
indata["newVdur"] = vnfr_descriptor["vdur"]
nslcmop_desc = self._create_nslcmop(nsInstanceId, operation, indata)
_id = nslcmop_desc["_id"]
- nsName = nsr.get("name")
self.format_on_new(
nslcmop_desc, session["project_id"], make_public=session["public"]
)
rollback.append({"topic": "nslcmops", "_id": _id})
if not slice_object:
self.msg.write("ns", operation, nslcmop_desc)
- return _id, nsName, None
+ return _id, None
except ValidationError as e: # TODO remove try Except, it is captured at nbi.py
raise EngineException(e, HTTPStatus.UNPROCESSABLE_ENTITY)
# except DbException as e:
# creates nslcmop
indata["lcmOperationType"] = "instantiate"
indata["nsInstanceId"] = _id
- nslcmop_id, nsName, _ = self.engine.new_item(
+ nslcmop_id, _ = self.engine.new_item(
rollback, engine_session, "nslcmops", indata, None
)
self._set_location_header(main_topic, version, topic, _id)
- outdata = {"id": _id, "nslcmop_id": nslcmop_id, "nsName": nsName}
+ outdata = {"id": _id, "nslcmop_id": nslcmop_id}
elif topic == "ns_instances" and item:
indata["lcmOperationType"] = item
indata["nsInstanceId"] = _id
- _id, nsName, _ = self.engine.new_item(
+ _id, _ = self.engine.new_item(
rollback, engine_session, "nslcmops", indata, kwargs
)
self._set_location_header(
main_topic, version, "ns_lcm_op_occs", _id
)
- outdata = {"id": _id, "nsName": nsName}
+ outdata = {"id": _id}
cherrypy.response.status = HTTPStatus.ACCEPTED.value
elif topic == "netslice_instances_content":
# creates NetSlice_Instance_record (NSIR)
elif topic == "vnf_instances" and item:
indata["lcmOperationType"] = item
indata["vnfInstanceId"] = _id
- _id, nsName, _ = self.engine.new_item(
+ _id, _ = self.engine.new_item(
rollback, engine_session, "vnflcmops", indata, kwargs
)
self._set_location_header(
main_topic, version, "vnf_lcm_op_occs", _id
)
- outdata = {"id": _id, "nsName": nsName}
+ outdata = {"id": _id}
cherrypy.response.status = HTTPStatus.ACCEPTED.value
elif topic == "ns_lcm_op_occs" and item == "cancel":
indata["nsLcmOpOccId"] = _id
"nsInstanceId": _id,
"autoremove": True,
}
- op_id, nsName, _ = self.engine.new_item(
+ op_id, _ = self.engine.new_item(
rollback, engine_session, "nslcmops", nslcmop_desc, kwargs
)
if op_id:
- outdata = {"_id": op_id, "nsName": nsName}
+ outdata = {"_id": op_id}
elif (
topic == "netslice_instances_content"
and not engine_session["force"]
):
self.authenticator.remove_token_from_cache()
- cef_event(
- cef_logger,
- {
- "name": "User Operation",
- "sourceUserName": token_info.get("username"),
- },
- )
- if topic == "ns_instances_content" and url_id:
- nsName = (
- outdata.get("name") if method == "GET" else outdata.get("nsName")
- )
- cef_event(
- cef_logger,
- {
- "message": "{} {}, nsName={}, nsdId={}, Project={} Outcome=Success".format(
- log_mapping[method],
- topic,
- nsName,
- outdata.get("id"),
- token_info.get("project_name"),
- ),
- },
- )
- cherrypy.log("{}".format(cef_logger))
- elif topic == "ns_instances_content" and method == "POST":
- cef_event(
- cef_logger,
- {
- "message": "{} {}, nsName={}, nsdId={}, Project={} Outcome=Success".format(
- log_mapping[method],
- topic,
- outdata.get("nsName"),
- outdata.get("id"),
- token_info.get("project_name"),
- ),
- },
- )
- cherrypy.log("{}".format(cef_logger))
- elif topic in ("ns_instances", "vnf_instances") and item:
- cef_event(
- cef_logger,
- {
- "message": "{} {}, nsName={}, nsdId={}, Project={} Outcome=Success".format(
- log_mapping[method],
- topic,
- outdata.get("nsName"),
- url_id,
- token_info.get("project_name"),
- ),
- },
- )
- cherrypy.log("{}".format(cef_logger))
- elif item is not None:
+ if item is not None:
cef_event(
cef_logger,
{
+ "name": "User Operation",
+ "sourceUserName": token_info.get("username"),
"message": "Performing {} operation on {} {}, Project={} Outcome=Success".format(
item,
topic,
cef_event(
cef_logger,
{
+ "name": "User Operation",
+ "sourceUserName": token_info.get("username"),
"message": "{} {} {}, Project={} Outcome=Success".format(
log_mapping[method],
topic,
rollback = []
headers = {}
- nslcmop_id, nsName, _ = self.nslcmop_topic.new(
+ nslcmop_id, _ = self.nslcmop_topic.new(
rollback, session, indata=deepcopy(indata), kwargs=None, headers=headers
)
rollback = []
headers = {}
- nslcmop_id, nsName, _ = self.nslcmop_topic.new(
+ nslcmop_id, _ = self.nslcmop_topic.new(
rollback, session, indata, kwargs=None, headers=headers
)
"vdu": {"vduCountIndex": 0, "vduId": "mgmtVM"},
"vnfInstanceId": "9e8006df-cdfa-4f63-bf6a-fce860d71c1f",
}
- nslcmop_id, nsName, _ = self.nslcmop_topic.new(
+ nslcmop_id, _ = self.nslcmop_topic.new(
rollback, session, indata, kwargs=None, headers=headers
)
"nsInstanceId": self.nsr_id,
"vnfInstanceId": "9e8006df-cdfa-4f63-bf6a-fce860d71c1f",
}
- nslcmop_id, nsName, _ = self.nslcmop_topic.new(
+ nslcmop_id, _ = self.nslcmop_topic.new(
rollback, session, indata, kwargs=None, headers=headers
)
}
with self.assertRaises(Exception) as e:
- nslcmop_id, nsName, _ = self.nslcmop_topic.new(
+ nslcmop_id, _ = self.nslcmop_topic.new(
rollback, session, indata, kwargs=None, headers=headers
)
self.assertTrue(