implement vnf instance relationship 55/8855/1
authorying.yunlong <ying.yunlong@zte.com.cn>
Sat, 26 Aug 2017 02:59:37 +0000 (10:59 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Sat, 26 Aug 2017 02:59:37 +0000 (10:59 +0800)
implement put and delete vnf
instance relationship function.

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

index b952be5..bd51f63 100644 (file)
@@ -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])\r
         raise NFLCMException("Delete vserver relationship exception in AAI")\r
     return json.JSONDecoder().decode(ret[1])\r
+\r
+def put_vnf_relationship(vnf_id, data):\r
+    resource = "/network/generic-vnfs/generic-vnf/%s/relationship-list/relationship" % vnf_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 vnf instance relationship exception in AAI")\r
+    return json.JSONDecoder().decode(ret[1])\r
+\r
+def delete_vnf_relationship(vnf_id, data):\r
+    resource = "/network/generic-vnfs/generic-vnf/%s/relationship-list/relationship" % vnf_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 vnf instance relationship exception in AAI")\r
+    return json.JSONDecoder().decode(ret[1])\r