X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Finstance_topics.py;h=c2cd9ddf08729c5cdf588a57201e727f54bdcf89;hb=ea3a2c2766d6d6c652c758b8b5c3a90b004f157a;hp=f9539dd7e0d512e3535be8e78101116ed14f3188;hpb=c54e3be9ab71ec448b99c000adda9f8f2f60cabd;p=osm%2FNBI.git diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index f9539dd7..c2cd9ddf 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -48,6 +48,7 @@ from osm_nbi import utils from re import ( match, ) # For checking that additional parameter names are valid Jinja2 identifiers +from osm_nbi.temporal.nbi_temporal import NbiTemporal __author__ = "Alfonso Tierno " @@ -1173,6 +1174,7 @@ class NsLcmOpTopic(BaseTopic): def __init__(self, db, fs, msg, auth): BaseTopic.__init__(self, db, fs, msg, auth) self.nsrtopic = NsrTopic(db, fs, msg, auth) + self.temporal = NbiTemporal() def _check_ns_operation(self, session, nsr, operation, indata): """ @@ -2325,8 +2327,21 @@ class NsLcmOpTopic(BaseTopic): self.db.create("nslcmops", nslcmop_desc) rollback.append({"topic": "nslcmops", "_id": _id}) if not slice_object: + if "instantiate_params" in nsr: + if "vimAccountId" in nsr["instantiate_params"]: + vim = self._get_vim_account( + vim_id=nsr["instantiate_params"]["vimAccountId"], + session=session, + ) + if vim["vim_type"] == "paas": + self.logger.info("Starting {} workflow".format(operation)) + self.temporal.start_ns_workflow(nslcmop_desc) + return _id, None self.msg.write("ns", operation, nslcmop_desc) return _id, None + except ValidationError as e: # TODO remove try Except, it is captured at nbi.py + raise EngineException(e, HTTPStatus.UNPROCESSABLE_ENTITY) + return _id, None except ValidationError as e: # TODO remove try Except, it is captured at nbi.py raise EngineException(e, HTTPStatus.UNPROCESSABLE_ENTITY) # except DbException as e: