From cf17ac91edb7e1df4c25d01e0e84a27a3468ba8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Thu, 28 Jan 2021 02:02:59 +0100 Subject: [PATCH] Add tags to THT network resources This combines several changes that added tags to network resources into one commit. Add an index tag on neutron network resources When using the multiple nic-config templates in THT and in tripleo-ansible the ordering of networks in the network_data file matters. Add a a tag 'tripleo_net_idx' to neutron resources to keep track of the ordering. Add tripleo_network_name tag hint to networks The ansible module to manage networks sets the name upper as a tag hint on the neutron network resources. tripleo_ansible/ansible_plugins/modules/tripleo_composable_network.py#L124 This change adds this tag for Heat managed networks as well. Depends-On: https://review.opendev.org/792196 Partial-Implements: blueprint network-data-v2-ports (cherry picked from commit 2d0125ed4023eb7c524d09a0e5865e8d3e22a492) (cherry picked from commit 70dc61cc0a5f99ce3d1368dc226ba4292866f22f) Change-Id: I08b98e9daa625c7c81e50a8ba67bcfc91af37cf0 --- network/network.j2 | 2 ++ tools/process-templates.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/network/network.j2 b/network/network.j2 index da8e2482b0..8b5f9f6a7f 100644 --- a/network/network.j2 +++ b/network/network.j2 @@ -178,6 +178,8 @@ resources: - {get_param: {{network.name}}NetValueSpecs} - {'mtu': {get_param: {{network.name}}Mtu}} tags: + - tripleo_net_idx={{network.idx}} + - tripleo_network_name={{network.name}} - tripleo_vip={{network.vip|default(false)}} {%- if network.service_net_map_replace|default('') %} - tripleo_service_net_map_replace={{network.service_net_map_replace}} diff --git a/tools/process-templates.py b/tools/process-templates.py index 7eafcc4774..208303a0c2 100755 --- a/tools/process-templates.py +++ b/tools/process-templates.py @@ -158,6 +158,11 @@ def process_templates(template_path, role_data_path, output_dir, if network_data is None: network_data = [] + # Set internal network index key for each network, network resources + # are created with a tag tripleo_net_idx + for idx, net in enumerate(network_data): + network_data[idx].update({'idx': idx}) + j2_excludes = {} j2_excludes_path = os.path.join(template_path, 'j2_excludes.yaml') if os.path.exists(j2_excludes_path):