From: Felipe Vicens Date: Thu, 30 May 2019 11:01:20 +0000 (+0200) Subject: Fix netslice termination in two steps when shared nsr X-Git-Tag: v6.0.0~27 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=58e2d2f9bb87fc5743deb4d086c0c8609f7e9245;p=osm%2FNBI.git Fix netslice termination in two steps when shared nsr Change-Id: I5754c77dc0d6ff2e69eb71d07ed8a1143ba3c4b6 Signed-off-by: Felipe Vicens --- diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index aba441f..f3418f7 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -1247,12 +1247,15 @@ class NsiLcmOpTopic(BaseTopic): for index, nsr_item in enumerate(nsrs_list): nsi = None if nsr_item.get("shared"): - _filter["_admin.nsrs-detailed-list.ANYINDEX.shared"] = True, + _filter["_admin.nsrs-detailed-list.ANYINDEX.shared"] = True _filter["_admin.nsrs-detailed-list.ANYINDEX.nsrId"] = nsr_item["nsrId"] _filter["_admin.nsrs-detailed-list.ANYINDEX.nslcmop_instantiate.ne"] = None _filter["_id.ne"] = nsiInstanceId - nsi = self.db.get_one("nsis", _filter, fail_on_empty=False, fail_on_more=False) + if operation == "terminate": + _update = {"_admin.nsrs-detailed-list.{}.nslcmop_instantiate".format(index): None} + self.db.set_one("nsis", {"_id": nsir["_id"]}, _update) + # looks the first nsi fulfilling the conditions but not being the current NSIR if nsi: nsi_admin_shared = nsi["_admin"]["nsrs-detailed-list"]