implement ns instance relationship 17/9017/1
authorying.yunlong <ying.yunlong@zte.com.cn>
Tue, 29 Aug 2017 03:17:36 +0000 (11:17 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Tue, 29 Aug 2017 03:17:36 +0000 (11:17 +0800)
implement put and delete ns
instance relationship function.

Change-Id: I1ce6d38ea3219acb316413adc78f98b2efd418ad
Issue-ID: VFC-170
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
lcm/lcm/pub/aaiapi/aai.py

index bd51f63..36ed2bf 100644 (file)
@@ -142,3 +142,23 @@ def delete_vnf_relationship(vnf_id, data):
         logger.error("Status code is %s, detail is %s.", ret[2], ret[1])\r
         raise NFLCMException("Delete vnf instance relationship exception in AAI")\r
     return json.JSONDecoder().decode(ret[1])\r
+\r
+def put_ns_relationship(global_customer_id, service_type, service_instance_id, data):\r
+    resource = "/business/customers/customer/%s/service-subscriptions/service-subscription/" \\r
+               "%s/service-instances/service-instance/%s/relationship-list/relationship" % \\r
+               (global_customer_id, service_type, service_instance_id)\r
+    ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "PUT", data)\r
+    if ret[0] != 0:\r
+        logger.error("Status code is %s, detail is %s.", ret[2], ret[1])\r
+        raise NFLCMException("Put or update ns instance relationship exception in AAI")\r
+    return json.JSONDecoder().decode(ret[1])\r
+\r
+def delete_ns_relationship(global_customer_id, service_type, service_instance_id, data):\r
+    resource = "/business/customers/customer/%s/service-subscriptions/service-subscription/" \\r
+               "%s/service-instances/service-instance/%s/relationship-list/relationship" % \\r
+               (global_customer_id, service_type, service_instance_id)\r
+    ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "DELETE", data)\r
+    if ret[0] != 0:\r
+        logger.error("Status code is %s, detail is %s.", ret[2], ret[1])\r
+        raise NFLCMException("Delete ns instance relationship exception in AAI")\r
+    return json.JSONDecoder().decode(ret[1])
\ No newline at end of file