X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=NG-RO%2Fosm_ng_ro%2Fns.py;h=ee0463a4db662f802e9c21030e72c4ebd0fe2023;hb=812bc6fd62ca3e90dbe612a3eda314e5607942ca;hp=660a5f57d3c9230307927bfdef11f7e536fcb851;hpb=80135b928ab442c38898750b4751480205b4affc;p=osm%2FRO.git diff --git a/NG-RO/osm_ng_ro/ns.py b/NG-RO/osm_ng_ro/ns.py index 660a5f57..ee0463a4 100644 --- a/NG-RO/osm_ng_ro/ns.py +++ b/NG-RO/osm_ng_ro/ns.py @@ -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() @@ -868,6 +877,15 @@ class Ns(object): if ssh_keys: cloud_config["key-pairs"] = ssh_keys + disk_list = None + if target_vdu.get("virtual-storages"): + disk_list = [ + {"size": disk["size-of-storage"]} + for disk in target_vdu["virtual-storages"] + if disk.get("type-of-storage") + == "persistent-storage:persistent-storage" + ] + extra_dict["params"] = { "name": "{}-{}-{}-{}".format( indata["name"][:16], @@ -881,7 +899,7 @@ class Ns(object): "flavor_id": "TASK-" + flavor_text, "net_list": net_list, "cloud_config": cloud_config or None, - "disk_list": None, # TODO + "disk_list": disk_list, "availability_zone_index": None, # TODO "availability_zone_list": None, # TODO }