fix some unit parameter error 03/72203/1
authormaopengzhang <zhang.maopeng1@zte.com.cn>
Thu, 8 Nov 2018 12:33:33 +0000 (20:33 +0800)
committermaopengzhang <zhang.maopeng1@zte.com.cn>
Thu, 8 Nov 2018 12:33:33 +0000 (20:33 +0800)
fix unit string to int error, etc

Change-Id: I3f884a0b63d9f5000db1ecc7e6bd6f7e9c821f31
Issue-ID: VFC-1158
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
lcm/lcm/nf/biz/instantiate_vnf.py
lcm/lcm/pub/vimapi/adaptor.py

index 364eaff..203a12b 100644 (file)
@@ -178,7 +178,7 @@ class InstantiateVnf(Thread):
                              "flavorName": flavor["vimFlavourId"],
                              "vimid": vimid})
 
-        for resource_type in ['vdus', 'vls']:
+        for resource_type in ['vdus', 'vls', 'cps', 'volume_storages']:
             for resource in ignore_case_get(self.vnfd_info, resource_type):
                 if "location_info" in resource["properties"]:
                     resource["properties"]["location_info"]["vimid"] = vimid
index 3427aaf..070eb6b 100644 (file)
@@ -160,11 +160,11 @@ def delete_vim_res(data, do_notify):
 def create_volume(vim_cache, res_cache, vol, do_notify, res_type):
     location_info = vol["properties"]["location_info"]
     param = {
-        "name": vol["properties"]["volume_name"],
-        "volumeSize": int(ignore_case_get(vol["properties"], "size", "0").replace('GB', '').strip())
+        "name": vol["properties"]["volume_name"] if vol["properties"].get("volume_name", None) else vol["volume_storage_id"],
+        "volumeSize": int(ignore_case_get(vol["properties"], "size_of_storage", "0").replace('GB', '').replace('"', '').strip())
     }
     set_opt_val(param, "imageName", ignore_case_get(vol, "image_file"))
-    set_opt_val(param, "volumeType", ignore_case_get(vol["properties"], "custom_volume_type"))
+    set_opt_val(param, "volumeType", ignore_case_get(vol["properties"], "type_of_storage"))
     set_opt_val(param, "availabilityZone", ignore_case_get(location_info, "availability_zone"))
     vim_id, tenant_name = location_info["vimid"], location_info["tenant"]
     tenant_id = get_tenant_id(vim_cache, vim_id, tenant_name)
@@ -190,7 +190,7 @@ def create_network(vim_cache, res_cache, network, do_notify, res_type):
     param = {
         "name": vl_profile["networkName"],
         "shared": False,
-        "networkType": vl_profile["networkType"],
+        "networkType": ignore_case_get(vl_profile, "networkType"),
         "physicalNetwork": ignore_case_get(vl_profile, "physicalNetwork")
     }
     set_opt_val(param, "vlanTransparent", ignore_case_get(vl_profile, "vlanTransparent"))
@@ -259,7 +259,7 @@ def create_port(vim_cache, res_cache, data, port, do_notify, res_type):
         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"]["virtual_network_interface_requirements"]:
+    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)["configuration-value"]
         vnic_type = ignore_case_get(port["properties"], "vnic_type")