vpnaas: show external_vx_ip for vpn service show

Closes-Bug: #2086144
Change-Id: Ic8ae85ee62e35991e8bb0096cdc6785a0b04e545
This commit is contained in:
elajkat 2024-11-06 10:11:22 +01:00
parent 75e112bc9b
commit b2107dc867
3 changed files with 16 additions and 4 deletions

View File

@ -36,6 +36,8 @@ _attr_map = (
('status', 'Status', column_util.LIST_BOTH), ('status', 'Status', column_util.LIST_BOTH),
('description', 'Description', column_util.LIST_LONG_ONLY), ('description', 'Description', column_util.LIST_LONG_ONLY),
('project_id', 'Project', 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 = { _attr_map_dict = {
@ -48,6 +50,8 @@ _attr_map_dict = {
'status': 'Status', 'status': 'Status',
'description': 'Description', 'description': 'Description',
'project_id': 'Project', '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 attrs['router_id'] = _router_id
obj = client.create_vpn_service(**attrs) obj = client.create_vpn_service(**attrs)
display_columns, columns = utils.get_osc_show_columns_for_sdk_resource( display_columns, columns = utils.get_osc_show_columns_for_sdk_resource(
obj, _attr_map_dict, ['location', 'tenant_id', 'external_v4_ip', obj, _attr_map_dict, ['location', 'tenant_id'])
'external_v6_ip'])
data = utils.get_dict_properties(obj, columns) data = utils.get_dict_properties(obj, columns)
return display_columns, data return display_columns, data
@ -244,7 +247,6 @@ class ShowVPNService(command.ShowOne):
ignore_missing=False)['id'] ignore_missing=False)['id']
obj = client.get_vpn_service(vpn_id) obj = client.get_vpn_service(vpn_id)
display_columns, columns = utils.get_osc_show_columns_for_sdk_resource( display_columns, columns = utils.get_osc_show_columns_for_sdk_resource(
obj, _attr_map_dict, ['location', 'tenant_id', 'external_v4_ip', obj, _attr_map_dict, ['location', 'tenant_id'])
'external_v6_ip'])
data = utils.get_dict_properties(obj, columns) data = utils.get_dict_properties(obj, columns)
return (display_columns, data) return (display_columns, data)

View File

@ -125,6 +125,8 @@ class VPNService(FakeVPNaaS):
('status', 'ACTIVE'), ('status', 'ACTIVE'),
('description', 'my-desc-' + uuid.uuid4().hex), ('description', 'my-desc-' + uuid.uuid4().hex),
('project_id', 'project-id-' + 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'),
)) ))

View File

@ -106,10 +106,14 @@ class TestVPNService(test_fakes.TestNeutronClientOSCV2):
'Status', 'Status',
'Description', 'Description',
'Project', 'Project',
'Ext v4 IP',
'Ext v6 IP',
) )
self.data = _generate_data() self.data = _generate_data()
self.ordered_headers = ( self.ordered_headers = (
'Description', 'Description',
'Ext v4 IP',
'Ext v6 IP',
'Flavor', 'Flavor',
'ID', 'ID',
'Name', 'Name',
@ -121,6 +125,8 @@ class TestVPNService(test_fakes.TestNeutronClientOSCV2):
) )
self.ordered_data = ( self.ordered_data = (
_vpnservice['description'], _vpnservice['description'],
_vpnservice['external_v4_ip'],
_vpnservice['external_v6_ip'],
_vpnservice['flavor_id'], _vpnservice['flavor_id'],
_vpnservice['id'], _vpnservice['id'],
_vpnservice['name'], _vpnservice['name'],
@ -132,6 +138,8 @@ class TestVPNService(test_fakes.TestNeutronClientOSCV2):
) )
self.ordered_columns = ( self.ordered_columns = (
'description', 'description',
'external_v4_ip',
'external_v6_ip',
'flavor_id', 'flavor_id',
'id', 'id',
'name', 'name',