From: garciaale Date: Tue, 24 Nov 2020 15:26:57 +0000 (-0300) Subject: Fixes issues with images, interfaces and configurations by adapting them to SOL006 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F23%2F10023%2F4;p=osm%2FNBI.git Fixes issues with images, interfaces and configurations by adapting them to SOL006 Change-Id: Ibdca08eea3105c68aee29a3d33159a4661b6b042 Signed-off-by: garciaale --- diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index 487ed51..85e2c44 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -416,14 +416,11 @@ class NsrTopic(BaseTopic): if guest_epa: flavor_data["guest-epa"] = guest_epa - f = next((f for f in nsr_descriptor["flavor"] if - all(f.get(k) == flavor_data[k] for k in flavor_data)), None) - if not f: - flavor_data["vim_info"] = [] - flavor_data["name"] = vdu["id"][:56] + "-flv" - flavor_data["id"] = str(len(nsr_descriptor["flavor"])) - nsr_descriptor["flavor"].append(flavor_data) + flavor_data["vim_info"] = [] + flavor_data["name"] = vdu["id"][:56] + "-flv" + flavor_data["id"] = str(len(nsr_descriptor["flavor"])) + nsr_descriptor["flavor"].append(flavor_data) sw_image_id = vdu.get("sw-image-desc") if sw_image_id: @@ -587,6 +584,9 @@ class NsrTopic(BaseTopic): vdu_iface["mgmt-vnf"] = True vdu_iface["mgmt-interface"] = True # TODO change to mgmt-vdu + if iface.get("virtual-interface"): + vdu_iface.update(deepcopy(iface["virtual-interface"])) + # look for network where this interface is connected iface_ext_cp = vdu_iface.get("external-connection-point-ref") if iface_ext_cp: @@ -695,14 +695,16 @@ class NsLcmOpTopic(BaseTopic): if indata.get("member_vnf_index"): vnfd = self._get_vnfd_from_vnf_member_index(indata["member_vnf_index"], nsr["_id"]) if indata.get("vdu_id"): - vdud = self._check_valid_vdu(vnfd, indata["vdu_id"]) - descriptor_configuration = vdud.get("vdu-configuration", {}).get("config-primitive") + self._check_valid_vdu(vnfd, indata["vdu_id"]) + # TODO: Change the [0] as vdu-configuration is now a list + descriptor_configuration = vnfd.get("vdu-configuration", [{}])[0].get("config-primitive") elif indata.get("kdu_name"): - kdud = self._check_valid_kdu(vnfd, indata["kdu_name"]) - descriptor_configuration = kdud.get("kdu-configuration", {}).get("config-primitive") + self._check_valid_kdu(vnfd, indata["kdu_name"]) + # TODO: Change the [0] as kdu-configuration is now a list + descriptor_configuration = vnfd.get("kdu-configuration", [{}])[0].get("config-primitive") else: - # TODO: Validate the [0] as vnf-configuration is now a list - descriptor_configuration = vnfd.get("vnf-configuration", {})[0].get("config-primitive") + # TODO: Change the [0] as vnf-configuration is now a list + descriptor_configuration = vnfd.get("vnf-configuration", [{}])[0].get("config-primitive") else: # use a NSD descriptor_configuration = nsd.get("ns-configuration", {}).get("config-primitive")