Pip standerdization and tox replacement
[osm/RO.git] / NG-RO / osm_ng_ro / ns.py
index 660a5f5..9841852 100644 (file)
@@ -681,15 +681,13 @@ class Ns(object):
                     else "IPv6",
                     "subnet_address": ip_profile.get("subnet-address"),
                     "gateway_address": ip_profile.get("gateway-address"),
-                    "dhcp_enabled": ip_profile["dhcp-params"].get("enabled", True)
-                    if "dhcp_params" in ip_profile
-                    else False,
-                    "dhcp_start_address": ip_profile["dhcp-params"].get("start-address")
-                    if "dhcp_params" in ip_profile
-                    else None,
-                    "dhcp_count": ip_profile["dhcp-params"].get("count")
-                    if "dhcp_params" in ip_profile
-                    else None,
+                    "dhcp_enabled": ip_profile.get("dhcp-params", {}).get(
+                        "enabled", False
+                    ),
+                    "dhcp_start_address": ip_profile.get("dhcp-params", {}).get(
+                        "start-address", None
+                    ),
+                    "dhcp_count": ip_profile.get("dhcp-params", {}).get("count", None),
                 }
 
                 if ip_profile.get("dns-server"):
@@ -785,6 +783,17 @@ class Ns(object):
                         continue  # interface not connected to any vld
 
                     extra_dict["depends_on"].append(net_text)
+
+                    if "port-security-enabled" in interface:
+                        interface["port_security"] = interface.pop(
+                            "port-security-enabled"
+                        )
+
+                    if "port-security-disable-strategy" in interface:
+                        interface["port_security_disable_strategy"] = interface.pop(
+                            "port-security-disable-strategy"
+                        )
+
                     net_item = {
                         x: v
                         for x, v in interface.items()