Browse Source

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
changes/99/763799/2
Harald Jensås 5 months ago
parent
commit
2e77f1f238
2 changed files with 5 additions and 4 deletions
  1. +1
    -1
      tripleo_ansible/ansible_plugins/modules/tripleo_composable_network.py
  2. +4
    -3
      tripleo_ansible/tests/modules/test_tripleo_composable_network.py

+ 1
- 1
tripleo_ansible/ansible_plugins/modules/tripleo_composable_network.py View File

@ -116,7 +116,7 @@ def get_overcloud_domain_name(conn, default_network):
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')
vip = net_data.get('vip')
if service_net_map_replace:


+ 4
- 3
tripleo_ansible/tests/modules/test_tripleo_composable_network.py View File

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


Loading…
Cancel
Save