X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=lcm%2Flcm%2Fpub%2Fvimapi%2Fadaptor.py;h=6cda0af0fb077aeddca5e84d46fb9e8e53b1f95c;hb=8ccc938635ceb5079c63a5cb20cf804a9954a8b4;hp=bce3138491ce6a88a89ce53154829833bd920e95;hpb=c23b4b6131096628c13469d4dc204beb4c05eb55;p=vfc%2Fgvnfm%2Fvnflcm.git diff --git a/lcm/lcm/pub/vimapi/adaptor.py b/lcm/lcm/pub/vimapi/adaptor.py index bce31384..6cda0af0 100644 --- a/lcm/lcm/pub/vimapi/adaptor.py +++ b/lcm/lcm/pub/vimapi/adaptor.py @@ -265,13 +265,17 @@ def create_port(vim_cache, res_cache, data, port, do_notify, res_type): set_opt_val(param, "subnetId", subnet_id) set_opt_val(param, "macAddress", ignore_case_get(port["properties"], "mac_address")) ip_address = [] + logger.debug("port['properties']:%s" % port["properties"]) for one_protocol_data in port["properties"]["protocol_data"]: l3_address_data = one_protocol_data["address_data"]["l3_address_data"] # l3 is not 13 fixed_ip_address = ignore_case_get(l3_address_data, "fixed_ip_address") ip_address.extend(fixed_ip_address) for one_virtual_network_interface in port["properties"].get("virtual_network_interface_requirements", []): - interfaceTypeString = one_virtual_network_interface["network_interface_requirements"]["interfaceType"] - interfaceType = json.loads(interfaceTypeString)["configurationValue"] + network_interface_requirements = one_virtual_network_interface["network_interface_requirements"] + interfaceTypeString = ignore_case_get(network_interface_requirements, "interfaceType") + interfaceType = "" + if interfaceTypeString != "": + interfaceType = json.loads(interfaceTypeString)["configurationValue"] vnic_type = ignore_case_get(port["properties"], "vnic_type") if vnic_type == "": if interfaceType == "SR-IOV": @@ -403,6 +407,8 @@ def create_vm(vim_cache, res_cache, data, vm, do_notify, res_type): ret = api.create_vm(vim_id, tenant_id, param) ret["ports"] = [nic.get("portId") for nic in param["nicArray"]] + ret["vimId"] = vim_id + ret["tenantId"] = tenant_id do_notify(res_type, ret) vm_id = ret["id"] if ignore_case_get(ret, "name"): @@ -525,7 +531,7 @@ def create_port_of_vm(vim_cache, res_cache, data, port, do_notify, res_type): } ret = api.create_vm_port(vim_id, tenant_id, vm_id, param) ret["nodeId"] = port["cp_id"] - do_notify(res_type, ret) + do_notify("create", res_type, ret) def delete_port_of_vm(vim_cache, res_cache, data, port, do_notify, res_type):