Modify adapter code to repair bugs
authorying.yunlong <ying.yunlong@zte.com.cn>
Tue, 28 Mar 2017 05:17:45 +0000 (13:17 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Tue, 28 Mar 2017 05:17:45 +0000 (13:17 +0800)
Change-Id: I735f62b66c34d18e207da190e184f78646360061
Issue-Id: GVNFM-44
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
lcm/lcm/nf/vnfs/const.py
lcm/lcm/nf/vnfs/tests/test_vnf_create.py
lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py
lcm/lcm/pub/vimapi/adaptor.py

index 8f421ab..122eeeb 100644 (file)
@@ -428,7 +428,7 @@ vnfd_model_dict = {
             ],
             "nfv_compute": {
                 "num_cpus": 4,
-                "mem_size": "1024MB",
+                "mem_size": "1 GB",
                 "cpu_frequency": "1GHz",
                 "flavor_extra_specs": {
                     "hw: cpu_policy": "shared",
index 47c0372..d7f6964 100644 (file)
@@ -50,8 +50,8 @@ class TestNFInstantiate(TestCase):
     @mock.patch.object(restcall, 'call_req')
     def test_create_vnf_identifier(self, mock_call_req):
         r1_get_csarid_by_vnfdid = [0, json.JSONEncoder().encode([{'package_id': '222',
-                                                                  'csar_id': '2222',
-                                                                  'vnfd_id': '111'}]), '200']
+                                                                  'csarId': '2222',
+                                                                  'vnfdId': '111'}]), '200']
         r2_get_rawdata_from_catalog = [0, json.JSONEncoder().encode(vnfd_rawdata), '200']
         mock_call_req.side_effect = [r1_get_csarid_by_vnfdid, r2_get_rawdata_from_catalog]
         data = {
index 6d5fb00..3a42063 100644 (file)
@@ -48,8 +48,8 @@ class CreateVnf:
         try:
             self.package_info = get_packageinfo_by_vnfdid(self.vnfd_id)
             for val in self.package_info:
-                if self.vnfd_id == ignore_case_get(val, "vnfd_id"):
-                    self.package_id = ignore_case_get(val, "csar_id")
+                if self.vnfd_id == ignore_case_get(val, "vnfdId"):
+                    self.package_id = ignore_case_get(val, "csarId")
                     break
 
             raw_data = query_rawdata_from_catalog(self.package_id, self.data)
index a09943f..e866e69 100644 (file)
@@ -194,7 +194,7 @@ def create_flavor(vim_cache, res_cache, data, flavor, do_notify, res_type):
     param = {
         "name": "Flavor_%s" % flavor["vdu_id"],
         "vcpu": int(flavor["nfv_compute"]["num_cpus"]),
-        "memory": int(flavor["nfv_compute"]["mem_size"].replace('MB', '').strip()),
+        "memory": int(flavor["nfv_compute"]["mem_size"].replace('GB', '').strip()),
         "isPublic": True
     }
     for local_storage_id in ignore_case_get(flavor, "local_storages"):
@@ -265,7 +265,7 @@ def create_vm(vim_cache, res_cache, data, vm, do_notify, res_type):
             "fileName": inject_data["file_name"],
             "fileData": inject_data["file_data"]
         })
-    for vol_data in vm["volume_storages"]:
+    for vol_data in ignore_case_get(vm, "volume_storages"):
         vol_id = vol_data["volume_storage_id"]
         param["volumeArray"].append({
             "volumeId": get_res_id(res_cache, RES_VOLUME, vol_id)