-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
},
"ns_lcm_op_occs": {"METHODS": "GET",
"<ID>": {"METHODS": "GET"},
},
"ns_lcm_op_occs": {"METHODS": "GET",
"<ID>": {"METHODS": "GET"},
try:
if not topic or not version or not item:
raise NbiException("URL must contain at least 'topic/version/item'", HTTPStatus.METHOD_NOT_ALLOWED)
try:
if not topic or not version or not item:
raise NbiException("URL must contain at least 'topic/version/item'", HTTPStatus.METHOD_NOT_ALLOWED)
if engine_item == "vims": # TODO this is for backward compatibility, it will remove in the future
engine_item = "vim_accounts"
if engine_item == "vims": # TODO this is for backward compatibility, it will remove in the future
engine_item = "vim_accounts"
_id = cherrypy.request.headers.get("Transaction-Id")
if not _id:
_id = self.engine.new_item(session, engine_item, {}, None, cherrypy.request.headers)
_id = cherrypy.request.headers.get("Transaction-Id")
if not _id:
_id = self.engine.new_item(session, engine_item, {}, None, cherrypy.request.headers)
completed = self.engine.upload_content(session, engine_item, _id, indata, kwargs, cherrypy.request.headers)
if completed:
self._set_location_header(topic, version, item, _id)
completed = self.engine.upload_content(session, engine_item, _id, indata, kwargs, cherrypy.request.headers)
if completed:
self._set_location_header(topic, version, item, _id)
outdata = {"id": _id}
elif item == "ns_instances_content":
_id = self.engine.new_item(session, engine_item, indata, kwargs)
outdata = {"id": _id}
elif item == "ns_instances_content":
_id = self.engine.new_item(session, engine_item, indata, kwargs)
self.engine.ns_action(session, _id, "instantiate", {}, None)
self._set_location_header(topic, version, item, _id)
outdata = {"id": _id}
self.engine.ns_action(session, _id, "instantiate", {}, None)
self._set_location_header(topic, version, item, _id)
outdata = {"id": _id}
- self.engine.ns_action(session, _id, "terminate", {"autoremove": True}, None)
+ opp_id = self.engine.ns_action(session, _id, "terminate", {"autoremove": True}, None)
+ outdata = {"_id": opp_id}
raise NbiException("Method {} not allowed".format(method), HTTPStatus.METHOD_NOT_ALLOWED)
return self._format_out(outdata, session, _format)
except (NbiException, EngineException, DbException, FsException, MsgException) as e:
raise NbiException("Method {} not allowed".format(method), HTTPStatus.METHOD_NOT_ALLOWED)
return self._format_out(outdata, session, _format)
except (NbiException, EngineException, DbException, FsException, MsgException) as e:
+ if hasattr(outdata, "close"): # is an open file
+ outdata.close()
+ if rollback:
+ try:
+ self.engine.del_item(**rollback)
+ except Exception as e2:
+ cherrypy.log("Rollback Exception {}: {}".format(rollback, e2))
error_text = str(e)
if isinstance(e, MsgException):
error_text = "{} has been '{}' but other modules cannot be informed because an error on bus".format(
error_text = str(e)
if isinstance(e, MsgException):
error_text = "{} has been '{}' but other modules cannot be informed because an error on bus".format(