Fix network router type display
The OpenStack SDK maps the network "router:external" field to "is_router_external". However, OSC was using the incorrect mapping, "router_external". This caused OSC to display router type as "Internal" for all networks. Change-Id: Ifcd1349ab7c5881baee751936d076bf6aa058852 Closes-Bug: #1572228
This commit is contained in:
parent
461a203f2d
commit
9f3fa5ee3b
@ -32,7 +32,7 @@ def _format_router_external(item):
|
||||
_formatters = {
|
||||
'subnets': utils.format_list,
|
||||
'admin_state_up': _format_admin_state,
|
||||
'router_external': _format_router_external,
|
||||
'router:external': _format_router_external,
|
||||
'availability_zones': utils.format_list,
|
||||
'availability_zone_hints': utils.format_list,
|
||||
}
|
||||
@ -43,9 +43,6 @@ def _get_columns(item):
|
||||
if 'tenant_id' in columns:
|
||||
columns.remove('tenant_id')
|
||||
columns.append('project_id')
|
||||
if 'router:external' in columns:
|
||||
columns.remove('router:external')
|
||||
columns.append('router_external')
|
||||
return tuple(sorted(columns))
|
||||
|
||||
|
||||
@ -290,7 +287,7 @@ class ListNetwork(common.NetworkAndComputeLister):
|
||||
'shared',
|
||||
'subnets',
|
||||
'provider_network_type',
|
||||
'router_external',
|
||||
'router:external',
|
||||
'availability_zones',
|
||||
)
|
||||
column_headers = (
|
||||
|
@ -166,8 +166,7 @@ class FakeNetwork(object):
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:return:
|
||||
A FakeResource object, with id, name, admin_state_up,
|
||||
router_external, status, subnets, tenant_id
|
||||
A FakeResource object, with id, name, etc.
|
||||
"""
|
||||
attrs = attrs or {}
|
||||
|
||||
@ -181,7 +180,7 @@ class FakeNetwork(object):
|
||||
'shared': False,
|
||||
'subnets': ['a', 'b'],
|
||||
'provider_network_type': 'vlan',
|
||||
'router_external': True,
|
||||
'router:external': True,
|
||||
'availability_zones': [],
|
||||
'availability_zone_hints': [],
|
||||
'is_default': False,
|
||||
@ -195,6 +194,7 @@ class FakeNetwork(object):
|
||||
|
||||
# Set attributes with special mapping in OpenStack SDK.
|
||||
network.project_id = network_attrs['tenant_id']
|
||||
network.is_router_external = network_attrs['router:external']
|
||||
|
||||
return network
|
||||
|
||||
|
@ -55,7 +55,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
||||
'name',
|
||||
'project_id',
|
||||
'provider_network_type',
|
||||
'router_external',
|
||||
'router:external',
|
||||
'shared',
|
||||
'status',
|
||||
'subnets',
|
||||
@ -70,7 +70,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
||||
_network.name,
|
||||
_network.project_id,
|
||||
_network.provider_network_type,
|
||||
network._format_router_external(_network.router_external),
|
||||
network._format_router_external(_network.is_router_external),
|
||||
_network.shared,
|
||||
_network.status,
|
||||
utils.format_list(_network.subnets),
|
||||
@ -224,7 +224,7 @@ class TestCreateNetworkIdentityV2(TestNetwork):
|
||||
'name',
|
||||
'project_id',
|
||||
'provider_network_type',
|
||||
'router_external',
|
||||
'router:external',
|
||||
'shared',
|
||||
'status',
|
||||
'subnets',
|
||||
@ -239,7 +239,7 @@ class TestCreateNetworkIdentityV2(TestNetwork):
|
||||
_network.name,
|
||||
_network.project_id,
|
||||
_network.provider_network_type,
|
||||
network._format_router_external(_network.router_external),
|
||||
network._format_router_external(_network.is_router_external),
|
||||
_network.shared,
|
||||
_network.status,
|
||||
utils.format_list(_network.subnets),
|
||||
@ -391,7 +391,7 @@ class TestListNetwork(TestNetwork):
|
||||
net.shared,
|
||||
utils.format_list(net.subnets),
|
||||
net.provider_network_type,
|
||||
network._format_router_external(net.router_external),
|
||||
network._format_router_external(net.is_router_external),
|
||||
utils.format_list(net.availability_zones),
|
||||
))
|
||||
|
||||
@ -566,7 +566,7 @@ class TestShowNetwork(TestNetwork):
|
||||
'name',
|
||||
'project_id',
|
||||
'provider_network_type',
|
||||
'router_external',
|
||||
'router:external',
|
||||
'shared',
|
||||
'status',
|
||||
'subnets',
|
||||
@ -581,7 +581,7 @@ class TestShowNetwork(TestNetwork):
|
||||
_network.name,
|
||||
_network.project_id,
|
||||
_network.provider_network_type,
|
||||
network._format_router_external(_network.router_external),
|
||||
network._format_router_external(_network.is_router_external),
|
||||
_network.shared,
|
||||
_network.status,
|
||||
utils.format_list(_network.subnets),
|
||||
|
6
releasenotes/notes/bug-1572228-03638a7adec5da8b.yaml
Normal file
6
releasenotes/notes/bug-1572228-03638a7adec5da8b.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- Fixed ``network create``, ``network show`` and ``network list``
|
||||
commands to correctly display the router type in the
|
||||
``router:external`` and ``Router Type`` columns.
|
||||
[Bug `1572228 <https://bugs.launchpad.net/bugs/1572228>`_]
|
Loading…
Reference in New Issue
Block a user