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

Commit

Permalink
Merge "Add ManageNetworks parameter"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Nov 12, 2019
2 parents f2a95da + aade43d commit 14eef5f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
39 changes: 36 additions & 3 deletions network/network.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand All @@ -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 %}
Expand All @@ -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.
Expand All @@ -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 %}
Expand Down Expand Up @@ -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 %}
10 changes: 10 additions & 0 deletions releasenotes/notes/manage-networks-9b1e5be19180deff.yaml
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 14eef5f

Please sign in to comment.