Fix netslice termination in two steps when shared nsr 79/7579/2
authorFelipe Vicens <felipe.vicens@atos.net>
Thu, 30 May 2019 11:01:20 +0000 (13:01 +0200)
committerFelipe Vicens <felipe.vicens@atos.net>
Thu, 30 May 2019 13:57:14 +0000 (15:57 +0200)
Change-Id: I5754c77dc0d6ff2e69eb71d07ed8a1143ba3c4b6
Signed-off-by: Felipe Vicens <felipe.vicens@atos.net>
osm_nbi/instance_topics.py

index aba441f..f3418f7 100644 (file)
@@ -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"]