Add ManageNetworks parameter

The ManageNetworks parameter has been added. The parameter controls
management of the network and related resources (subnets and segments) with
either create, update, or delete operations (depending on the stack
operation).  Does not apply to ports which will always be managed as
needed. Defaults to true.

For multi-stack use cases where the network
related resources have already been managed by a separate stack, this
parameter can be set to false.

Change-Id: I5ea71eea77b9f5868ddcd468bf2d3c4ab78d7c02
changes/35/693235/2
James Slagle 3 years ago
parent 164dae24c9
commit aade43dd12
  1. 39
      network/network.j2
  2. 10
      releasenotes/notes/manage-networks-9b1e5be19180deff.yaml

@ -127,10 +127,24 @@ parameters:
when the subnet is created.
type: json
{%- endfor %}
ManageNetworks:
default: true
type: boolean
description: >
Manage the network and related resources (subnets and segments) with
either create, update, or delete operations (depending on the stack
operation). Does not apply to ports which will always be managed as
needed. Defaults to true. For multi-stack use cases where the network
related resources have already been managed by a separate stack, this
parameter can be set to false.
conditions:
manage_networks: {get_param: ManageNetworks}
resources:
{{network.name}}Network:
type: OS::Neutron::Net
condition: manage_networks
{%- if network.external_resource_network_id|default('') %}
external_id: {{ network.external_resource_network_id }}
{%- endif %}
@ -145,6 +159,7 @@ resources:
{{network.name}}Subnet:
type: OS::Neutron::Subnet
condition: manage_networks
{%- if network.external_resource_subnet_id|default('') %}
external_id: {{ network.external_resource_subnet_id }}
{%- endif %}
@ -168,6 +183,7 @@ resources:
{% for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
{{network.name}}Segment_{{subnet}}:
type: OS::Neutron::Segment
condition: manage_networks
# NOTE(hjensas): Depends-On here to ensure we always create the base subnet
# first. We can only set the segment for existing subnet if there is only
# one segment and only one existing subnet on the network.
@ -184,6 +200,7 @@ resources:
{{network.name}}Subnet_{{subnet}}:
type: OS::Neutron::Subnet
condition: manage_networks
{%- if network.subnets[subnet].external_resource_subnet_id|default('') %}
external_id: {{ network.subnets[subnet].external_resource_subnet_id }}
{%- endif %}
@ -212,8 +229,24 @@ outputs:
description: List of {{network.name}} network's subnets in CIDR notation.
value:
list_concat:
- - {get_attr: [{{network.name}}Subnet, cidr]}
-
if:
- manage_networks
- - - {get_attr: [{{network.name}}Subnet, cidr]}
-
{%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
- {get_attr: [{{network.name}}Subnet_{{subnet}}, cidr]}
- {get_attr: [{{network.name}}Subnet_{{subnet}}, cidr]}
{%- endfor %}
- -
{%- if network.ipv6 or ipv6_override %}
- {{network.ipv6_subnet|default(network.ip_subnet|default(""))}}
{%- else %}
- "{{network.ip_subnet|default("")}}"
{%- endif %}
-
{%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
{%- if network.ipv6 or ipv6_override %}
- "{{network.subnets[subnet]['ipv6_subnet']|default(network.subnets[subnet]['ip_subnet']|default(""))}}"
{%- else %}
- "{{network.subnets[subnet]['ip_subnet']|default("")}}"
{%- endif %}
{%- endfor %}

@ -0,0 +1,10 @@
---
features:
- The ManageNetworks parameter has been added. The parameter controls
management of the network and related resources (subnets and segments) with
either create, update, or delete operations (depending on the stack
operation). Does not apply to ports which will always be managed as
needed. Defaults to true. For multi-stack use cases where the network
related resources have already been managed by a separate stack, this
parameter can be set to false.
Loading…
Cancel
Save