import html_out as html
import logging
from engine import Engine, EngineException
-from dbbase import DbException
-from fsbase import FsException
-from msgbase import MsgException
+from osm_common.dbbase import DbException
+from osm_common.fsbase import FsException
+from osm_common.msgbase import MsgException
from base64 import standard_b64decode
#from os import getenv
from http import HTTPStatus
/ns_lcm_op_occs 5 5
/<nsLcmOpOccId> 5 5 5
TO BE COMPLETED 5 5
+ /vnfrs O
+ /<vnfrId> O
/subscriptions 5 5
/<subscriptionId> 5 X
/admin/v1
"<ID>": {"METHODS": ("GET", "DELETE")}
},
"vim_accounts": {"METHODS": ("GET", "POST"),
- "<ID>": {"METHODS": ("GET", "DELETE")}
+ "<ID>": {"METHODS": ("GET", "DELETE", "PATCH")}
},
"sdns": {"METHODS": ("GET", "POST"),
- "<ID>": {"METHODS": ("GET", "DELETE")}
+ "<ID>": {"METHODS": ("GET", "DELETE", "PATCH")}
},
}
},
},
"ns_lcm_op_occs": {"METHODS": "GET",
"<ID>": {"METHODS": "GET"},
- }
+ },
+ "vnfrs": {"METHODS": ("GET"),
+ "<ID>": {"METHODS": ("GET")}
+ },
}
},
}
engine_item = "nsrs"
if item == "ns_lcm_op_occs":
engine_item = "nslcmops"
+ if item == "vnfrs":
+ engine_item = "vnfrs"
if engine_item == "vims": # TODO this is for backward compatibility, it will remove in the future
engine_item = "vim_accounts"
cherrypy.response.status = HTTPStatus.NO_CONTENT.value
outdata = None
else:
- outdata = {"id": self.engine.edit_item(session, engine_item, args[1], indata, kwargs)}
+ outdata = {"id": self.engine.edit_item(session, engine_item, _id, indata, kwargs)}
+ 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)}
else:
raise NbiException("Method {} not allowed".format(method), HTTPStatus.METHOD_NOT_ALLOWED)
return self._format_out(outdata, session, _format)