Merge "Add tags to THT network resources" into stable/train

This commit is contained in:
Zuul 2021-06-02 20:16:10 +00:00 committed by Gerrit Code Review
commit 8d1f0adf34
2 changed files with 25 additions and 2 deletions

View File

@ -65,12 +65,10 @@ parameters:
{%- endif %}
description: default route for the {{network.name_lower}} network
type: string
{%- if network.vlan %}
{{network.name}}NetworkVlanID:
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{%- endif %}
{{network.name}}Routes:
default: {{network.routes|default([])}}
description: >
@ -156,6 +154,16 @@ resources:
map_merge:
- {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}}
{%- endif %}
{%- if network.ipv6 or ipv6_override %}
- tripleo_ipv6=true
{%- endif %}
{{network.name}}Subnet:
type: OS::Neutron::Subnet
@ -179,6 +187,11 @@ resources:
host_routes: {get_param: {{network.name}}Routes}
# All networks have an implicit network segment when created, map this subnet to that segment.
segment: {get_attr: [{{network.name}}Network, segments, 0, id]}
tags:
- str_replace:
template: tripleo_vlan_id=$vlan_id
params:
$vlan_id: {get_param: {{network.name}}NetworkVlanID}
{% for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
{{network.name}}Segment_{{subnet}}:
@ -219,6 +232,11 @@ resources:
gateway_ip: {get_param: {{network.name}}InterfaceDefaultRoute_{{subnet}}}
host_routes: {get_param: {{network.name}}Routes_{{subnet}}}
segment: {get_resource: {{network.name}}Segment_{{subnet}}}
tags:
- str_replace:
template: tripleo_vlan_id=$vlan_id
params:
$vlan_id: {get_param: {{network.name}}NetworkVlanID_{{subnet}}}
{% endfor %}
outputs:

View File

@ -117,6 +117,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):