Create/delete network relationship 31/17831/1
authorying.yunlong <ying.yunlong@zte.com.cn>
Tue, 10 Oct 2017 06:29:36 +0000 (14:29 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Tue, 10 Oct 2017 06:29:36 +0000 (14:29 +0800)
Create/delete network relationship to aai in vfc-nfvo-lcm

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

index 2548ac3..ec0bee9 100644 (file)
@@ -275,3 +275,21 @@ def delete_network_aai(network_id, resource_version=""):
         logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
         raise NSLCMException("Network delete exception in AAI")
     return json.JSONDecoder().decode(ret[1]), ret[2]
+
+
+def put_network_relationship(network_id, data):
+    resource = "/network/l3-networks/l3-network/%s/relationship-list/relationship" % network_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("Put or update network relationship exception in AAI")
+    return json.JSONDecoder().decode(ret[1]), ret[2]
+
+
+def delete_network_relationship(network_id):
+    resource = "/network/l3-networks/l3-network/%s/relationship-list/relationship" % network_id
+    ret = call_aai(resource, "DELETE")
+    if ret[0] != 0:
+        logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+        raise NSLCMException("Delete network relationship exception in AAI")
+    return json.JSONDecoder().decode(ret[1]), ret[2]