summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-08-25 14:45:14 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-08-25 14:45:14 +0800
commit7939b146210811c68b2b2c0d7f4555ee6a382da4 (patch)
tree09797115c6bcb39ad37022f652fbc5db42c4e6b1
parent11866729faf4554f4adce209d6ad037ff3d682f0 (diff)
Add put and delete vserver relationship
In order to create/update/delete vserver relationship to aai, add the related function in vnflcm. Change-Id: I3a6fbfc66708349583cfba658b8a97d81773725e Issue-ID: VFC-167 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/lcm/pub/aaiapi/aai.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/lcm/lcm/pub/aaiapi/aai.py b/lcm/lcm/pub/aaiapi/aai.py
index c42ead1b..b952be5f 100644
--- a/lcm/lcm/pub/aaiapi/aai.py
+++ b/lcm/lcm/pub/aaiapi/aai.py
@@ -106,3 +106,23 @@ def query_vserver(cloud_owner, cloud_region_id, tenant_id, vserver_id, data):
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Vserver query exception in AAI")
return json.JSONDecoder().decode(ret[1])
+
+def put_vserver_relationship(cloud_owner, cloud_region_id, tenant_id, vserver_id, data):
+ resource = "/cloud-infrastructure/cloud-regions/cloud-region/%s/" \
+ "%s/tenants/tenant/%s/vservers/vserver/%s/relationship-list/relationship" % \
+ (cloud_owner, cloud_region_id, tenant_id, vserver_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 vserver relationship exception in AAI")
+ return json.JSONDecoder().decode(ret[1])
+
+def delete_vserver_relationship(cloud_owner, cloud_region_id, tenant_id, vserver_id, data):
+ resource = "/cloud-infrastructure/cloud-regions/cloud-region/%s/" \
+ "%s/tenants/tenant/%s/vservers/vserver/%s/relationship-list/relationship" % \
+ (cloud_owner, cloud_region_id, tenant_id, vserver_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 vserver relationship exception in AAI")
+ return json.JSONDecoder().decode(ret[1])