Add tag with network name on network resources

The network name in uppercase is needed to write
group_vars in ansible inventory. The name_lower
value is used as the actual network resouce name
in neutron.

Change-Id: Id99aa83d3025202ffd27480157aaf3e101c2f471
This commit is contained in:
Harald Jensås 2020-11-21 05:17:37 +01:00
parent d5c0d17a58
commit 2e77f1f238
2 changed files with 5 additions and 4 deletions

View File

@ -116,7 +116,7 @@ def get_overcloud_domain_name(conn, default_network):
def build_network_tag_field(net_data): def build_network_tag_field(net_data):
tags = [] tags = ['='.join(['tripleo_network_name', net_data['name']])]
service_net_map_replace = net_data.get('service_net_map_replace') service_net_map_replace = net_data.get('service_net_map_replace')
vip = net_data.get('vip') vip = net_data.get('vip')
if service_net_map_replace: if service_net_map_replace:

View File

@ -28,13 +28,14 @@ class TestTripleoComposableNetwork(tests_base.TestCase):
net_data = {'name': 'foo', net_data = {'name': 'foo',
'service_net_map_replace': 'replacement', 'service_net_map_replace': 'replacement',
'vip': True} 'vip': True}
expected = ['tripleo_service_net_map_replace=replacement', expected = ['tripleo_network_name=foo',
'tripleo_service_net_map_replace=replacement',
'tripleo_vip=true'] 'tripleo_vip=true']
result = plugin.build_network_tag_field(net_data) result = plugin.build_network_tag_field(net_data)
self.assertEqual(expected, result) self.assertEqual(expected, result)
net_data = {'name': 'foo'} net_data = {'name': 'foo'}
expected = [] expected = ['tripleo_network_name=foo']
result = plugin.build_network_tag_field(net_data) result = plugin.build_network_tag_field(net_data)
self.assertEqual(expected, result) self.assertEqual(expected, result)
@ -61,7 +62,7 @@ class TestTripleoComposableNetwork(tests_base.TestCase):
'shared': plugin.DEFAULT_SHARED, 'shared': plugin.DEFAULT_SHARED,
'provider:physical_network': 'netname', 'provider:physical_network': 'netname',
'provider:network_type': plugin.DEFAULT_NETWORK_TYPE, 'provider:network_type': plugin.DEFAULT_NETWORK_TYPE,
'tags': [], 'tags': ['tripleo_network_name=NetName'],
} }
result = plugin.create_net_spec(net_data, overcloud_domain_name) result = plugin.create_net_spec(net_data, overcloud_domain_name)