summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2017-02-11 15:34:35 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2017-02-11 15:34:35 +0800
commit419c996d4e5561de2de6f9b02dcb399865c3fc05 (patch)
tree9ec8a1f4f29c7903fae6c3823e9576081113187e
parent318e0b6a4b3c4ff14d84870ba54b8931fa79b644 (diff)
Add network call of vimdriver
Change-Id: Ibaee58b0b3c7ccda14aaae59ead5e8ae31e52f59 Issue-Id: GVNFM-31 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--lcm/lcm/pub/vimapi/api.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/lcm/lcm/pub/vimapi/api.py b/lcm/lcm/pub/vimapi/api.py
index 2e882dab..a23ee8da 100644
--- a/lcm/lcm/pub/vimapi/api.py
+++ b/lcm/lcm/pub/vimapi/api.py
@@ -23,3 +23,39 @@ def call(vim_id, res, method, data=''):
if ret[0] > 0:
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)
+
+def delete_image(vim_id, image_id):
+ return call(vim_id, "images/%s" % image_id, "DELETE")
+
+def get_image(vim_id, image_id):
+ return call(vim_id, "images/%s" % image_id, "GET")
+
+def list_image(vim_id):
+ return call(vim_id, "images", "GET")
+
+def create_network(vim_id, data):
+ return call(vim_id, "networks", "POST", data)
+
+def delete_network(vim_id, network_id):
+ return call(vim_id, "networks/%s" % network_id, "DELETE")
+
+def get_network(vim_id, network_id):
+ return call(vim_id, "networks/%s" % network_id, "GET")
+
+def list_network(vim_id):
+ return call(vim_id, "networks", "GET")
+
+def create_subnet(vim_id, data):
+ return call(vim_id, "subnets", "POST", data)
+
+def delete_subnet(vim_id, subnet_id):
+ return call(vim_id, "subnets/%s" % subnet_id, "DELETE")
+
+def get_subnet(vim_id, subnet_id):
+ return call(vim_id, "subnets/%s" % subnet_id, "GET")
+
+def list_subnet(vim_id):
+ return call(vim_id, "subnets", "GET")