"nsd": {"METHODS": ("GET",), # descriptor inside package
"ROLE_PERMISSION": "nsds:id:content:"
},
- "artifacts": {"*": {"METHODS": ("GET",),
- "ROLE_PERMISSION": "nsds:id:nsd_artifact:"
- }
+ "artifacts": {"METHODS": ("GET",),
+ "ROLE_PERMISSION": "nsds:id:nsd_artifact:",
+ "*": None,
}
}
},
"vnfd": {"METHODS": ("GET", ), # descriptor inside package
"ROLE_PERMISSION": "vnfds:id:content:"
},
- "artifacts": {"*": {"METHODS": ("GET", ),
- "ROLE_PERMISSION": "vnfds:id:vnfd_artifact:"
- }
+ "artifacts": {"METHODS": ("GET", ),
+ "ROLE_PERMISSION": "vnfds:id:vnfd_artifact:",
+ "*": None,
},
"action": {"METHODS": ("POST", ),
"ROLE_PERMISSION": "vnfds:id:action:"
"ROLE_PERMISSION": "vnf_instances:id:"
}
},
+ "subscriptions": {"METHODS": ("GET", "POST"),
+ "ROLE_PERMISSION": "ns_subscriptions:",
+ "<ID>": {"METHODS": ("GET", "DELETE"),
+ "ROLE_PERMISSION": "ns_subscriptions:id:"
+ }
+ },
}
},
"nst": {
"nst": {"METHODS": ("GET",), # descriptor inside package
"ROLE_PERMISSION": "slice_templates:id:content:"
},
- "artifacts": {"*": {"METHODS": ("GET",),
- "ROLE_PERMISSION": "slice_templates:id:content:"
- }
+ "artifacts": {"METHODS": ("GET",),
+ "ROLE_PERMISSION": "slice_templates:id:content:",
+ "*": None
}
}
},
elif "<ID>" in reference:
reference = reference["<ID>"]
elif "*" in reference:
- reference = reference["*"]
+ # if there is content
+ if reference["*"]:
+ reference = reference["*"]
break
else:
raise NbiException("Unexpected URL item {}".format(arg), HTTPStatus.METHOD_NOT_ALLOWED)
engine_session = self._manage_admin_query(token_info, kwargs, method, _id)
indata = self._format_in(kwargs)
engine_topic = topic
- if topic == "subscriptions":
- engine_topic = main_topic + "_" + topic
+
if item and topic != "pm_jobs":
engine_topic = item
if engine_topic == "vims": # TODO this is for backward compatibility, it will be removed in the future
engine_topic = "vim_accounts"
+ if topic == "subscriptions":
+ engine_topic = main_topic + "_" + topic
+
if method == "GET":
if item in ("nsd_content", "package_content", "artifacts", "vnfd", "nsd", "nst", "nst_content"):
if item in ("vnfd", "nsd", "nst"):
self._set_location_header(main_topic, version, "vnfpkg_op_occs", _id)
outdata = {"id": _id}
cherrypy.response.status = HTTPStatus.ACCEPTED.value
+ elif topic == "subscriptions":
+ _id, _ = self.engine.new_item(rollback, engine_session, engine_topic, indata, kwargs)
+ self._set_location_header(main_topic, version, topic, _id)
+ link = {}
+ link["self"] = cherrypy.response.headers["Location"]
+ outdata = {"id": _id, "filter": indata["filter"], "callbackUri": indata["CallbackUri"],
+ "_links": link}
+ cherrypy.response.status = HTTPStatus.CREATED.value
else:
_id, op_id = self.engine.new_item(rollback, engine_session, engine_topic, indata, kwargs,
cherrypy.request.headers)
if rollback_item.get("operation") == "set":
self.engine.db.set_one(rollback_item["topic"], {"_id": rollback_item["_id"]},
rollback_item["content"], fail_on_empty=False)
+ elif rollback_item.get("operation") == "del_list":
+ self.engine.db.del_list(rollback_item["topic"], rollback_item["filter"],
+ fail_on_empty=False)
else:
self.engine.db.del_one(rollback_item["topic"], {"_id": rollback_item["_id"]},
fail_on_empty=False)