From b2107dc867e7a5bb6d86caa4b2a3fc8da3dc09eb Mon Sep 17 00:00:00 2001 From: elajkat Date: Wed, 6 Nov 2024 10:11:22 +0100 Subject: [PATCH] vpnaas: show external_vx_ip for vpn service show Closes-Bug: #2086144 Change-Id: Ic8ae85ee62e35991e8bb0096cdc6785a0b04e545 --- neutronclient/osc/v2/vpnaas/vpnservice.py | 10 ++++++---- neutronclient/tests/unit/osc/v2/vpnaas/fakes.py | 2 ++ .../tests/unit/osc/v2/vpnaas/test_vpnservice.py | 8 ++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/neutronclient/osc/v2/vpnaas/vpnservice.py b/neutronclient/osc/v2/vpnaas/vpnservice.py index f845a57ff..9e1e489ca 100644 --- a/neutronclient/osc/v2/vpnaas/vpnservice.py +++ b/neutronclient/osc/v2/vpnaas/vpnservice.py @@ -36,6 +36,8 @@ _attr_map = ( ('status', 'Status', column_util.LIST_BOTH), ('description', 'Description', column_util.LIST_LONG_ONLY), ('project_id', 'Project', column_util.LIST_LONG_ONLY), + ('external_v4_ip', 'Ext v4 IP', column_util.LIST_LONG_ONLY), + ('external_v6_ip', 'Ext v6 IP', column_util.LIST_LONG_ONLY), ) _attr_map_dict = { @@ -48,6 +50,8 @@ _attr_map_dict = { 'status': 'Status', 'description': 'Description', 'project_id': 'Project', + 'external_v4_ip': 'Ext v4 IP', + 'external_v6_ip': 'Ext v6 IP', } @@ -135,8 +139,7 @@ class CreateVPNService(command.ShowOne): attrs['router_id'] = _router_id obj = client.create_vpn_service(**attrs) display_columns, columns = utils.get_osc_show_columns_for_sdk_resource( - obj, _attr_map_dict, ['location', 'tenant_id', 'external_v4_ip', - 'external_v6_ip']) + obj, _attr_map_dict, ['location', 'tenant_id']) data = utils.get_dict_properties(obj, columns) return display_columns, data @@ -244,7 +247,6 @@ class ShowVPNService(command.ShowOne): ignore_missing=False)['id'] obj = client.get_vpn_service(vpn_id) display_columns, columns = utils.get_osc_show_columns_for_sdk_resource( - obj, _attr_map_dict, ['location', 'tenant_id', 'external_v4_ip', - 'external_v6_ip']) + obj, _attr_map_dict, ['location', 'tenant_id']) data = utils.get_dict_properties(obj, columns) return (display_columns, data) diff --git a/neutronclient/tests/unit/osc/v2/vpnaas/fakes.py b/neutronclient/tests/unit/osc/v2/vpnaas/fakes.py index 2344c0a1f..24e6497fc 100644 --- a/neutronclient/tests/unit/osc/v2/vpnaas/fakes.py +++ b/neutronclient/tests/unit/osc/v2/vpnaas/fakes.py @@ -125,6 +125,8 @@ class VPNService(FakeVPNaaS): ('status', 'ACTIVE'), ('description', 'my-desc-' + uuid.uuid4().hex), ('project_id', 'project-id-' + uuid.uuid4().hex), + ('external_v4_ip', '192.0.2.42'), + ('external_v6_ip', '2001:0db8:207a:4a3a:053b:6fab:7df9:1afd'), )) diff --git a/neutronclient/tests/unit/osc/v2/vpnaas/test_vpnservice.py b/neutronclient/tests/unit/osc/v2/vpnaas/test_vpnservice.py index 458c7f654..521fe741c 100644 --- a/neutronclient/tests/unit/osc/v2/vpnaas/test_vpnservice.py +++ b/neutronclient/tests/unit/osc/v2/vpnaas/test_vpnservice.py @@ -106,10 +106,14 @@ class TestVPNService(test_fakes.TestNeutronClientOSCV2): 'Status', 'Description', 'Project', + 'Ext v4 IP', + 'Ext v6 IP', ) self.data = _generate_data() self.ordered_headers = ( 'Description', + 'Ext v4 IP', + 'Ext v6 IP', 'Flavor', 'ID', 'Name', @@ -121,6 +125,8 @@ class TestVPNService(test_fakes.TestNeutronClientOSCV2): ) self.ordered_data = ( _vpnservice['description'], + _vpnservice['external_v4_ip'], + _vpnservice['external_v6_ip'], _vpnservice['flavor_id'], _vpnservice['id'], _vpnservice['name'], @@ -132,6 +138,8 @@ class TestVPNService(test_fakes.TestNeutronClientOSCV2): ) self.ordered_columns = ( 'description', + 'external_v4_ip', + 'external_v6_ip', 'flavor_id', 'id', 'name',