From: garciadeblas Date: Fri, 12 Feb 2021 11:23:50 +0000 (+0000) Subject: Fix bug 1441: set flag in NSR and VNFR to indicate that SRIOV and PT interfaces are... X-Git-Tag: v9.1.0~1^2~3 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=61c959146044488ea16526e6fba578f6afa124cc;p=osm%2FNBI.git Fix bug 1441: set flag in NSR and VNFR to indicate that SRIOV and PT interfaces are used in their VLD Change-Id: I1ab178d760a15ab4502ef31a211dd67f59a3c79f Signed-off-by: garciadeblas --- diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index b3eca02..05ca347 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -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)