From c9c0339dee11c893b35e9eb05098554dbda751a3 Mon Sep 17 00:00:00 2001 From: aticig Date: Thu, 16 Jun 2022 01:39:44 +0300 Subject: [PATCH] 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 --- osm_nbi/instance_topics.py | 5 ++++- osm_nbi/tests/test_db_descriptors.py | 2 ++ osm_nbi/tests/test_instance_topics.py | 13 +++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) 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 @@ 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 } 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 @@ 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 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 @@ 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" ) -- 2.17.1