From 08ddb14b077121ffced28e41c441fef31b6bb6a1 Mon Sep 17 00:00:00 2001 From: Felipe Vicens Date: Fri, 9 Aug 2019 15:52:40 +0200 Subject: [PATCH] Fix bug 815 - Increased the granularity of the netslice subnet filters for shared nss selection Change-Id: I71beb2d73da3f31e2314f29e4c9ca1e4e43dcc1f Signed-off-by: Felipe Vicens --- osm_nbi/instance_topics.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index 74504b3..809578e 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -1082,14 +1082,15 @@ class NsiTopic(BaseTopic): # Is the nss shared and instantiated? _filter["_admin.nsrs-detailed-list.ANYINDEX.shared"] = True _filter["_admin.nsrs-detailed-list.ANYINDEX.nsd-id"] = service["nsd-ref"] + _filter["_admin.nsrs-detailed-list.ANYINDEX.nss-id"] = service["id"] nsi = self.db.get_one("nsis", _filter, fail_on_empty=False, fail_on_more=False) - if nsi and service.get("is-shared-nss"): nsrs_detailed_list = nsi["_admin"]["nsrs-detailed-list"] for nsrs_detailed_item in nsrs_detailed_list: if nsrs_detailed_item["nsd-id"] == service["nsd-ref"]: - _id_nsr = nsrs_detailed_item["nsrId"] - break + if nsrs_detailed_item["nss-id"] == service["id"]: + _id_nsr = nsrs_detailed_item["nsrId"] + break for netslice_subnet in nsi["_admin"]["netslice-subnet"]: if netslice_subnet["nss-id"] == service["id"]: indata_ns = netslice_subnet @@ -1118,7 +1119,7 @@ class NsiTopic(BaseTopic): # Creates Nsr objects _id_nsr, _ = self.nsrTopic.new(rollback, session, indata_ns, kwargs, headers) nsrs_item = {"nsrId": _id_nsr, "shared": service.get("is-shared-nss"), "nsd-id": service["nsd-ref"], - "nslcmop_instantiate": None} + "nss-id": service["id"], "nslcmop_instantiate": None} indata_ns["nss-id"] = service["id"] nsrs_list.append(nsrs_item) nsi_netslice_subnet.append(indata_ns) -- 2.25.1