X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=models%2Fopenmano%2Fpython%2Frift%2Fopenmano%2Frift2openmano.py;h=c29818f8c62a3007d03a558932f921174b083676;hb=4f049a22f4031d0e02c40eb63e17f263b4702c1a;hp=5652285120760de25a2953ce35fa6782eede2883;hpb=f6914d7d8e3153683139096480a86afec5b07302;p=osm%2FSO.git diff --git a/models/openmano/python/rift/openmano/rift2openmano.py b/models/openmano/python/rift/openmano/rift2openmano.py index 56522851..c29818f8 100755 --- a/models/openmano/python/rift/openmano/rift2openmano.py +++ b/models/openmano/python/rift/openmano/rift2openmano.py @@ -333,7 +333,7 @@ def rift2openmano_nsd(rift_nsd, rift_vnfds,openmano_vnfd_ids): return openmano -def rift2openmano_vnfd(rift_vnfd): +def rift2openmano_vnfd(rift_vnfd, rift_nsd): openmano_vnf = {"vnf":{}} vnf = openmano_vnf["vnf"] @@ -358,7 +358,23 @@ def rift2openmano_vnfd(rift_vnfd): raise ValueError("Internal connection point reference %s not found" % cp_ref_id) - def rift2openmano_if_type(rift_type): + def rift2openmano_if_type(ext_if): + + cp_ref_name = ext_if.vnfd_connection_point_ref + for vld in rift_nsd.vlds: + + # if it is an explicit mgmt_network then check if the given + # cp_ref is a part of it + if not vld.mgmt_network: + continue + + for vld_cp in vld.vnfd_connection_point_ref: + if vld_cp.vnfd_connection_point_ref == cp_ref_name: + return "mgmt" + + + rift_type = ext_if.virtual_interface.type_yang + # Retaining it for backward compatibility! if rift_type == "OM_MGMT": return "mgmt" elif rift_type == "VIRTIO" or rift_type == "E1000": @@ -380,7 +396,7 @@ def rift2openmano_vnfd(rift_vnfd): vdu, ext_if = find_vdu_and_ext_if_by_cp_ref(cp.name) connection = { "name": cp.name, - "type": rift2openmano_if_type(ext_if.virtual_interface.type_yang), + "type": rift2openmano_if_type(ext_if), "VNFC": vdu.name, "local_iface_name": ext_if.name, "description": "%s iface on VDU %s" % (ext_if.name, vdu.name), @@ -427,8 +443,11 @@ def rift2openmano_vnfd(rift_vnfd): vnfc["image name"] = vdu.image if vdu.has_field("image_checksum"): vnfc["image checksum"] = vdu.image_checksum - - if vdu.guest_epa.has_field("numa_node_policy"): + dedicated_int = False + for intf in list(vdu.internal_interface) + list(vdu.external_interface): + if intf.virtual_interface.type_yang in ["SR_IOV", "PCI_PASSTHROUGH"]: + dedicated_int = True + if vdu.guest_epa.has_field("numa_node_policy") or dedicated_int: vnfc["numas"] = [{ "memory": max(int(vdu.vm_flavor.memory_mb/1024), 1), "interfaces":[], @@ -494,9 +513,9 @@ def rift2openmano_vnfd(rift_vnfd): elif int_if.virtual_interface.type_yang in ["OM_MGMT"]: vnfc["bridge-ifaces"].append(intf) - elif int_if.virtual_interface.type_yang == "SR-IOV": + elif int_if.virtual_interface.type_yang == "SR_IOV": intf["bandwidth"] = "10 Gbps" - intf["dedicated"] = "yes:sriov" + intf["dedicated"] = "no" vnfc["numas"][0]["interfaces"].append(intf) elif int_if.virtual_interface.type_yang == "PCI_PASSTHROUGH":