aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-09-01 08:57:57 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-09-01 08:57:57 +0800
commit03581ddc1319db02eea0536f68a917b9957d23fb (patch)
tree1ee40adbd073810f6f7cc764952ecd83dc4debf4
parent417fa7dd1361f6e685499b81740893559f01e590 (diff)
Add lcm vnf instance operate
After operate ns instance,need update ns instance in aai, so add create、delete、query function. Change-Id: I83e9f9ee23342970bc77159f863338c0e19528c0 Issue-ID: VFC-205 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/pub/msapi/aai.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/lcm/pub/msapi/aai.py b/lcm/pub/msapi/aai.py
index 4483836d..4cfc8e66 100644
--- a/lcm/pub/msapi/aai.py
+++ b/lcm/pub/msapi/aai.py
@@ -67,3 +67,26 @@ def query_ns_aai(global_customer_id, service_type, service_instance_id, data):
raise NSLCMException("Ns instance query exception in AAI")
return json.JSONDecoder().decode(ret[1])
+def create_vnf_aai(vnf_id, data):
+ resource = "/network/generic-vnfs/generic-vnf/%s" % vnf_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("Vnf instance creation exception in AAI")
+ return json.JSONDecoder().decode(ret[1])
+
+def delete_vnf_aai(vnf_id, data=''):
+ resource = "/network/generic-vnfs/generic-vnf/%s" % vnf_id
+ ret = call_aai(resource, "DELETE", data)
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise NSLCMException("Vnf instance delete exception in AAI")
+ return json.JSONDecoder().decode(ret[1])
+
+def query_vnf_aai(vnf_id, data):
+ resource = "/network/generic-vnfs/generic-vnf/%s" % vnf_id
+ ret = call_aai(resource, "GET", data)
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise NSLCMException("Vnf instance query exception in AAI")
+ return json.JSONDecoder().decode(ret[1])