},
"nslcm": {
"v1": {
+ "ns_instances_terminate": {
+ "METHODS": ("POST"),
+ "ROLE_PERMISSION": "ns_instances:",
+ },
"ns_instances_content": {
"METHODS": ("GET", "POST"),
"ROLE_PERMISSION": "ns_instances:",
)
self._set_location_header(main_topic, version, topic, _id)
outdata = {"id": _id, "nslcmop_id": nslcmop_id, "nsName": nsName}
+ elif topic == "ns_instances_terminate":
+ if indata.get("ns_ids"):
+ for ns_id in indata.get("ns_ids"):
+ nslcmop_desc = {
+ "lcmOperationType": "terminate",
+ "nsInstanceId": ns_id,
+ "autoremove": indata.get("autoremove")
+ if "autoremove" in indata
+ else True,
+ }
+ op_id, _, _ = self.engine.new_item(
+ rollback,
+ engine_session,
+ "nslcmops",
+ nslcmop_desc,
+ kwargs,
+ )
+ if not op_id:
+ _ = self.engine.del_item(
+ engine_session, engine_topic, ns_id
+ )
+ outdata = {"ns_ids": indata.get("ns_ids")}
+ cherrypy.response.status = HTTPStatus.ACCEPTED.value
elif topic == "ns_instances" and item:
indata["lcmOperationType"] = item
indata["nsInstanceId"] = _id
"GET /nslcm/v1/ns_instances": "ns_instances:get"
"POST /nslcm/v1/ns_instances_content": "ns_instances:content:post"
+ "POST /nslcm/v1/ns_instances_terminate": "ns_instances:content:post"
"GET /nslcm/v1/ns_instances_content/<nsInstanceId>": "ns_instances:id:get"
"GET /nslcm/v1/ns_instances/<nsInstanceId>": "ns_instances:id:get"