diff options
| author | Richard Theis <rtheis@us.ibm.com> | 2016-04-19 14:42:01 -0500 |
|---|---|---|
| committer | Richard Theis <rtheis@us.ibm.com> | 2016-05-05 15:01:36 -0500 |
| commit | 9f3fa5ee3bf87c47f7a38ef78f4022ac46b2f2f6 (patch) | |
| tree | 2a3817b022f41dcfe94e0f7f63021addc7a6f184 | |
| parent | 461a203f2d0e653eabe9a023cfdbe90669ff0618 (diff) | |
| download | python-openstackclient-9f3fa5ee3bf87c47f7a38ef78f4022ac46b2f2f6.tar.gz | |
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
| -rw-r--r-- | openstackclient/network/v2/network.py | 7 | ||||
| -rw-r--r-- | openstackclient/tests/network/v2/fakes.py | 6 | ||||
| -rw-r--r-- | openstackclient/tests/network/v2/test_network.py | 14 | ||||
| -rw-r--r-- | releasenotes/notes/bug-1572228-03638a7adec5da8b.yaml | 6 |
4 files changed, 18 insertions, 15 deletions
diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py index 4b77971a..9fd7e28b 100644 --- a/openstackclient/network/v2/network.py +++ b/openstackclient/network/v2/network.py @@ -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 = ( diff --git a/openstackclient/tests/network/v2/fakes.py b/openstackclient/tests/network/v2/fakes.py index 1989b515..97a7f84e 100644 --- a/openstackclient/tests/network/v2/fakes.py +++ b/openstackclient/tests/network/v2/fakes.py @@ -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 diff --git a/openstackclient/tests/network/v2/test_network.py b/openstackclient/tests/network/v2/test_network.py index a1b0aec9..72dc7ac2 100644 --- a/openstackclient/tests/network/v2/test_network.py +++ b/openstackclient/tests/network/v2/test_network.py @@ -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), diff --git a/releasenotes/notes/bug-1572228-03638a7adec5da8b.yaml b/releasenotes/notes/bug-1572228-03638a7adec5da8b.yaml new file mode 100644 index 00000000..9db0ac0b --- /dev/null +++ b/releasenotes/notes/bug-1572228-03638a7adec5da8b.yaml @@ -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>`_] |
