Fixed some gvnfm vnflcm adapter bugs
authorying.yunlong <ying.yunlong@zte.com.cn>
Tue, 11 Apr 2017 11:27:39 +0000 (19:27 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Tue, 11 Apr 2017 11:27:39 +0000 (19:27 +0800)
Change-Id: I4a306a2328a2b53927ea4dd8d9cdc3e78d14392a
Issue-Id: GVNFM-49
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
lcm/lcm/nf/vnfs/const.py
lcm/lcm/pub/vimapi/adaptor.py
lcm/lcm/pub/vimapi/api.py

index 122eeeb..3967eae 100644 (file)
@@ -774,7 +774,7 @@ c7_data_create_flavor ={
 c8_data_list_image = {
     "vimid": "",
     "vimname": "",
-    "imageList": [
+    "images": [
         {
             "status": "active",
             "id": "5e2757c1-f846-4727-915c-9a872553ed75",
index e866e69..9cbc7b1 100644 (file)
@@ -183,7 +183,7 @@ def create_port(vim_cache, res_cache, data, port, do_notify, res_type):
     set_opt_val(param, "securityGroups", "") # TODO
     vim_id, tenant_name = location_info["vimid"], location_info["tenant"]
     tenant_id = get_tenant_id(vim_cache, vim_id, tenant_name)
-    ret = api.create_subnet(vim_id, tenant_id, param)
+    ret = api.create_port(vim_id, tenant_id, param)
     ret["nodeId"] = port["cp_id"]
     do_notify(res_type, ret)
     set_res_cache(res_cache, res_type, port["cp_id"], ret["id"])
@@ -202,7 +202,7 @@ def create_flavor(vim_cache, res_cache, data, flavor, do_notify, res_type):
             if local_storage_id != local_storage["local_storage_id"]:
                 continue
             disk_type = local_storage["properties"]["disk_type"]
-            disk_size = int(local_storage["properties"]["size"].replace('GB', '').strip())
+            disk_size = int(local_storage["properties"]["size"].replace('GB', '').strip())*1024
             if disk_type == "root":
                 param["disk"] = disk_size
             elif disk_type == "ephemeral":
@@ -243,7 +243,7 @@ def create_vm(vim_cache, res_cache, data, vm, do_notify, res_type):
         if not img_name:
             raise VimException("Undefined image(%s)" % vm["image_file"], ERR_CODE)
         images = api.list_image(vim_id, tenant_id)
-        for image in images["imageList"]:
+        for image in images["images"]:
             if img_name == image["name"]:
                 param["boot"]["imageId"] = image["id"]
                 break
index 64f40ca..0ab1335 100644 (file)
@@ -22,7 +22,7 @@ VIM_DRIVER_BASE_URL = "openoapi/multivim/v1"
 def call(vim_id, tenant_id, res, method, data=''):
     if data and not isinstance(data, (str, unicode)):
         data = json.JSONEncoder().encode(data)
-    url = "{base_url}/{vim_id}{tenant_id}/{res}".format(
+    url = "{base_url}/{vim_id}/{tenant_id}/{res}".format(
         base_url=VIM_DRIVER_BASE_URL, 
         vim_id=vim_id,
         tenant_id="/" + tenant_id if tenant_id else "",