aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-10-11 09:20:46 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-10-11 09:20:46 +0800
commitf0d540a5d4edaaacd56376c79e02bbbd9485aa56 (patch)
tree3ed15d77fc899522deda9f5c86c1281552f77129
parent14349787812c074d1732eafd4e3c022a5b30cb50 (diff)
Create/delete subnet relationship
Create/delete subnetwork relationship to aai in vfc-nfvo-lcm Change-Id: I90ce3ad4981cc6861f5388bbbe9f247e7ea33dc4 Issue-ID: VFC-517 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/pub/msapi/aai.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/lcm/pub/msapi/aai.py b/lcm/pub/msapi/aai.py
index 5ceb4159..ea37fab5 100644
--- a/lcm/pub/msapi/aai.py
+++ b/lcm/pub/msapi/aai.py
@@ -322,3 +322,23 @@ def delete_subnet_aai(network_id, subnet_id, resource_version=""):
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NSLCMException("Subnetwork delete exception in AAI")
return json.JSONDecoder().decode(ret[1]), ret[2]
+
+
+def put_subnet_relationship(network_id, subnet_id, data):
+ resource = "/network/l3-networks/l3-network/%s/subnets/subnet/%s/relationship-list/relationship"\
+ % (network_id, subnet_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 subnetwork relationship exception in AAI")
+ return json.JSONDecoder().decode(ret[1]), ret[2]
+
+
+def delete_subnet_relationship(network_id, subnet_id):
+ resource = "/network/l3-networks/l3-network/%s/subnets/subnet/%s/relationship-list/relationship"\
+ % (network_id, subnet_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 subnetwork relationship exception in AAI")
+ return json.JSONDecoder().decode(ret[1]), ret[2]