aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-10-10 14:19:03 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-10-10 14:19:03 +0800
commitb6391122760a19419f421de132cf4217bf932c59 (patch)
tree74266ead94a2bbc199da0dd21fc7ff58c25d92a9
parent7987ff69ffd6db7f609715ccecee20bdb7868f36 (diff)
Add vfc-lcm operate network from AAI
Change-Id: I3855ec241d3b14561450dcf274e1274bf9e4e25b Issue-ID: VFC-503 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/pub/msapi/aai.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/lcm/pub/msapi/aai.py b/lcm/pub/msapi/aai.py
index bc3313c2..2548ac39 100644
--- a/lcm/pub/msapi/aai.py
+++ b/lcm/pub/msapi/aai.py
@@ -246,3 +246,32 @@ def delete_vserver_relationship(cloud_owner, cloud_region_id, tenant_id, vserver
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NSLCMException("Delete vserver relationship exception in AAI")
return json.JSONDecoder().decode(ret[1]), ret[2]
+
+
+def create_network_aai(network_id, data):
+ resource = "/network/l3-networks/l3-network/%s" % network_id
+ ret = call_aai(resource, "PUT", data)
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise NSLCMException("Network creation exception in AAI")
+ return json.JSONDecoder().decode(ret[1]), ret[2]
+
+
+def query_network_aai(network_id):
+ resource = "/network/l3-networks/l3-network/%s" % network_id
+ ret = call_aai(resource, "GET")
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise NSLCMException("Network query exception in AAI")
+ return json.JSONDecoder().decode(ret[1])
+
+
+def delete_network_aai(network_id, resource_version=""):
+ resource = "/network/l3-networks/l3-network/%s" % network_id
+ if resource_version:
+ resource = resource + "?resource-version=%s" % resource_version
+ ret = call_aai(resource, "DELETE")
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise NSLCMException("Network delete exception in AAI")
+ return json.JSONDecoder().decode(ret[1]), ret[2]