From 5cfc4b3e0be19078951fe52d4eab364185c323bc Mon Sep 17 00:00:00 2001 From: bravof Date: Thu, 22 Apr 2021 10:03:02 -0400 Subject: [PATCH] fix(vdu): vdu number of instances now is taking into account. Bug 1477 Change-Id: I63c5281cd5c9d935d51d1f1ace27fea782e84b4c Signed-off-by: bravof --- osm_nbi/instance_topics.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index bf0e3a9..84ba177 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -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"]: -- 2.25.1