X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=models%2Fopenmano%2Fpython%2Frift%2Fopenmano%2Frift2openmano.py;fp=models%2Fopenmano%2Fpython%2Frift%2Fopenmano%2Frift2openmano.py;h=2772f8f94cedef1d2c6416695b5dddeaf55ddcd3;hb=4a34ba7b0bac3f07a75344cb4ad195c1aeeb6a3b;hp=e8ad3e53781762bc2a6d1063b48b19e3552a2985;hpb=cd1d2c40ce5a3c6a44cd107c0cba4665a9a647b8;p=osm%2FSO.git diff --git a/models/openmano/python/rift/openmano/rift2openmano.py b/models/openmano/python/rift/openmano/rift2openmano.py index e8ad3e53..2772f8f9 100755 --- a/models/openmano/python/rift/openmano/rift2openmano.py +++ b/models/openmano/python/rift/openmano/rift2openmano.py @@ -415,13 +415,12 @@ def rift2openmano_vnfd(rift_vnfd): vnfc = { "name": vdu.name, "description": vdu.name, - "numas": [{ - "memory": max(int(vdu.vm_flavor.memory_mb/1024), 1), - "interfaces":[], - }], "bridge-ifaces": [], } + if vdu.vm_flavor.has_field("storage_gb") and vdu.vm_flavor.storage_gb: + vnfc["disk"] = vdu.vm_flavor.storage_gb + if os.path.isabs(vdu.image): vnfc["VNFC image"] = vdu.image else: @@ -429,23 +428,36 @@ def rift2openmano_vnfd(rift_vnfd): if vdu.has_field("image_checksum"): vnfc["image checksum"] = vdu.image_checksum - numa_node_policy = vdu.guest_epa.numa_node_policy - if numa_node_policy.has_field("node"): - numa_node = numa_node_policy.node[0] + if vdu.guest_epa.has_field("numa_node_policy"): + vnfc["numas"] = [{ + "memory": max(int(vdu.vm_flavor.memory_mb/1024), 1), + "interfaces":[], + }] + numa_node_policy = vdu.guest_epa.numa_node_policy + if numa_node_policy.has_field("node"): + numa_node = numa_node_policy.node[0] + + if numa_node.has_field("paired_threads"): + if numa_node.paired_threads.has_field("num_paired_threads"): + vnfc["numas"][0]["paired-threads"] = numa_node.paired_threads.num_paired_threads + if len(numa_node.paired_threads.paired_thread_ids) > 0: + vnfc["numas"][0]["paired-threads-id"] = [] + for pair in numa_node.paired_threads.paired_thread_ids: + vnfc["numas"][0]["paired-threads-id"].append( + [pair.thread_a, pair.thread_b] + ) - if numa_node.has_field("paired_threads"): - if numa_node.paired_threads.has_field("num_paired_threads"): - vnfc["numas"][0]["paired-threads"] = numa_node.paired_threads.num_paired_threads - if len(numa_node.paired_threads.paired_thread_ids) > 0: - vnfc["numas"][0]["paired-threads-id"] = [] - for pair in numa_node.paired_threads.paired_thread_ids: - vnfc["numas"][0]["paired-threads-id"].append( - [pair.thread_a, pair.thread_b] - ) + else: + if vdu.vm_flavor.has_field("vcpu_count"): + vnfc["numas"][0]["cores"] = max(vdu.vm_flavor.vcpu_count, 1) else: - if vdu.vm_flavor.has_field("vcpu_count"): - vnfc["numas"][0]["cores"] = max(vdu.vm_flavor.vcpu_count, 1) + if vdu.vm_flavor.has_field("vcpu_count") and vdu.vm_flavor.vcpu_count: + vnfc["vcpus"] = vdu.vm_flavor.vcpu_count + + if vdu.vm_flavor.has_field("memory_mb") and vdu.vm_flavor.memory_mb: + vnfc["ram"] = vdu.vm_flavor.memory_mb + if vdu.has_field("hypervisor_epa"): vnfc["hypervisor"] = {} @@ -466,9 +478,6 @@ def rift2openmano_vnfd(rift_vnfd): vnfc["processor"]["features"].append(feature) - if vdu.vm_flavor.has_field("storage_gb"): - vnfc["disk"] = vdu.vm_flavor.storage_gb - vnf["VNFC"].append(vnfc) for int_if in list(vdu.internal_interface) + list(vdu.external_interface):