summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxinhuili <lxinhui@vmware.com>2018-09-05 03:14:16 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-05 03:14:16 +0000
commit62544851ea884627ee87885998cfbf9f716fce5d (patch)
treefcee6ea2906d7e3123b05183a71a1c21eb3a443f
parentc4c3bd731847c2ba4cfc2fa79f008cb2af64c7a7 (diff)
parent8d92a8c2eb2351a0c9c6a0fa2de4a0a61625541d (diff)
Merge "Include cloud_owner/region in V1 responses"
-rw-r--r--vio/vio/pub/msapi/extsys.py2
-rw-r--r--vio/vio/pub/vim/vimapi/network/OperateNetwork.py18
-rw-r--r--vio/vio/pub/vim/vimapi/network/OperatePort.py18
-rw-r--r--vio/vio/pub/vim/vimapi/network/OperateSubnet.py12
-rw-r--r--vio/vio/swagger/image_utils.py2
-rw-r--r--vio/vio/swagger/views/server/views.py12
-rw-r--r--vio/vio/swagger/views/service/views.py4
-rw-r--r--vio/vio/swagger/views/tenant/views.py2
-rw-r--r--vio/vio/swagger/volume_utils.py2
9 files changed, 59 insertions, 13 deletions
diff --git a/vio/vio/pub/msapi/extsys.py b/vio/vio/pub/msapi/extsys.py
index 05213f4..9b45f2b 100644
--- a/vio/vio/pub/msapi/extsys.py
+++ b/vio/vio/pub/msapi/extsys.py
@@ -31,6 +31,8 @@ def get_vim_by_id(vim_id):
ret['type'] = ret['cloud-type']
ret['version'] = ret['cloud-region-version']
ret['vimId'] = vim_id
+ ret['cloud_owner'] = cloud_owner
+ ret['cloud_region_id'] = cloud_region
ret['name'] = vim_id
ret['userName'] = ret['esr-system-info-list'][
'esr-system-info'][0]['user-name']
diff --git a/vio/vio/pub/vim/vimapi/network/OperateNetwork.py b/vio/vio/pub/vim/vimapi/network/OperateNetwork.py
index f20e377..91d333f 100644
--- a/vio/vio/pub/vim/vimapi/network/OperateNetwork.py
+++ b/vio/vio/pub/vim/vimapi/network/OperateNetwork.py
@@ -90,7 +90,11 @@ class OperateNetwork(BaseNet):
network = self.auth(vim_info, tenantid)
body = translate(self.keys_mapping, body)
net = network.network_create(**body)
- vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId']}
+ vim_dict = {
+ "vimName": vim_info['name'],
+ "vimId": vim_info['vimId'],
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
resp = self._convert(net)
resp.update(vim_dict)
return resp
@@ -101,7 +105,11 @@ class OperateNetwork(BaseNet):
net = network.network_get(networkid)
if net is None:
return net
- vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId']}
+ vim_dict = {
+ "vimName": vim_info['name'],
+ "vimId": vim_info['vimId'],
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
resp = self._convert(net)
resp.update(vim_dict)
return resp
@@ -115,7 +123,11 @@ class OperateNetwork(BaseNet):
vim_info = self.get_vim_info(vimid)
network = self.auth(vim_info, tenantid)
resp = network.networks_get(**query)
- vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId']}
+ vim_dict = {
+ "vimName": vim_info['name'],
+ "vimId": vim_info['vimId'],
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
networks = {'networks': []}
if resp:
for net in resp:
diff --git a/vio/vio/pub/vim/vimapi/network/OperatePort.py b/vio/vio/pub/vim/vimapi/network/OperatePort.py
index b9abb60..fdf9576 100644
--- a/vio/vio/pub/vim/vimapi/network/OperatePort.py
+++ b/vio/vio/pub/vim/vimapi/network/OperatePort.py
@@ -68,7 +68,11 @@ class OperatePort(BaseNet):
else:
body['fixed_ips'] = [{'subnet_id': body.pop('subnetId')}]
port = network.port_create(**body)
- vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId']}
+ vim_dict = {
+ "vimName": vim_info['name'],
+ "vimId": vim_info['vimId'],
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
resp = self._convert(port)
resp.update(vim_dict)
return resp
@@ -79,7 +83,11 @@ class OperatePort(BaseNet):
port = network.port_find(portid, ignore_missing=ignore_missing)
if port is None:
return port
- vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId']}
+ vim_dict = {
+ "vimName": vim_info['name'],
+ "vimId": vim_info['vimId'],
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
resp = self._convert(port)
resp.update(vim_dict)
return resp
@@ -94,7 +102,11 @@ class OperatePort(BaseNet):
network = self.auth(vim_info, tenantid)
query.update({"project_id": tenantid})
resp = network.ports_get(**query)
- vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId']}
+ vim_dict = {
+ "vimName": vim_info['name'],
+ "vimId": vim_info['vimId'],
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
ports = {'ports': []}
if resp:
for port in resp:
diff --git a/vio/vio/pub/vim/vimapi/network/OperateSubnet.py b/vio/vio/pub/vim/vimapi/network/OperateSubnet.py
index 1076f40..bd67578 100644
--- a/vio/vio/pub/vim/vimapi/network/OperateSubnet.py
+++ b/vio/vio/pub/vim/vimapi/network/OperateSubnet.py
@@ -56,7 +56,9 @@ class OperateSubnet(BaseNet):
subnet = network.subnet_create(**body)
vim_dict = {
"vimName": vim_info['name'], "vimId": vim_info['vimId'],
- "tenantId": tenantid}
+ "tenantId": tenantid,
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
resp = self._convert(subnet)
resp.update(vim_dict)
return resp
@@ -69,7 +71,9 @@ class OperateSubnet(BaseNet):
return subnet
vim_dict = {
"vimName": vim_info['name'], "vimId": vim_info['vimId'],
- "tenantId": tenantid}
+ "tenantId": tenantid,
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
resp = self._convert(subnet)
resp.update(vim_dict)
return resp
@@ -86,7 +90,9 @@ class OperateSubnet(BaseNet):
resp = network.subnets_get(**query)
vim_dict = {
"vimName": vim_info['name'], "vimId": vim_info['vimId'],
- "tenantId": tenantid}
+ "tenantId": tenantid,
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
subnets = {'subnets': []}
if resp:
for subnet in resp:
diff --git a/vio/vio/swagger/image_utils.py b/vio/vio/swagger/image_utils.py
index 9370508..02acc8e 100644
--- a/vio/vio/swagger/image_utils.py
+++ b/vio/vio/swagger/image_utils.py
@@ -36,6 +36,8 @@ def vim_formatter(vim_info, tenantid):
rsp = {}
rsp['vimId'] = vim_info.get('vimId')
+ rsp['cloud_owner'] = vim_info.get('cloud_owner')
+ rsp['cloud_region_id'] = vim_info.get('cloud_region_id')
rsp['vimName'] = vim_info.get('name')
rsp['tenantId'] = tenantid
return rsp
diff --git a/vio/vio/swagger/views/server/views.py b/vio/vio/swagger/views/server/views.py
index be720c8..eb8acf0 100644
--- a/vio/vio/swagger/views/server/views.py
+++ b/vio/vio/swagger/views/server/views.py
@@ -45,7 +45,9 @@ class ListServersView(APIView):
'url': vim_info['url']}
rsp = {'vimId': vim_info['vimId'],
'vimName': vim_info['name'],
- 'tenantId': tenantid}
+ 'tenantId': tenantid,
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
servers_op = OperateServers.OperateServers()
server_name = create_req.get('name', None)
server_id = create_req.get('id', None)
@@ -104,7 +106,9 @@ class ListServersView(APIView):
rsp = {'vimId': vim_info['vimId'],
'vimName': vim_info['name'],
- 'servers': servers_resp}
+ 'servers': servers_resp,
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
return Response(data=rsp, status=status.HTTP_200_OK)
@@ -147,7 +151,9 @@ class GetServerView(APIView):
rsp = {'vimId': vim_info['vimId'],
'vimName': vim_info['name'],
- 'tenantId': tenantid}
+ 'tenantId': tenantid,
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
rsp.update(server_dict)
return Response(data=rsp, status=status.HTTP_200_OK)
diff --git a/vio/vio/swagger/views/service/views.py b/vio/vio/swagger/views/service/views.py
index 239e795..fe081fb 100644
--- a/vio/vio/swagger/views/service/views.py
+++ b/vio/vio/swagger/views/service/views.py
@@ -50,7 +50,9 @@ class HostsView(APIView):
rsp = {'vimid': vim_info['vimId'],
'vimName': vim_info['name'],
'tenantId': tenantid,
- 'hosts': hosts}
+ 'hosts': hosts,
+ 'cloud_owner': vim_info.get('cloud_owner'),
+ 'cloud_region_id': vim_info.get("cloud_region_id")}
return Response(data=rsp, status=status.HTTP_200_OK)
diff --git a/vio/vio/swagger/views/tenant/views.py b/vio/vio/swagger/views/tenant/views.py
index 0ee58df..b48c5f5 100644
--- a/vio/vio/swagger/views/tenant/views.py
+++ b/vio/vio/swagger/views/tenant/views.py
@@ -53,6 +53,8 @@ class ListTenantsView(APIView):
rsp['vimId'] = vim_info['vimId']
rsp['vimName'] = vim_info['name']
rsp['tenants'] = []
+ rsp['cloud_owner'] = vim_info.get('cloud_owner')
+ rsp['cloud_region_id'] = vim_info.get('cloud_region_id')
for project in projects:
tenant = {}
diff --git a/vio/vio/swagger/volume_utils.py b/vio/vio/swagger/volume_utils.py
index 94d8de0..49ebb31 100644
--- a/vio/vio/swagger/volume_utils.py
+++ b/vio/vio/swagger/volume_utils.py
@@ -42,6 +42,8 @@ def vim_formatter(vim_info, tenantid):
rsp['vimId'] = vim_info.get('vimId')
rsp['vimName'] = vim_info.get('name')
rsp['tenantId'] = tenantid
+ rsp['cloud_owner'] = vim_info.get('cloud_owner')
+ rsp['cloud_region_id'] = vim_info.get('cloud_region_id')
return rsp