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
This commit is contained in:
parent
06f30fb4eb
commit
59c5e23c54
@ -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:
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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 %}
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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: >
|
||||
|
@ -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…
x
Reference in New Issue
Block a user