From 60a959810864b38012e31a9ba85ced721318fbc0 Mon Sep 17 00:00:00 2001 From: "ying.yunlong" Date: Sat, 26 Aug 2017 10:59:37 +0800 Subject: [PATCH] implement vnf instance relationship implement put and delete vnf instance relationship function. Change-Id: I11419e0825c06e9b09505afd91b82d599249dcd3 Issue-ID: VFC-169 Signed-off-by: ying.yunlong --- lcm/lcm/pub/aaiapi/aai.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lcm/lcm/pub/aaiapi/aai.py b/lcm/lcm/pub/aaiapi/aai.py index b952be5f..bd51f63b 100644 --- a/lcm/lcm/pub/aaiapi/aai.py +++ b/lcm/lcm/pub/aaiapi/aai.py @@ -126,3 +126,19 @@ 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 NFLCMException("Delete vserver relationship exception in AAI") return json.JSONDecoder().decode(ret[1]) + +def put_vnf_relationship(vnf_id, data): + resource = "/network/generic-vnfs/generic-vnf/%s/relationship-list/relationship" % vnf_id + ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "PUT", data) + if ret[0] != 0: + logger.error("Status code is %s, detail is %s.", ret[2], ret[1]) + raise NFLCMException("Put or update vnf instance relationship exception in AAI") + return json.JSONDecoder().decode(ret[1]) + +def delete_vnf_relationship(vnf_id, data): + resource = "/network/generic-vnfs/generic-vnf/%s/relationship-list/relationship" % vnf_id + ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "DELETE", data) + if ret[0] != 0: + logger.error("Status code is %s, detail is %s.", ret[2], ret[1]) + raise NFLCMException("Delete vnf instance relationship exception in AAI") + return json.JSONDecoder().decode(ret[1]) -- 2.16.6