X-Git-Url: https://gerrit.onap.org/r/gitweb?p=vfc%2Fgvnfm%2Fvnflcm.git;a=blobdiff_plain;f=lcm%2Flcm%2Fpub%2Faaiapi%2Faai.py;h=36ed2bfb5b749f456411b481c1c563cc79d4d655;hp=bd51f63b43e7ebf24a3182cb49e9efba0e63b9a7;hb=3c30a6fe0eb4a4fb10d86b826102779b08a26dc9;hpb=60a959810864b38012e31a9ba85ced721318fbc0 diff --git a/lcm/lcm/pub/aaiapi/aai.py b/lcm/lcm/pub/aaiapi/aai.py index bd51f63b..36ed2bfb 100644 --- a/lcm/lcm/pub/aaiapi/aai.py +++ b/lcm/lcm/pub/aaiapi/aai.py @@ -142,3 +142,23 @@ def delete_vnf_relationship(vnf_id, data): 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]) + +def put_ns_relationship(global_customer_id, service_type, service_instance_id, data): + resource = "/business/customers/customer/%s/service-subscriptions/service-subscription/" \ + "%s/service-instances/service-instance/%s/relationship-list/relationship" % \ + (global_customer_id, service_type, service_instance_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 ns instance relationship exception in AAI") + return json.JSONDecoder().decode(ret[1]) + +def delete_ns_relationship(global_customer_id, service_type, service_instance_id, data): + resource = "/business/customers/customer/%s/service-subscriptions/service-subscription/" \ + "%s/service-instances/service-instance/%s/relationship-list/relationship" % \ + (global_customer_id, service_type, service_instance_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 ns instance relationship exception in AAI") + return json.JSONDecoder().decode(ret[1]) \ No newline at end of file