Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge "Add attr of networks and subnets to Networks resource"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Sep 27, 2020
2 parents 25c07e3 + 5b38785 commit f743b1c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
10 changes: 10 additions & 0 deletions network/network.j2
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,14 @@ outputs:
{%- else %}
- "{{network.subnets[subnet]['ip_subnet']|default("")}}"
{%- endif %}
{%- endfor %}
network_attrs:
description: {{network.name}} network's attributes
value: {get_attr: [{{network.name}}Network]}
subnet_attrs:
description: Map of attributes for subnets in the {{network.name}} network
value:
{{network.name_lower}}_subnet: {get_attr: [{{network.name}}Subnet]}
{%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
{{subnet}}: {get_attr: [{{network.name}}Subnet_{{subnet}}]}
{%- endfor %}
10 changes: 9 additions & 1 deletion network/networks.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,13 @@ outputs:
value:
{%- for network in networks if network.enabled|default(true) %}
{%- set network_name = network.compat_name|default(network.name) %}
{{network.name_lower}}: {get_attr: [{{network_name}}Network, ip_version]}
{{network.name_lower}}: {get_attr: [{{network_name}}Network, ip_version]}
{%- endfor %}
net_attributes_map:
value:
{%- for network in networks if network.enabled|default(true) %}
{%- set network_name = network.compat_name|default(network.name) %}
{{network.name_lower}}:
network: {get_attr: [{{network_name}}Network, network_attrs]}
subnets: {get_attr: [{{network_name}}Network, subnet_attrs]}
{%- endfor %}
27 changes: 23 additions & 4 deletions overcloud.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -919,14 +919,33 @@ resources:
type: OS::Heat::Value
properties:
value:
{%- for network in networks if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name_lower}}_mtu: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, network, mtu]}
{%- if role.networks is mapping %}
{{network.name_lower}}_gateway_ip: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{role.networks[network.name]['subnet']}}, gateway_ip]}
{{network.name_lower}}_host_routes: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{role.networks[network.name]['subnet']}}, host_routes]}
{{network.name_lower}}_cidr: {str_split: ['/', {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{role.networks[network.name]['subnet']}}, cidr]}, 1]}
{%- else %}
{{network.name_lower}}_gateway_ip: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{network.name_lower}}_subnet, gateway_ip]}
{{network.name_lower}}_host_routes: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{network.name_lower}}_subnet, host_routes]}
{{network.name_lower}}_cidr: {str_split: ['/', {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{network.name_lower}}_subnet, cidr]}, 1]}
{%- endif %}
{%- endfor %}
network_cidrs:
{%- for network in networks if network.enabled|default(true) and network.name in role.networks|default([]) %}
{%- if role.networks is mapping %}
{{network.name}}_cidr: {str_split: ['/', {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{role.networks[network.name]['subnet']}}, cidr]}, 1]}
{%- else %}
{{network.name}}_cidr: {str_split: ['/', {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{network.name_lower}}_subnet, cidr]}, 1]}
{%- endif %}
{%- endfor %}
role_networks:
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{%- for network in networks if network.enabled|default(true) and network.name in role.networks|default([]) %}
- {{network.name}}
{% endif %}
{% endfor %}
{%- endfor %}
service_metadata_settings: {get_attr: [{{role.name}}ServiceChainRoleData, value, service_metadata_settings]}


{% endfor %}

ControlVirtualIP:
Expand Down

0 comments on commit f743b1c

Please sign in to comment.