X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_ro%2Fnfvo.py;h=d25df13c91b8805d63daa78791108b070f75c281;hb=d6fac4d9af8bf4ede9640676add59a9ed4b53e9e;hp=c956f9585f025b5c00d788d4d04bd69dc4b00cf2;hpb=67881db99f52f308f6fac69195d5477092361622;p=osm%2FRO.git diff --git a/osm_ro/nfvo.py b/osm_ro/nfvo.py index c956f958..d25df13c 100644 --- a/osm_ro/nfvo.py +++ b/osm_ro/nfvo.py @@ -1072,7 +1072,7 @@ def new_vnfd_v3(mydb, tenant_id, vnf_descriptor): if iface.get("virtual-interface").get("type") == "OM-MGMT": db_interface["type"] = "mgmt" - elif iface.get("virtual-interface").get("type") in ("VIRTIO", "E1000"): + elif iface.get("virtual-interface").get("type") in ("VIRTIO", "E1000", "PARAVIRT"): db_interface["type"] = "bridge" db_interface["model"] = get_str(iface.get("virtual-interface"), "type", 12) elif iface.get("virtual-interface").get("type") in ("SR-IOV", "PCI-PASSTHROUGH"): @@ -1600,13 +1600,13 @@ def get_vnf_id(mydb, tenant_id, vnf_id): SELECT=('vms.uuid as uuid', 'vms.osm_id as osm_id', 'vms.name as name', 'vms.description as description', 'boot_data'), WHERE={'vnfs.uuid': vnf_id} ) - if len(content)==0: - raise NfvoException("vnf '{}' not found".format(vnf_id), HTTP_Not_Found) + if len(content)!=0: + #raise NfvoException("vnf '{}' not found".format(vnf_id), HTTP_Not_Found) # change boot_data into boot-data - for vm in content: - if vm.get("boot_data"): - vm["boot-data"] = yaml.safe_load(vm["boot_data"]) - del vm["boot_data"] + for vm in content: + if vm.get("boot_data"): + vm["boot-data"] = yaml.safe_load(vm["boot_data"]) + del vm["boot_data"] data['vnf']['VNFC'] = content #TODO: GET all the information from a VNFC and include it in the output. @@ -3119,6 +3119,8 @@ def create_instance(mydb, tenant_id, instance_dict): if sce_vnf_ifaces.get("sce_net_id") == sce_net["uuid"]: involved_datacenters.append(vnf_datacenter) break + if not involved_datacenters: + involved_datacenters.append(default_datacenter_id) descriptor_net = {} if instance_dict.get("networks") and instance_dict["networks"].get(sce_net["name"]): @@ -3276,7 +3278,7 @@ def create_instance(mydb, tenant_id, instance_dict): "sce_net2instance": sce_net2instance, } # sce_vnf_list = sorted(scenarioDict['vnfs'], key=lambda k: k['name']) - for sce_vnf in scenarioDict['vnfs']: # sce_vnf_list: + for sce_vnf in scenarioDict.get('vnfs'): # sce_vnf_list: instantiate_vnf(mydb, sce_vnf, vnf_params, vnf_params_out, rollbackList) task_index = vnf_params_out["task_index"] uuid_list = vnf_params_out["uuid_list"] @@ -3580,7 +3582,7 @@ def instantiate_vnf(mydb, sce_vnf, params, params_out, rollbackList): if sce_vnf.get('mgmt_access'): ssh_access = sce_vnf['mgmt_access'].get('config-access', {}).get('ssh-access') vnf_availability_zones = [] - for vm in sce_vnf['vms']: + for vm in sce_vnf.get('vms'): vm_av = vm.get('availability_zone') if vm_av and vm_av not in vnf_availability_zones: vnf_availability_zones.append(vm_av) @@ -4019,7 +4021,7 @@ def delete_instance(mydb, tenant_id, instance_id): # 2.2 deleting VMs # vm_fail_list=[] - for sce_vnf in instanceDict['vnfs']: + for sce_vnf in instanceDict.get('vnfs', ()): datacenter_key = (sce_vnf["datacenter_id"], sce_vnf["datacenter_tenant_id"]) vimthread_affected[sce_vnf["datacenter_tenant_id"]] = None if datacenter_key not in myvims: @@ -4072,7 +4074,7 @@ def delete_instance(mydb, tenant_id, instance_id): datacenter_key = (net["datacenter_id"], net["datacenter_tenant_id"]) if datacenter_key not in myvims: try: - _,myvim_thread = get_vim_thread(mydb, tenant_id, sce_vnf["datacenter_id"], sce_vnf["datacenter_tenant_id"]) + _,myvim_thread = get_vim_thread(mydb, tenant_id, net["datacenter_id"], net["datacenter_tenant_id"]) except NfvoException as e: logger.error(str(e)) myvim_thread = None