diff options
author | xinhuili <lxinhui@vmware.com> | 2017-03-14 03:03:39 -0700 |
---|---|---|
committer | xinhuili <lxinhui@vmware.com> | 2017-03-14 03:09:28 -0700 |
commit | ac6ad9ed76acb52fa3358d8e62387d01e6c78d68 (patch) | |
tree | 766ab4eb8bbb915070b7a75351e8f462b53ee284 /vio | |
parent | 0464d7a10815def6daef8b3cb96321eb5a40eb1d (diff) |
Several small fixes
This patch is to merge small fixes.
Change-Id: I6357bb3702e76f765e86aa5be4e256c7a5f1a93a
Issue-ids: MULTIVIM-36
Signed-off-by: xinhuili <lxinhui@vmware.com>
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio/pub/vim/vimapi/network/OperatePort.py | 2 | ||||
-rw-r--r-- | vio/vio/pub/vim/vimapi/network/OperateSubnet.py | 9 | ||||
-rw-r--r-- | vio/vio/swagger/views/flavor/views.py | 15 | ||||
-rw-r--r-- | vio/vio/swagger/views/limits/views.py | 4 | ||||
-rw-r--r-- | vio/vio/swagger/views/tenant/views.py | 4 |
5 files changed, 18 insertions, 16 deletions
diff --git a/vio/vio/pub/vim/vimapi/network/OperatePort.py b/vio/vio/pub/vim/vimapi/network/OperatePort.py index eb48702..4363f51 100644 --- a/vio/vio/pub/vim/vimapi/network/OperatePort.py +++ b/vio/vio/pub/vim/vimapi/network/OperatePort.py @@ -41,7 +41,7 @@ class OperatePort(BaseNet): result['name'] = port.name result['vnicType'] = port.binding_vnic_type result['macAddress'] = port.mac_address - result['subnetId'] = port.subnet_id + result['subnetId'] = port.subnet_id or port.fixed_ips[0]['subnet_id'] result['securityGroups'] = port.security_group_ids return result diff --git a/vio/vio/pub/vim/vimapi/network/OperateSubnet.py b/vio/vio/pub/vim/vimapi/network/OperateSubnet.py index a4b0e9d..b28383d 100644 --- a/vio/vio/pub/vim/vimapi/network/OperateSubnet.py +++ b/vio/vio/pub/vim/vimapi/network/OperateSubnet.py @@ -27,7 +27,8 @@ class OperateSubnet(BaseNet): "gaetwayIp": "gateway_ip", "dnsNameservers": "dns_nameservers", "hostRoutes": "host_routes", - "allocationPools": "allocation_pools" + "allocationPools": "allocation_pools", + "enableDhcp": "is_dhcp_enabled" } def ___init__(self, params): @@ -53,7 +54,7 @@ class OperateSubnet(BaseNet): network = self.auth(vim_info) body = translate(self.keys_mapping, body) subnet = network.subnet_create(**body) - vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId']} + vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId'], "tenantId": tenantid} resp = self._convert(subnet) resp.update(vim_dict) return resp @@ -64,7 +65,7 @@ class OperateSubnet(BaseNet): subnet = network.subnet_get(subnetid) if subnet is None: return subnet - vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId']} + vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId'], "tenantId": tenantid} resp = self._convert(subnet) resp.update(vim_dict) return resp @@ -79,7 +80,7 @@ class OperateSubnet(BaseNet): network = self.auth(vim_info) tenant = {"project_id": tenantid} resp = network.subnets_get(**tenant) - vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId']} + vim_dict = {"vimName": vim_info['name'], "vimId": vim_info['vimId'], "tenantId": tenantid} subnets = {'subnets': []} if resp: for subnet in resp: diff --git a/vio/vio/swagger/views/flavor/views.py b/vio/vio/swagger/views/flavor/views.py index a9ae925..a926e98 100644 --- a/vio/vio/swagger/views/flavor/views.py +++ b/vio/vio/swagger/views/flavor/views.py @@ -30,13 +30,13 @@ class FlavorsView(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) vim_info = extsys.get_vim_by_id(vimid) - data = {'vimid': vim_info['vimId'], + data = {'vimId': vim_info['vimId'], 'vimName': vim_info['name'], 'username': vim_info['userName'], 'password': vim_info['password'], 'url': vim_info['url'], 'project_name': vim_info['tenant']} - rsp = {'vimid': vim_info['vimId'], + rsp = {'vimId': vim_info['vimId'], 'vimName': vim_info['name'], 'tenantId': tenantid} flavor_name = create_req.get('name', None) @@ -62,7 +62,7 @@ class FlavorsView(APIView): def get(self, request, vimid, tenantid): vim_info = extsys.get_vim_by_id(vimid) - data = {'vimid': vim_info['vimId'], + data = {'vimId': vim_info['vimId'], 'vimName': vim_info['name'], 'username': vim_info['userName'], 'password': vim_info['password'], @@ -78,8 +78,9 @@ class FlavorsView(APIView): return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) - rsp = {'vimid': vim_info['vimId'], + rsp = {'vimId': vim_info['vimId'], 'vimName': vim_info['name'], + 'tenantId': tenantid, 'flavors': flavors_dict} return Response(data=rsp, status=status.HTTP_200_OK) @@ -89,7 +90,7 @@ class FlavorView(APIView): def get(self, request, vimid, tenantid, flavorid): vim_info = extsys.get_vim_by_id(vimid) - data = {'vimid': vim_info['vimId'], + data = {'vimId': vim_info['vimId'], 'vimName': vim_info['name'], 'username': vim_info['userName'], 'password': vim_info['password'], @@ -104,7 +105,7 @@ class FlavorView(APIView): return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) - rsp = {'vimid': vim_info['vimId'], + rsp = {'vimId': vim_info['vimId'], 'vimName': vim_info['name'], 'tenantId': tenantid} rsp.update(flavor_dict) @@ -112,7 +113,7 @@ class FlavorView(APIView): def delete(self, request, vimid, tenantid, flavorid): vim_info = extsys.get_vim_by_id(vimid) - data = {'vimid': vim_info['vimId'], + data = {'vimId': vim_info['vimId'], 'vimName': vim_info['name'], 'username': vim_info['userName'], 'password': vim_info['password'], diff --git a/vio/vio/swagger/views/limits/views.py b/vio/vio/swagger/views/limits/views.py index 2b8be05..d3f0e2c 100644 --- a/vio/vio/swagger/views/limits/views.py +++ b/vio/vio/swagger/views/limits/views.py @@ -24,7 +24,7 @@ class LimitsView(APIView): def get(self, request, vimid, tenantid): vim_info = extsys.get_vim_by_id(vimid) - data = {'vimid': vim_info['vimId'], + data = {'vimId': vim_info['vimId'], 'vimName': vim_info['name'], 'username': vim_info['userName'], 'password': vim_info['password'], @@ -38,7 +38,7 @@ class LimitsView(APIView): return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) - rsp = {'vimid': vim_info['vimId'], + rsp = {'vimId': vim_info['vimId'], 'vimName': vim_info['name'], 'tenantId': tenantid} rsp.update(nova_utils.server_limits_formatter(server_limits)) diff --git a/vio/vio/swagger/views/tenant/views.py b/vio/vio/swagger/views/tenant/views.py index ba08589..7b1d432 100644 --- a/vio/vio/swagger/views/tenant/views.py +++ b/vio/vio/swagger/views/tenant/views.py @@ -28,7 +28,7 @@ class ListTenantsView(APIView): vim_info = extsys.get_vim_by_id(vimid) data = {} - data['vimid'] = vim_info['vimId'] + data['vimId'] = vim_info['vimId'] data['vimName'] = vim_info['name'] data['username'] = vim_info['userName'] data['password'] = vim_info['password'] @@ -43,7 +43,7 @@ class ListTenantsView(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) rsp = {} - rsp['vimid'] = vim_info['vimId'] + rsp['vimId'] = vim_info['vimId'] rsp['vimName'] = vim_info['name'] rsp['tenants'] = [] |