X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fnbi.py;h=a0229c8aee7fe0587172fdb0d92a2f59a1dd25e6;hp=c2cb1aff6cff174f047a4374b7da2c26664745fd;hb=7ae1011101bd2c136680170c7d8f05717f204c8d;hpb=2236d203182b39ae5d20d21a475c95f6a5d5fbc5 diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index c2cb1af..a0229c8 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -158,13 +158,13 @@ class Server(object): "": {"METHODS": ("GET", "DELETE")} }, "vims": {"METHODS": ("GET", "POST"), - "": {"METHODS": ("GET", "DELETE")} + "": {"METHODS": ("GET", "DELETE", "PATCH", "PUT")} }, "vim_accounts": {"METHODS": ("GET", "POST"), - "": {"METHODS": ("GET", "DELETE", "PATCH")} + "": {"METHODS": ("GET", "DELETE", "PATCH", "PUT")} }, "sdns": {"METHODS": ("GET", "POST"), - "": {"METHODS": ("GET", "DELETE", "PATCH")} + "": {"METHODS": ("GET", "DELETE", "PATCH", "PUT")} }, } }, @@ -726,11 +726,11 @@ class Server(object): if engine_item in ("vim_accounts", "sdns"): cherrypy.response.status = HTTPStatus.ACCEPTED.value - elif method == "PUT": + elif method in ("PUT", "PATCH"): if not indata and not kwargs: raise NbiException("Nothing to update. Provide payload and/or query string", HTTPStatus.BAD_REQUEST) - if item2 in ("nsd_content", "package_content"): + if item2 in ("nsd_content", "package_content") and method == "PUT": completed = self.engine.upload_content(session, engine_item, _id, indata, kwargs, cherrypy.request.headers) if not completed: @@ -739,11 +739,6 @@ class Server(object): outdata = None else: outdata = {"id": self.engine.edit_item(session, engine_item, _id, indata, kwargs, force=force)} - elif method == "PATCH": - if not indata and not kwargs: - raise NbiException("Nothing to update. Provide payload and/or query string", - HTTPStatus.BAD_REQUEST) - outdata = {"id": self.engine.edit_item(session, engine_item, _id, indata, kwargs, force=force)} else: raise NbiException("Method {} not allowed".format(method), HTTPStatus.METHOD_NOT_ALLOWED) return self._format_out(outdata, session, _format)