From: ying.yunlong Date: Fri, 1 Sep 2017 00:57:57 +0000 (+0800) Subject: Add lcm vnf instance operate X-Git-Tag: v1.0.0~116 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=03581ddc1319db02eea0536f68a917b9957d23fb;p=vfc%2Fnfvo%2Flcm.git 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 --- 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])