Commit c9c0339d authored by aticig's avatar aticig Committed by garciadeblas
Browse files

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's avataraticig <gulsum.atici@canonical.com>
parent 519da48b
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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
                    }
+2 −0
Original line number Diff line number Diff line
@@ -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
+13 −0
Original line number Diff line number Diff line
@@ -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"
        )