diff --git a/tripleo_validations/inventory.py b/tripleo_validations/inventory.py index 5c0b2a0ce..3e8ec989c 100644 --- a/tripleo_validations/inventory.py +++ b/tripleo_validations/inventory.py @@ -170,6 +170,9 @@ class TripleoInventory(object): ret[name]['vars'] = { 'deploy_server_id': role_node_id_map[ 'server_ids'][role][idx]} + # Add variable for listing enabled networks in the node + ret[name]['vars']['enabled_networks'] = \ + [str(net) for net in role_net_ip_map[role]] # Add variable for IP on each network for net in role_net_ip_map[role]: ret[name]['vars']["%s_ip" % net] = \ diff --git a/tripleo_validations/tests/test_inventory.py b/tripleo_validations/tests/test_inventory.py index baa356315..b30bdff75 100644 --- a/tripleo_validations/tests/test_inventory.py +++ b/tripleo_validations/tests/test_inventory.py @@ -158,13 +158,16 @@ class TestInventory(base.TestCase): def test_inventory_list(self): expected = {'c-0': {'hosts': ['x.x.x.1'], 'vars': {'deploy_server_id': 'a', - 'ctlplane_ip': 'x.x.x.1'}}, + 'ctlplane_ip': 'x.x.x.1', + 'enabled_networks': ['ctlplane']}}, 'c-1': {'hosts': ['x.x.x.2'], 'vars': {'deploy_server_id': 'b', - 'ctlplane_ip': 'x.x.x.2'}}, + 'ctlplane_ip': 'x.x.x.2', + 'enabled_networks': ['ctlplane']}}, 'c-2': {'hosts': ['x.x.x.3'], 'vars': {'deploy_server_id': 'c', - 'ctlplane_ip': 'x.x.x.3'}}, + 'ctlplane_ip': 'x.x.x.3', + 'enabled_networks': ['ctlplane']}}, 'Compute': { 'children': ['cp-0'], 'vars': {'ansible_ssh_user': 'heat-admin', @@ -177,10 +180,12 @@ class TestInventory(base.TestCase): 'role_name': 'Controller'}}, 'cp-0': {'hosts': ['y.y.y.1'], 'vars': {'deploy_server_id': 'd', - 'ctlplane_ip': 'y.y.y.1'}}, + 'ctlplane_ip': 'y.y.y.1', + 'enabled_networks': ['ctlplane']}}, 'cs-0': {'hosts': ['z.z.z.1'], 'vars': {'deploy_server_id': 'e', - 'ctlplane_ip': 'z.z.z.1'}}, + 'ctlplane_ip': 'z.z.z.1', + 'enabled_networks': ['ctlplane']}}, 'CustomRole': { 'children': ['cs-0'], 'vars': {'ansible_ssh_user': 'heat-admin', @@ -219,13 +224,16 @@ class TestInventory(base.TestCase): expected = {'c-0': {'hosts': ['x.x.x.1'], 'vars': {'deploy_server_id': 'a', - 'ctlplane_ip': 'x.x.x.1'}}, + 'ctlplane_ip': 'x.x.x.1', + 'enabled_networks': ['ctlplane']}}, 'c-1': {'hosts': ['x.x.x.2'], 'vars': {'deploy_server_id': 'b', - 'ctlplane_ip': 'x.x.x.2'}}, + 'ctlplane_ip': 'x.x.x.2', + 'enabled_networks': ['ctlplane']}}, 'c-2': {'hosts': ['x.x.x.3'], 'vars': {'deploy_server_id': 'c', - 'ctlplane_ip': 'x.x.x.3'}}, + 'ctlplane_ip': 'x.x.x.3', + 'enabled_networks': ['ctlplane']}}, 'Compute': { 'children': ['cp-0'], 'vars': {'ansible_ssh_user': 'my-custom-admin', @@ -238,10 +246,12 @@ class TestInventory(base.TestCase): 'role_name': 'Controller'}}, 'cp-0': {'hosts': ['y.y.y.1'], 'vars': {'deploy_server_id': 'd', - 'ctlplane_ip': 'y.y.y.1'}}, + 'ctlplane_ip': 'y.y.y.1', + 'enabled_networks': ['ctlplane']}}, 'cs-0': {'hosts': ['z.z.z.1'], 'vars': {'deploy_server_id': 'e', - 'ctlplane_ip': 'z.z.z.1'}}, + 'ctlplane_ip': 'z.z.z.1', + 'enabled_networks': ['ctlplane']}}, 'CustomRole': { 'children': ['cs-0'], 'vars': {'ansible_ssh_user': 'my-custom-admin',