Fix bug 1441: set flag in NSR and VNFR to indicate that SRIOV and PT interfaces are... 01/10301/5
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 12 Feb 2021 11:23:50 +0000 (11:23 +0000)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Sun, 21 Feb 2021 16:36:24 +0000 (16:36 +0000)
Change-Id: I1ab178d760a15ab4502ef31a211dd67f59a3c79f
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_nbi/instance_topics.py

index b3eca02..05ca347 100644 (file)
@@ -592,13 +592,25 @@ class NsrTopic(BaseTopic):
                         # TODO: Change for multiple df support
                         for df in get_iterable(nsd.get("df")):
                             for vnf_profile in get_iterable(df.get("vnf-profile")):
-                                for vlc in get_iterable(vnf_profile.get("virtual-link-connectivity")):
+                                for vlc_index, vlc in \
+                                        enumerate(get_iterable(vnf_profile.get("virtual-link-connectivity"))):
                                     for cpd in get_iterable(vlc.get("constituent-cpd-id")):
                                         if cpd.get("constituent-cpd-id") == iface_ext_cp:
                                             vdu_iface["ns-vld-id"] = vlc.get("virtual-link-profile-id")
+                                            # if iface type is SRIOV or PASSTHROUGH, set pci-interfaces flag to True
+                                            if vdu_iface.get("type") in ("SR-IOV", "PCI-PASSTHROUGH"):
+                                                nsr_descriptor["vld"][vlc_index]["pci-interfaces"] = True
                                             break
                     elif vdu_iface.get("internal-connection-point-ref"):
                         vdu_iface["vnf-vld-id"] = icp.get("int-virtual-link-desc")
+                        # TODO: store fixed IP address in the record (if it exists in the ICP)
+                        # if iface type is SRIOV or PASSTHROUGH, set pci-interfaces flag to True
+                        if vdu_iface.get("type") in ("SR-IOV", "PCI-PASSTHROUGH"):
+                            ivld_index = utils.find_index_in_list(vnfd.get("int-virtual-link-desc", ()),
+                                                                  lambda ivld:
+                                                                  ivld["id"] == icp.get("int-virtual-link-desc")
+                                                                  )
+                            vnfr_descriptor["vld"][ivld_index]["pci-interfaces"] = True
 
                     vdur["interfaces"].append(vdu_iface)