Fix bug 1430 13/10413/3
authorsousaedu <eduardo.sousa@canonical.com>
Mon, 1 Mar 2021 23:19:15 +0000 (00:19 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 5 Mar 2021 11:32:31 +0000 (12:32 +0100)
Change-Id: I62a8e017345ea5c231248b06b75ea583ebd58e25
Signed-off-by: sousaedu <eduardo.sousa@canonical.com>
osm_nbi/instance_topics.py

index 7b3e9ad..cae9f54 100644 (file)
@@ -586,12 +586,6 @@ class NsrTopic(BaseTopic):
                     "name": icp.get("id"),
                 }
 
-                if "port-security-enabled" in icp:
-                    vdu_icp["port-security-enabled"] = icp["port-security-enabled"]
-
-                if "port-security-disable-strategy" in icp:
-                    vdu_icp["port-security-disable-strategy"] = icp["port-security-disable-strategy"]
-
                 vdur["internal-connection-point"].append(vdu_icp)
 
                 for iface in icp.get("virtual-network-interface-requirement", ()):
@@ -599,6 +593,12 @@ class NsrTopic(BaseTopic):
                     vdu_iface = {x: iface[x] for x in iface_fields if iface.get(x) is not None}
 
                     vdu_iface["internal-connection-point-ref"] = vdu_icp["id"]
+                    if "port-security-enabled" in icp:
+                        vdu_iface["port-security-enabled"] = icp["port-security-enabled"]
+
+                    if "port-security-disable-strategy" in icp:
+                        vdu_iface["port-security-disable-strategy"] = icp["port-security-disable-strategy"]
+
                     for ext_cp in vnfd.get("ext-cpd", ()):
                         if not ext_cp.get("int-cpd"):
                             continue
@@ -606,6 +606,17 @@ class NsrTopic(BaseTopic):
                             continue
                         if icp["id"] == ext_cp["int-cpd"].get("cpd"):
                             vdu_iface["external-connection-point-ref"] = ext_cp.get("id")
+
+                            if "port-security-enabled" in ext_cp:
+                                vdu_iface["port-security-enabled"] = (
+                                    ext_cp["port-security-enabled"]
+                                )
+
+                            if "port-security-disable-strategy" in ext_cp:
+                                vdu_iface["port-security-disable-strategy"] = (
+                                    ext_cp["port-security-disable-strategy"]
+                                )
+
                             break
 
                     if vnfd_mgmt_cp and vdu_iface.get("external-connection-point-ref") == vnfd_mgmt_cp: