fix(vdu): vdu number of instances now is taking into account. Bug 1477 07/10707/2
authorbravof <fbravo@whitestack.com>
Thu, 22 Apr 2021 14:03:02 +0000 (10:03 -0400)
committerbravof <fbravo@whitestack.com>
Tue, 27 Apr 2021 21:01:04 +0000 (23:01 +0200)
Change-Id: I63c5281cd5c9d935d51d1f1ace27fea782e84b4c
Signed-off-by: bravof <fbravo@whitestack.com>
osm_nbi/instance_topics.py

index bf0e3a9..84ba177 100644 (file)
@@ -550,7 +550,15 @@ class NsrTopic(BaseTopic):
                 vdu_config = utils.find_in_list(configs, lambda config: config["id"] == vdu["id"])
             except Exception:
                 vdu_config = None
-            
+
+            try:
+                vdu_instantiation_level = utils.find_in_list(
+                    vnfd.get("df")[0]["instantiation-level"][0]["vdu-level"],
+                    lambda a_vdu_profile: a_vdu_profile["vdu-id"] == vdu["id"]
+                )
+            except Exception:
+                vdu_instantiation_level = None
+
             if vdu_config:
                 external_connection_ee = utils.filter_in_list(
                     vdu_config.get("execution-environment-list", []),
@@ -689,7 +697,11 @@ class NsrTopic(BaseTopic):
             if nsr_flavor_desc:
                 vdur["ns-flavor-id"] = nsr_flavor_desc["id"]
 
-            count = int(vdu.get("count", 1))
+            if vdu_instantiation_level:
+                count = vdu_instantiation_level.get("number-of-instances")
+            else:
+                count = 1
+
             for index in range(0, count):
                 vdur = deepcopy(vdur)
                 for iface in vdur["interfaces"]: