Add network call of vimdriver
authorfujinhua <fu.jinhua@zte.com.cn>
Sat, 11 Feb 2017 07:34:35 +0000 (15:34 +0800)
committerfujinhua <fu.jinhua@zte.com.cn>
Sat, 11 Feb 2017 07:34:35 +0000 (15:34 +0800)
Change-Id: Ibaee58b0b3c7ccda14aaae59ead5e8ae31e52f59
Issue-Id: GVNFM-31
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
lcm/lcm/pub/vimapi/api.py

index 2e882da..a23ee8d 100644 (file)
@@ -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")