Fix Bug 1607 interface position is not taken into account

This fix provides to pass the position information to LCM.

Change-Id: Ic3ddc376932ad52e09205484202542b0c50a6cd3
Signed-off-by: aticig <gulsum.atici@canonical.com>
diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py
index 57c7232..176f86d 100644
--- a/osm_nbi/instance_topics.py
+++ b/osm_nbi/instance_topics.py
@@ -896,7 +896,10 @@
                 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
                     }
diff --git a/osm_nbi/tests/test_db_descriptors.py b/osm_nbi/tests/test_db_descriptors.py
index ea3cdd8..1914190 100644
--- a/osm_nbi/tests/test_db_descriptors.py
+++ b/osm_nbi/tests/test_db_descriptors.py
@@ -501,10 +501,12 @@
             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
diff --git a/osm_nbi/tests/test_instance_topics.py b/osm_nbi/tests/test_instance_topics.py
index 7623e8e..2ad596d 100644
--- a/osm_nbi/tests/test_instance_topics.py
+++ b/osm_nbi/tests/test_instance_topics.py
@@ -531,6 +531,19 @@
         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"
         )