X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fnbi.py;h=705979be5da7719e750eb9a73dc3ce82cf4c1058;hp=a9e2b244ca8143dba5d771cebb3808be16f3941a;hb=35ef2f7832eb995b700a882262305a0dfedbc4c1;hpb=032916caa09d64edf381dec5d66c6a8cc50e75a6 diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index a9e2b24..705979b 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -211,8 +211,12 @@ class Server(object): "": {"METHODS": ("GET", "POST", "DELETE", "PATCH", "PUT")} }, "projects": {"METHODS": ("GET", "POST"), - "": {"METHODS": ("GET", "DELETE")} + # Added PUT to allow Project Name modification + "": {"METHODS": ("GET", "DELETE", "PUT")} }, + "roles": {"METHODS": ("GET", "POST"), + "": {"METHODS": ("GET", "POST", "DELETE")} + }, "vims": {"METHODS": ("GET", "POST"), "": {"METHODS": ("GET", "DELETE", "PATCH", "PUT")} }, @@ -333,6 +337,17 @@ class Server(object): }, } }, + "nspm": { + "v1": { + "pm_jobs": { + "": { + "reports": { + "": {"METHODS": ("GET")} + } + }, + }, + }, + }, } def _format_in(self, kwargs): @@ -695,7 +710,7 @@ class Server(object): if not main_topic or not version or not topic: raise NbiException("URL must contain at least 'main_topic/version/topic'", HTTPStatus.METHOD_NOT_ALLOWED) - if main_topic not in ("admin", "vnfpkgm", "nsd", "nslcm", "pdu", "nst", "nsilcm"): + if main_topic not in ("admin", "vnfpkgm", "nsd", "nslcm", "pdu", "nst", "nsilcm", "nspm"): raise NbiException("URL main_topic '{}' not supported".format(main_topic), HTTPStatus.METHOD_NOT_ALLOWED) if version != 'v1': @@ -719,7 +734,7 @@ class Server(object): engine_topic = topic if topic == "subscriptions": engine_topic = main_topic + "_" + topic - if item: + if item and topic != "pm_jobs": engine_topic = item if main_topic == "nsd": @@ -737,7 +752,7 @@ class Server(object): elif main_topic == "nsilcm": engine_topic = "nsis" if topic == "nsi_lcm_op_occs": - engine_topic = "nsilcmops" + engine_topic = "nsilcmops" elif main_topic == "pdu": engine_topic = "pdus" if engine_topic == "vims": # TODO this is for backward compatibility, it will remove in the future @@ -759,6 +774,9 @@ class Server(object): elif not _id: outdata = self.engine.get_item_list(session, engine_topic, kwargs) else: + if item == "reports": + # TODO check that project_id (_id in this context) has permissions + _id = args[0] outdata = self.engine.get_item(session, engine_topic, _id) elif method == "POST": if topic in ("ns_descriptors_content", "vnf_packages_content", "netslice_templates_content"): @@ -797,7 +815,7 @@ class Server(object): indata["nsiInstanceId"] = _id self.engine.new_item(rollback, session, "nsilcmops", indata, kwargs) outdata = {"id": _id} - + elif topic == "netslice_instances" and item: indata["lcmOperationType"] = item indata["nsiInstanceId"] = _id