summaryrefslogtreecommitdiffstats
path: root/share/newton_base/openoapi/network.py
diff options
context:
space:
mode:
Diffstat (limited to 'share/newton_base/openoapi/network.py')
-rw-r--r--share/newton_base/openoapi/network.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/share/newton_base/openoapi/network.py b/share/newton_base/openoapi/network.py
index 9ad7a83f..9475ee2c 100644
--- a/share/newton_base/openoapi/network.py
+++ b/share/newton_base/openoapi/network.py
@@ -73,6 +73,11 @@ class Networks(APIView):
vim = VimDriverUtils.get_vim_info(vimid)
sess = VimDriverUtils.get_session(vim, tenantid)
+
+ self.service['region_id'] = vim['openstack_region_id'] \
+ if vim.get('openstack_region_id') \
+ else vim['cloud_region_id']
+
logger.info("making request with URI:%s" % req_resouce)
resp = sess.get(req_resouce, endpoint_filter=self.service)
logger.info("request returns with status %s" % resp.status_code)
@@ -135,6 +140,10 @@ class Networks(APIView):
self.keys_mapping, True)
req_body = json.JSONEncoder().encode({"network": network})
+ self.service['region_id'] = vim['openstack_region_id'] \
+ if vim.get('openstack_region_id') \
+ else vim['cloud_region_id']
+
logger.info("making request with URI:%s" % req_resouce)
logger.debug("with data:%s" % req_body)
resp = sess.post(req_resouce, data=req_body,
@@ -178,6 +187,10 @@ class Networks(APIView):
vim = VimDriverUtils.get_vim_info(vimid)
sess = VimDriverUtils.get_session(vim, tenantid)
+ self.service['region_id'] = vim['openstack_region_id'] \
+ if vim.get('openstack_region_id') \
+ else vim['cloud_region_id']
+
logger.info("making delete request with URI:%s" % req_resouce)
resp = sess.delete(req_resouce, endpoint_filter=self.service)
logger.info("request returns with status %s" % resp.status_code)