Browse Source

Add external_resource_vip_id property to network_data.yaml

Adds the external_resource_vip_id property, which can be used to set an
external_id for the port resource for the network VIP.

Since the same template resource, port.network.j2.yaml is used for both
VIP and normal ports on a network, we can't simply add jinja to that
template that conditionally adds the external_id attribute because we
don't know during the jinja2 phase if the template is for a VIP or not.

Instead, we need to map the VIP resources to an entirely new template
resource (external_resource_port.network.j2.yaml) so that we can set the
external_id attribute just for the VIP ports.

Change-Id: I27d3eeb11277004b00aa4d6a66014d5c71081c26
implements: blueprint split-controlplane-templates
changes/02/638002/9
James Slagle 3 years ago
parent
commit
c7a97ce997
  1. 6
      environments/network-isolation-v6-all.j2.yaml
  2. 4
      environments/network-isolation-v6.j2.yaml
  3. 4
      environments/network-isolation.j2.yaml
  4. 2
      network/ports/external_resource_port.network.j2.yaml
  5. 3
      network/ports/external_resource_port_v6.network.j2.yaml
  6. 3
      network/ports/port.j2
  7. 3
      network_data.yaml
  8. 9
      releasenotes/notes/network-data-external-id-properties-20d4aec2e557e980.yaml
  9. 4
      tools/process-templates.py

6
environments/network-isolation-v6-all.j2.yaml

@ -26,7 +26,11 @@ resource_registry:
# Port assignments for the VIPs
{%- for network in networks if network.vip and network.enabled|default(true) %}
{%- if network.external_resource_vip_id|default('') %}
OS::TripleO::Network::Ports::{{network.name}}VipPort: ../network/ports/external_resource_{{network.name_lower|default(network.name.lower())}}_v6.yaml
{%- else %}
OS::TripleO::Network::Ports::{{network.name}}VipPort: ../network/ports/{{network.name_lower|default(network.name.lower())}}_v6.yaml
{%- endif %}
{%- endfor %}
OS::TripleO::Network::Ports::RedisVipPort: ../network/ports/vip_v6.yaml
@ -64,4 +68,4 @@ parameter_defaults:
# Enable IPv6 environment for OpenDaylight
OpenDaylightEnableIPv6Deployment: True
# Specify Tunnel endpoints to be IPv6
NeutronOverlayIPVersion: 6
NeutronOverlayIPVersion: 6

4
environments/network-isolation-v6.j2.yaml

@ -19,7 +19,11 @@ resource_registry:
# Port assignments for the VIPs
{%- for network in networks if network.vip and network.enabled|default(true) %}
{%- if network.external_resource_vip_id|default('') %}
OS::TripleO::Network::Ports::{{network.name}}VipPort: ../network/ports/external_resource_{{network.name_lower|default(network.name.lower())}}_v6.yaml
{%- else %}
OS::TripleO::Network::Ports::{{network.name}}VipPort: ../network/ports/{{network.name_lower|default(network.name.lower())}}_v6.yaml
{%- endif %}
{%- endfor %}
OS::TripleO::Network::Ports::RedisVipPort: ../network/ports/vip_v6.yaml

4
environments/network-isolation.j2.yaml

@ -9,7 +9,11 @@ resource_registry:
# Port assignments for the VIPs
{%- for network in networks if network.vip and network.enabled|default(true) %}
{%- if network.external_resource_vip_id|default('') %}
OS::TripleO::Network::Ports::{{network.name}}VipPort: ../network/ports/external_resource_{{network.name_lower|default(network.name.lower())}}.yaml
{%- else %}
OS::TripleO::Network::Ports::{{network.name}}VipPort: ../network/ports/{{network.name_lower|default(network.name.lower())}}.yaml
{%- endif %}
{%- endfor %}
OS::TripleO::Network::Ports::RedisVipPort: ../network/ports/vip.yaml

2
network/ports/external_resource_port.network.j2.yaml

@ -0,0 +1,2 @@
{% set set_external_id = true -%}
{% include 'port.j2' %}

3
network/ports/external_resource_port_v6.network.j2.yaml

@ -0,0 +1,3 @@
{% set ipv6_override = true -%}
{% set set_external_id = true -%}
{% include 'port.j2' %}

3
network/ports/port.j2

@ -64,6 +64,9 @@ resources:
{{network.name}}Port:
type: OS::Neutron::Port
{%- if set_external_id|default(false) and network.external_resource_vip_id|default('') %}
external_id: {{network.external_resource_vip_id}}
{%- endif %}
properties:
network: {get_param: {{network.name}}NetName}
name: {get_param: PortName}

3
network_data.yaml

@ -12,6 +12,9 @@
# external_resource_network_id: Optional. If set, it should be the UUID of an existing already
# created Neutron network that will be used in place of creating a
# new network.
# external_resource_vip_id: Optional. If set, it should be the UUID of an existing already
# created Neutron port for the VIP that will be used
# in place of creating a new port.
# external_resource_subnet_id: Optional. If set, it should be the UUID of an existing already
# created Neutron subnet that will be used in place of creating a
# new subnet for the network.

9
releasenotes/notes/network-data-external-id-properties-20d4aec2e557e980.yaml

@ -0,0 +1,9 @@
---
features:
- Adds the ability to set ``external_resource_network_id`` for the network,
``external_resource_vip_id`` for the network VIP,
``external_resource_subnet_id`` for the subnet(s), and
``external_resource_segment_id`` for the segment(s) to network_data.yaml.
When setting these properties, the external_id attribute will be set on the
corresponding Heat resources. This causes Heat to not re-create these
resources and instead adopt them from outside the stack.

4
tools/process-templates.py

@ -299,6 +299,9 @@ def clean_templates(base_path, role_data_path, network_data_path):
'network', '%s_from_pool_v6.yaml' % network['name_lower'])
ports_path = os.path.join(
'network', 'ports', '%s.yaml' % network['name_lower'])
external_resource_ports_path = os.path.join(
'network', 'ports',
'external_resource_%s.yaml' % network['name_lower'])
ports_from_pool_path = os.path.join(
'network', 'ports', '%s_from_pool.yaml' % network['name_lower'])
ports_v6_path = os.path.join(
@ -311,6 +314,7 @@ def clean_templates(base_path, role_data_path, network_data_path):
delete(network_v6_path)
delete(network_from_pool_v6_path)
delete(ports_path)
delete(external_resource_ports_path)
delete(ports_from_pool_path)
delete(ports_v6_path)
delete(ports_from_pool_v6_path)

Loading…
Cancel
Save