From 3340d1d7039d56457cca112c93351ad326ea22cd Mon Sep 17 00:00:00 2001 From: "ying.yunlong" Date: Tue, 11 Apr 2017 19:27:39 +0800 Subject: Fixed some gvnfm vnflcm adapter bugs Change-Id: I4a306a2328a2b53927ea4dd8d9cdc3e78d14392a Issue-Id: GVNFM-49 Signed-off-by: ying.yunlong --- lcm/lcm/nf/vnfs/const.py | 2 +- lcm/lcm/pub/vimapi/adaptor.py | 6 +++--- lcm/lcm/pub/vimapi/api.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lcm') diff --git a/lcm/lcm/nf/vnfs/const.py b/lcm/lcm/nf/vnfs/const.py index 122eeeb5..3967eaeb 100644 --- a/lcm/lcm/nf/vnfs/const.py +++ b/lcm/lcm/nf/vnfs/const.py @@ -774,7 +774,7 @@ c7_data_create_flavor ={ c8_data_list_image = { "vimid": "", "vimname": "", - "imageList": [ + "images": [ { "status": "active", "id": "5e2757c1-f846-4727-915c-9a872553ed75", diff --git a/lcm/lcm/pub/vimapi/adaptor.py b/lcm/lcm/pub/vimapi/adaptor.py index e866e692..9cbc7b16 100644 --- a/lcm/lcm/pub/vimapi/adaptor.py +++ b/lcm/lcm/pub/vimapi/adaptor.py @@ -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 diff --git a/lcm/lcm/pub/vimapi/api.py b/lcm/lcm/pub/vimapi/api.py index 64f40cac..0ab13354 100644 --- a/lcm/lcm/pub/vimapi/api.py +++ b/lcm/lcm/pub/vimapi/api.py @@ -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 "", -- cgit 1.2.3-korg