diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2017-02-11 15:48:23 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2017-02-11 15:48:23 +0800 |
commit | 862b71cc27e1a348ec770fa68118bf940a51c266 (patch) | |
tree | 05b41f933d34b8d45a2b54af46460d93c9d5a60e | |
parent | 8ac177318bab17f91ea10c1aef0be38cd8239e8e (diff) |
Add vm call of vimdriver
Change-Id: Idc8d183688742732ba635ab49d784d023c81932d
Issue-Id: GVNFM-30
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | lcm/lcm/pub/vimapi/api.py | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/lcm/lcm/pub/vimapi/api.py b/lcm/lcm/pub/vimapi/api.py index 1cdb0273..00a8735e 100644 --- a/lcm/lcm/pub/vimapi/api.py +++ b/lcm/lcm/pub/vimapi/api.py @@ -24,6 +24,8 @@ def call(vim_id, res, method, data=''): raise VimException(ret[1], ret[2]) return json.JSONDecoder().decode(ret[1]) if ret[1] else {} +###################################################################### + def create_image(vim_id, data): return call(vim_id, "images", "POST", data) @@ -36,6 +38,8 @@ def get_image(vim_id, image_id): def list_image(vim_id): return call(vim_id, "images", "GET") +###################################################################### + def create_network(vim_id, data): return call(vim_id, "networks", "POST", data) @@ -47,7 +51,9 @@ def get_network(vim_id, network_id): def list_network(vim_id): return call(vim_id, "networks", "GET") - + +###################################################################### + def create_subnet(vim_id, data): return call(vim_id, "subnets", "POST", data) @@ -60,6 +66,8 @@ def get_subnet(vim_id, subnet_id): def list_subnet(vim_id): return call(vim_id, "subnets", "GET") +###################################################################### + def create_port(vim_id, data): return call(vim_id, "ports", "POST", data) @@ -71,7 +79,9 @@ def get_port(vim_id, port_id): def list_port(vim_id): return call(vim_id, "ports", "GET") - + +###################################################################### + def create_flavor(vim_id, data): return call(vim_id, "flavors", "POST", data) @@ -83,3 +93,31 @@ def get_flavor(vim_id, flavor_id): def list_flavor(vim_id): return call(vim_id, "flavors", "GET") + +###################################################################### + +def create_vm(vim_id, data): + return call(vim_id, "vms", "POST", data) + +def delete_vm(vim_id, vm_id): + return call(vim_id, "vms/%s" % vm_id, "DELETE") + +def get_vm(vim_id, vm_id): + return call(vim_id, "vms/%s" % vm_id, "GET") + +def list_vm(vim_id): + return call(vim_id, "vms", "GET") + +###################################################################### + +def create_volume(vim_id, data): + return call(vim_id, "volumes", "POST", data) + +def delete_volume(vim_id, volume_id): + return call(vim_id, "volumes/%s" % volume_id, "DELETE") + +def get_volume(vim_id, volume_id): + return call(vim_id, "volumes/%s" % volume_id, "GET") + +def list_volume(vim_id): + return call(vim_id, "volumes", "GET") |