X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fnbi.py;h=afc65c011861bf5421218cba48c1fe01d7628386;hp=0616430bd449503d29d54322f39d15ef6458660c;hb=ace34903be528e8e10e096d3d059b81df30ddaa9;hpb=044f4317e21a4bb0d6a4a50c8a99a94ed35b8e3f diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index 0616430..afc65c0 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -40,7 +40,7 @@ __author__ = "Alfonso Tierno " __version__ = "0.1.3" version_date = "Jan 2019" -database_version = '1.1' +database_version = '1.2' auth_database_version = '1.0' nbi_server = None # instance of Server class subscription_thread = None # instance of SubscriptionThread class @@ -217,11 +217,10 @@ class Server(object): "": {"METHODS": ("GET", "POST", "DELETE", "PATCH", "PUT")} }, "projects": {"METHODS": ("GET", "POST"), - # Added PUT to allow Project Name modification "": {"METHODS": ("GET", "DELETE", "PUT")} }, "roles": {"METHODS": ("GET", "POST"), - "": {"METHODS": ("GET", "POST", "DELETE")} + "": {"METHODS": ("GET", "POST", "DELETE", "PUT")} }, "vims": {"METHODS": ("GET", "POST"), "": {"METHODS": ("GET", "DELETE", "PATCH", "PUT")} @@ -873,9 +872,9 @@ class Server(object): # creates nslcmop indata["lcmOperationType"] = "instantiate" indata["nsInstanceId"] = _id - self.engine.new_item(rollback, session, "nslcmops", indata, None) + nslcmop_id = self.engine.new_item(rollback, session, "nslcmops", indata, None) self._set_location_header(main_topic, version, topic, _id) - outdata = {"id": _id} + outdata = {"id": _id, "nslcmop_id": nslcmop_id} elif topic == "ns_instances" and item: indata["lcmOperationType"] = item indata["nsInstanceId"] = _id @@ -888,13 +887,13 @@ class Server(object): _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 - self.engine.new_item(rollback, session, "nsilcmops", indata, kwargs) - outdata = {"id": _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} @@ -927,7 +926,7 @@ class Server(object): 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) @@ -956,6 +955,10 @@ class Server(object): cherrypy.response.status = HTTPStatus.NO_CONTENT.value else: raise NbiException("Method {} not allowed".format(method), HTTPStatus.METHOD_NOT_ALLOWED) + + # if Role information changes, it is needed to reload the information of roles + if topic == "roles" and method != "GET": + self.authenticator.load_operation_to_allowed_roles() return self._format_out(outdata, session, _format) except Exception as e: if isinstance(e, (NbiException, EngineException, DbException, FsException, MsgException, AuthException,