X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=NG-RO%2Fosm_ng_ro%2Fns.py;h=f943c2a84e07d00914a582c1900e3129566e6d87;hb=61f8b374efa1ede20d00b29b44e95d88b4a699ce;hp=e62eef59207fa72ef9b26f47768e12313447c432;hpb=38d1217c445a5fd45aacae22541903439992e0ac;p=osm%2FRO.git diff --git a/NG-RO/osm_ng_ro/ns.py b/NG-RO/osm_ng_ro/ns.py index e62eef59..f943c2a8 100644 --- a/NG-RO/osm_ng_ro/ns.py +++ b/NG-RO/osm_ng_ro/ns.py @@ -539,6 +539,8 @@ class Ns(object): return quota + nonlocal indata + flavor_data = { "disk": int(target_flavor["storage-gb"]), "ram": int(target_flavor["memory-mb"]), @@ -547,6 +549,26 @@ class Ns(object): numa = {} extended = {} + target_vdur = None + for vnf in indata.get("vnf", []): + for vdur in vnf.get("vdur", []): + if vdur.get("ns-flavor-id") == target_flavor["id"]: + target_vdur = vdur + + for storage in target_vdur.get("virtual-storages", []): + if ( + storage.get("type-of-storage") + == "etsi-nfv-descriptors:ephemeral-storage" + ): + flavor_data["ephemeral"] = int( + storage.get("size-of-storage", 0) + ) + elif ( + storage.get("type-of-storage") + == "etsi-nfv-descriptors:swap-storage" + ): + flavor_data["swap"] = int(storage.get("size-of-storage", 0)) + if target_flavor.get("guest-epa"): extended = {} epa_vcpu_set = False @@ -687,9 +709,7 @@ class Ns(object): "dhcp_start_address": ip_profile.get("dhcp-params", {}).get( "start-address", None ), - "dhcp_count": ip_profile.get("dhcp-params", {}).get( - "count", None - ), + "dhcp_count": ip_profile.get("dhcp-params", {}).get("count", None), } if ip_profile.get("dns-server"): @@ -787,13 +807,13 @@ class Ns(object): extra_dict["depends_on"].append(net_text) if "port-security-enabled" in interface: - interface["port_security"] = ( - interface.pop("port-security-enabled") + 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") + interface["port_security_disable_strategy"] = interface.pop( + "port-security-disable-strategy" ) net_item = { @@ -879,6 +899,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], @@ -892,7 +921,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 }