Browse Source

Jinja automation for %network%NetworkVlanId

Per-subnet vlan id parameters are already rendered in
network-environment.yaml. This change uses networks data
and roles data so that per-subnet vlan id param is used
when passing the relevant NetworkVlanId data to nic-config
templates.

By using the generic %network%NetworkVlanId (no subnet suffix)
in nic-config templates instead of %network%NetworkVlanId_%subnet%,
this allow homogeneous computes in multiple sites to use the
same nic-config template.

Also use type: number for all vlan parameters.

Closes-Bug: #1821043
Change-Id: Id8e76ae7c41a562f5c47d911c42aa18001c11be1
changes/59/645159/8
Harald Jensås 3 years ago
parent
commit
59c5e23c54
  1. 22
      ci/common/net-config-multinode-os-net-config.yaml
  2. 22
      ci/common/net-config-multinode.yaml
  3. 22
      ci/common/net-config-simple-bridge.yaml
  4. 2
      network/config/2-linux-bonds-vlans/role.role.j2.yaml
  5. 2
      network/config/bond-with-vlans/controller-no-external.j2.yaml
  6. 2
      network/config/bond-with-vlans/controller-v6.j2.yaml
  7. 2
      network/config/bond-with-vlans/role.role.j2.yaml
  8. 2
      network/config/multiple-nics/compute-dvr.j2.yaml
  9. 2
      network/config/multiple-nics/controller-v6.j2.yaml
  10. 2
      network/config/multiple-nics/role.role.j2.yaml
  11. 2
      network/config/single-nic-linux-bridge-vlans/controller-v6.j2.yaml
  12. 2
      network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml
  13. 2
      network/config/single-nic-vlans/controller-no-external.j2.yaml
  14. 2
      network/config/single-nic-vlans/controller-v6.j2.yaml
  15. 2
      network/config/single-nic-vlans/role.role.j2.yaml
  16. 6
      network/network.j2
  17. 37
      puppet/role.role.j2.yaml

22
ci/common/net-config-multinode-os-net-config.yaml

@ -174,6 +174,28 @@ parameters:
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
# NOTE(hjensas): We need these because the default network_data.yaml define
# vlan for all networks.
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage_mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
resources:

22
ci/common/net-config-multinode.yaml

@ -162,6 +162,28 @@ parameters:
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
# NOTE(hjensas): We need these because the default network_data.yaml define
# vlan for all networks.
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage_mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
resources:
OsNetConfigImpl:

22
ci/common/net-config-simple-bridge.yaml

@ -159,6 +159,28 @@ parameters:
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
# NOTE(hjensas): We need these because the default network_data.yaml define
# vlan for all networks.
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage_mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
resources:
OsNetConfigImpl:

2
network/config/2-linux-bonds-vlans/role.role.j2.yaml

@ -50,7 +50,7 @@ parameters:
description: IP address/subnet on the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Mtu:

2
network/config/bond-with-vlans/controller-no-external.j2.yaml

@ -41,7 +41,7 @@ parameters:
description: IP address/subnet on the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Mtu:

2
network/config/bond-with-vlans/controller-v6.j2.yaml

@ -39,7 +39,7 @@ parameters:
description: IP address/subnet on the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Mtu:

2
network/config/bond-with-vlans/role.role.j2.yaml

@ -48,7 +48,7 @@ parameters:
description: IP address/subnet on the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Mtu:

2
network/config/multiple-nics/compute-dvr.j2.yaml

@ -39,7 +39,7 @@ parameters:
description: IP address/subnet on the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan|default("")}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Mtu:

2
network/config/multiple-nics/controller-v6.j2.yaml

@ -38,7 +38,7 @@ parameters:
description: IP address/subnet on the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan|default("")}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Mtu:

2
network/config/multiple-nics/role.role.j2.yaml

@ -49,7 +49,7 @@ parameters:
type: string
{%- if network.vlan %}
{{network.name}}NetworkVlanID:
default: {{network.vlan|default("")}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{%- endif %}

2
network/config/single-nic-linux-bridge-vlans/controller-v6.j2.yaml

@ -38,7 +38,7 @@ parameters:
description: IP address/subnet on the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Mtu:

2
network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml

@ -48,7 +48,7 @@ parameters:
description: IP address/subnet on the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Mtu:

2
network/config/single-nic-vlans/controller-no-external.j2.yaml

@ -41,7 +41,7 @@ parameters:
description: IP address/subnet on the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Mtu:

2
network/config/single-nic-vlans/controller-v6.j2.yaml

@ -38,7 +38,7 @@ parameters:
description: IP address/subnet on the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Mtu:

2
network/config/single-nic-vlans/role.role.j2.yaml

@ -48,7 +48,7 @@ parameters:
description: IP address/subnet on the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Mtu:

6
network/network.j2

@ -67,7 +67,7 @@ parameters:
type: string
{%- if network.vlan %}
{{network.name}}NetworkVlanID:
default: {{network.vlan|default('')}}
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{%- endif %}
@ -114,10 +114,10 @@ parameters:
default route for the {{network.name_lower}} network's {{subnet}} subnet.
type: string
{{network.name}}NetworkVlanID_{{subnet}}:
default: {{network.subnets[subnet]['vlan']|default('')}}
default: {{network.subnets[subnet]['vlan']|default(1)}}
description: |
Vlan ID for the {{network.name_lower}} network's {{subnet}} subnet.
type: string
type: number
{{network.name}}Routes_{{subnet}}:
default: {{network.subnets[subnet]['routes']|default([])}}
description: >

37
puppet/role.role.j2.yaml

@ -269,8 +269,7 @@ parameters:
If not set the nameservers configured in the ctlplane subnet's
dns_nameservers attribute will be used.
type: comma_delimited_list
{%- 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}}InterfaceRoutes:
default: []
description: >
@ -279,7 +278,28 @@ parameters:
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
{%- endif %}
{%- if role.networks is mapping %}
{%- set _subnets = network.get('subnets') %}
{%- set _role_net_subnet = role.networks[network.name].get('subnet') %}
{%- if _subnets and _role_net_subnet and _role_net_subnet in _subnets %}
{{network.name}}NetworkVlanID_{{_role_net_subnet}}:
default: {{_role_net_subnet.vlan|default(1)}}
description: >
Vlan ID for the {{network.name_lower}} network traffic for subnet
{{_role_net_subnet}}.
type: number
{%- elif network.vlan|default(false) %}
{{network.name}}NetworkVlanID:
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{%- endif %}
{%- elif network.vlan|default(false) %}
{{network.name}}NetworkVlanID:
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{%- endif %}
{%- endfor %}
ServerDeletionPolicy:
@ -545,6 +565,17 @@ resources:
{%- if network.name in role.default_route_networks %}
{{network.name}}InterfaceDefaultRoute: {get_attr: [{{network.name}}Port, gateway_ip]}
{%- endif %}
{%- if role.networks is mapping %}
{%- set _subnets = network.get('subnets') %}
{%- set _role_net_subnet = role.networks[network.name].get('subnet') %}
{%- if _subnets and _role_net_subnet and _role_net_subnet in _subnets %}
{{network.name}}NetworkVlanID: {get_param: {{network.name}}NetworkVlanID_{{_role_net_subnet}}}
{%- elif network.vlan|default(false) %}
{{network.name}}NetworkVlanID: {get_param: {{network.name}}NetworkVlanID}
{%- endif %}
{%- elif network.vlan|default(false) %}
{{network.name}}NetworkVlanID: {get_param: {{network.name}}NetworkVlanID}
{%- endif %}
{%- endif %}
{%- endfor %}

Loading…
Cancel
Save