X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fnbi.py;h=afc65c011861bf5421218cba48c1fe01d7628386;hp=20e052052b3a8c23d75dad3211ab436d211e3981;hb=ace34903be528e8e10e096d3d059b81df30ddaa9;hpb=b6a5819d7daefde450ab263a4a57a6d173255ee0 diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index 20e0520..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,7 +217,6 @@ 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"), @@ -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 + 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,