Fix Bug 1607 interface position is not taken into account 07/12207/3
authoraticig <gulsum.atici@canonical.com>
Wed, 15 Jun 2022 22:39:44 +0000 (01:39 +0300)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 22 Jun 2022 20:23:51 +0000 (22:23 +0200)
This fix provides to pass the position information to LCM.

Change-Id: Ic3ddc376932ad52e09205484202542b0c50a6cd3
Signed-off-by: aticig <gulsum.atici@canonical.com>
osm_nbi/instance_topics.py
osm_nbi/tests/test_db_descriptors.py
osm_nbi/tests/test_instance_topics.py

index 57c7232..176f86d 100644 (file)
@@ -896,7 +896,10 @@ class NsrTopic(BaseTopic):
                 vdur["internal-connection-point"].append(vdu_icp)
 
                 for iface in icp.get("virtual-network-interface-requirement", ()):
-                    iface_fields = ("name", "mac-address")
+                    # Name, mac-address and interface position is taken from VNFD
+                    # and included into VNFR. By this way RO can process this information
+                    # while creating the VDU.
+                    iface_fields = ("name", "mac-address", "position")
                     vdu_iface = {
                         x: iface[x] for x in iface_fields if iface.get(x) is not None
                     }
index ea3cdd8..1914190 100644 (file)
@@ -501,10 +501,12 @@ db_vnfrs_text = """
             mgmt-vnf: true
             name: mgmtVM-eth0
             ns-vld-id: mgmt
+            position: 1
         -   ip-address: 192.168.54.2
             mac-address: fa:16:3e:6e:7e:78
             name: mgmtVM-eth1
             vnf-vld-id: internal
+            position: 2
         internal-connection-point:
         -   connection-point-id: mgmtVM-internal
             id: mgmtVM-internal
index 7623e8e..2ad596d 100644 (file)
@@ -531,6 +531,19 @@ class TestNsrTopic(unittest.TestCase):
         self.assertEqual(
             len(created_vnfrs), 2, "created a mismatch number of vnfr at database"
         )
+
+        self.assertEqual(
+            created_vnfrs[0]["vdur"][0]["interfaces"][0]["position"],
+            1,
+            "vdur first interface position does not match",
+        )
+
+        self.assertEqual(
+            created_vnfrs[0]["vdur"][0]["interfaces"][1]["position"],
+            2,
+            "vdur second interface position does not match",
+        )
+
         self.assertEqual(
             len(created_nsrs), 1, "Only one nsrs must be created at database"
         )