From e999d673d1ffe263c04e6e0ca89be3a3956c4800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Wed, 4 Jul 2018 20:52:16 +0200 Subject: [PATCH] Iterate only once in network configs parameters This re-orderes the parameters section of network config templates. By doing this we reduce the number of times we iterate over networks in the parameters section from three times to once. Change-Id: Id45c67b2c2b87fff5c557666a7959bfc0e49d36c --- .../controller-no-external.j2.yaml | 38 +++++++++---------- .../bond-with-vlans/controller-v6.j2.yaml | 32 +++++++--------- .../config/bond-with-vlans/role.role.j2.yaml | 38 +++++++++---------- .../config/multiple-nics/compute-dvr.j2.yaml | 20 ++++------ .../multiple-nics/controller-v6.j2.yaml | 20 ++++------ .../config/multiple-nics/role.role.j2.yaml | 20 ++++------ .../controller-v6.j2.yaml | 26 ++++++------- .../role.role.j2.yaml | 20 ++++------ .../controller-no-external.j2.yaml | 20 ++++------ .../single-nic-vlans/controller-v6.j2.yaml | 20 ++++------ .../config/single-nic-vlans/role.role.j2.yaml | 20 ++++------ 11 files changed, 115 insertions(+), 159 deletions(-) diff --git a/network/config/bond-with-vlans/controller-no-external.j2.yaml b/network/config/bond-with-vlans/controller-no-external.j2.yaml index f5eb00d1d1..541f14dccf 100644 --- a/network/config/bond-with-vlans/controller-no-external.j2.yaml +++ b/network/config/bond-with-vlans/controller-no-external.j2.yaml @@ -10,28 +10,22 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - {%- for network in networks %} - {{network.name}}IpSubnet: - default: '' - description: IP address/subnet on the {{network.name_lower}} network + ControlPlaneSubnetCidr: # Override this via parameter_defaults + default: '24' + description: The subnet CIDR of the control plane network. type: string - {%- endfor %} - BondInterfaceOvsOptions: - default: '' - description: 'The ovs_options or bonding_options string for the bond - interface. Set things like lacp=active and/or bond_mode=balance-slb - for OVS bonds or like mode=4 for Linux bonds using this option.' - type: string -{%- for network in networks %} - {{network.name}}NetworkVlanID: - default: {{network.vlan}} - description: Vlan ID for the {{network.name_lower}} network traffic. - type: number -{%- endfor %} ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. type: string {%- for network in networks %} + {{network.name}}IpSubnet: + default: '' + description: IP address/subnet on the {{network.name_lower}} network + type: string + {{network.name}}NetworkVlanID: + default: {{network.vlan}} + description: Vlan ID for the {{network.name_lower}} network traffic. + type: number {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %} {{network.name}}InterfaceDefaultRoute: default: '{{network.gateway_ipv6}}' @@ -44,10 +38,6 @@ parameters: type: string {%- endif %} {%- endfor %} - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. - type: string DnsServers: # Override this via parameter_defaults default: [] description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. @@ -55,6 +45,12 @@ parameters: EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string + BondInterfaceOvsOptions: + default: '' + description: 'The ovs_options or bonding_options string for the bond + interface. Set things like lacp=active and/or bond_mode=balance-slb + for OVS bonds or like mode=4 for Linux bonds using this option.' + type: string resources: OsNetConfigImpl: type: OS::Heat::SoftwareConfig diff --git a/network/config/bond-with-vlans/controller-v6.j2.yaml b/network/config/bond-with-vlans/controller-v6.j2.yaml index 48a0d7652b..5a9501987f 100644 --- a/network/config/bond-with-vlans/controller-v6.j2.yaml +++ b/network/config/bond-with-vlans/controller-v6.j2.yaml @@ -8,24 +8,6 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - {%- for network in networks %} - {{network.name}}IpSubnet: - default: '' - description: IP address/subnet on the {{network.name_lower}} network - type: string - {%- endfor %} - BondInterfaceOvsOptions: - default: bond_mode=active-backup - description: 'The ovs_options or bonding_options string for the bond - interface. Set things like lacp=active and/or bond_mode=balance-slb - for OVS bonds or like mode=4 for Linux bonds using this option.' - type: string - {%- for network in networks %} - {{network.name}}NetworkVlanID: - default: {{network.vlan}} - description: Vlan ID for the {{network.name_lower}} network traffic. - type: number - {%- endfor %} ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. @@ -34,6 +16,14 @@ parameters: description: The default route of the control plane network. type: string {%- for network in networks %} + {{network.name}}IpSubnet: + default: '' + description: IP address/subnet on the {{network.name_lower}} network + type: string + {{network.name}}NetworkVlanID: + default: {{network.vlan}} + description: Vlan ID for the {{network.name_lower}} network traffic. + type: number {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %} {{network.name}}InterfaceDefaultRoute: default: '{{network.gateway_ipv6}}' @@ -53,6 +43,12 @@ parameters: EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string + BondInterfaceOvsOptions: + default: bond_mode=active-backup + description: 'The ovs_options or bonding_options string for the bond + interface. Set things like lacp=active and/or bond_mode=balance-slb + for OVS bonds or like mode=4 for Linux bonds using this option.' + type: string resources: OsNetConfigImpl: type: OS::Heat::SoftwareConfig diff --git a/network/config/bond-with-vlans/role.role.j2.yaml b/network/config/bond-with-vlans/role.role.j2.yaml index 2571a9668b..d39c6170d2 100644 --- a/network/config/bond-with-vlans/role.role.j2.yaml +++ b/network/config/bond-with-vlans/role.role.j2.yaml @@ -6,28 +6,22 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - {%- for network in networks %} - {{network.name}}IpSubnet: - default: '' - description: IP address/subnet on the {{network.name_lower}} network + ControlPlaneSubnetCidr: # Override this via parameter_defaults + default: '24' + description: The subnet CIDR of the control plane network. type: string - {%- endfor %} - BondInterfaceOvsOptions: - default: bond_mode=active-backup - description: 'The ovs_options or bonding_options string for the bond - interface. Set things like lacp=active and/or bond_mode=balance-slb - for OVS bonds or like mode=4 for Linux bonds using this option.' - type: string -{%- for network in networks %} - {{network.name}}NetworkVlanID: - default: {{network.vlan}} - description: Vlan ID for the {{network.name_lower}} network traffic. - type: number -{%- endfor %} ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. type: string {%- for network in networks %} + {{network.name}}IpSubnet: + default: '' + description: IP address/subnet on the {{network.name_lower}} network + type: string + {{network.name}}NetworkVlanID: + default: {{network.vlan}} + description: Vlan ID for the {{network.name_lower}} network traffic. + type: number {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %} {{network.name}}InterfaceDefaultRoute: default: '{{network.gateway_ipv6}}' @@ -40,10 +34,6 @@ parameters: type: string {%- endif %} {%- endfor %} - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. - type: string DnsServers: # Override this via parameter_defaults default: [] description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. @@ -51,6 +41,12 @@ parameters: EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string + BondInterfaceOvsOptions: + default: bond_mode=active-backup + description: 'The ovs_options or bonding_options string for the bond + interface. Set things like lacp=active and/or bond_mode=balance-slb + for OVS bonds or like mode=4 for Linux bonds using this option.' + type: string {%- if role.name == 'ComputeOvsDpdk' %} NumDpdkInterfaceRxQueues: description: Number of Rx Queues required for DPDK bond or DPDK ports diff --git a/network/config/multiple-nics/compute-dvr.j2.yaml b/network/config/multiple-nics/compute-dvr.j2.yaml index 1e40ee534b..a01db95ce0 100644 --- a/network/config/multiple-nics/compute-dvr.j2.yaml +++ b/network/config/multiple-nics/compute-dvr.j2.yaml @@ -8,18 +8,6 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - {%- for network in networks %} - {{network.name}}IpSubnet: - default: '' - description: IP address/subnet on the {{network.name_lower}} network - type: string - {%- endfor %} - {%- for network in networks %} - {{network.name}}NetworkVlanID: - default: {{network.vlan}} - description: Vlan ID for the {{network.name_lower}} network traffic. - type: number - {%- endfor %} ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. @@ -28,6 +16,14 @@ parameters: description: The default route of the control plane network. type: string {%- for network in networks %} + {{network.name}}IpSubnet: + default: '' + description: IP address/subnet on the {{network.name_lower}} network + type: string + {{network.name}}NetworkVlanID: + default: {{network.vlan}} + description: Vlan ID for the {{network.name_lower}} network traffic. + type: number {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %} {{network.name}}InterfaceDefaultRoute: default: '{{network.gateway_ipv6}}' diff --git a/network/config/multiple-nics/controller-v6.j2.yaml b/network/config/multiple-nics/controller-v6.j2.yaml index 261ed59509..cf1f5ae5b0 100644 --- a/network/config/multiple-nics/controller-v6.j2.yaml +++ b/network/config/multiple-nics/controller-v6.j2.yaml @@ -7,18 +7,6 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - {%- for network in networks %} - {{network.name}}IpSubnet: - default: '' - description: IP address/subnet on the {{network.name_lower}} network - type: string - {%- endfor %} - {%- for network in networks %} - {{network.name}}NetworkVlanID: - default: {{network.vlan}} - description: Vlan ID for the {{network.name_lower}} network traffic. - type: number - {%- endfor %} ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. @@ -27,6 +15,14 @@ parameters: description: The default route of the control plane network. type: string {%- for network in networks %} + {{network.name}}IpSubnet: + default: '' + description: IP address/subnet on the {{network.name_lower}} network + type: string + {{network.name}}NetworkVlanID: + default: {{network.vlan}} + description: Vlan ID for the {{network.name_lower}} network traffic. + type: number {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %} {{network.name}}InterfaceDefaultRoute: default: '{{network.gateway_ipv6}}' diff --git a/network/config/multiple-nics/role.role.j2.yaml b/network/config/multiple-nics/role.role.j2.yaml index 2b4dc2f267..2908c72dba 100644 --- a/network/config/multiple-nics/role.role.j2.yaml +++ b/network/config/multiple-nics/role.role.j2.yaml @@ -6,18 +6,6 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - {%- for network in networks %} - {{network.name}}IpSubnet: - default: '' - description: IP address/subnet on the {{network.name_lower}} network - type: string - {%- endfor %} - {%- for network in networks %} - {{network.name}}NetworkVlanID: - default: {{network.vlan}} - description: Vlan ID for the {{network.name_lower}} network traffic. - type: number - {%- endfor %} ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. @@ -26,6 +14,14 @@ parameters: description: The default route of the control plane network. type: string {%- for network in networks %} + {{network.name}}IpSubnet: + default: '' + description: IP address/subnet on the {{network.name_lower}} network + type: string + {{network.name}}NetworkVlanID: + default: {{network.vlan}} + description: Vlan ID for the {{network.name_lower}} network traffic. + type: number {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %} {{network.name}}InterfaceDefaultRoute: default: '{{network.gateway_ipv6}}' diff --git a/network/config/single-nic-linux-bridge-vlans/controller-v6.j2.yaml b/network/config/single-nic-linux-bridge-vlans/controller-v6.j2.yaml index bda9387fba..0c8320e023 100644 --- a/network/config/single-nic-linux-bridge-vlans/controller-v6.j2.yaml +++ b/network/config/single-nic-linux-bridge-vlans/controller-v6.j2.yaml @@ -7,22 +7,22 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - {%- for network in networks %} - {{network.name}}IpSubnet: - default: '' - description: IP address/subnet on the {{network.name_lower}} network + ControlPlaneSubnetCidr: # Override this via parameter_defaults + default: '24' + description: The subnet CIDR of the control plane network. type: string - {%- endfor %} - {%- for network in networks %} - {{network.name}}NetworkVlanID: - default: {{network.vlan}} - description: Vlan ID for the {{network.name_lower}} network traffic. - type: number - {%- endfor %} ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. type: string {%- for network in networks %} + {{network.name}}IpSubnet: + default: '' + description: IP address/subnet on the {{network.name_lower}} network + type: string + {{network.name}}NetworkVlanID: + default: {{network.vlan}} + description: Vlan ID for the {{network.name_lower}} network traffic. + type: number {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %} {{network.name}}InterfaceDefaultRoute: default: '{{network.gateway_ipv6}}' @@ -35,10 +35,6 @@ parameters: type: string {%- endif %} {%- endfor %} - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. - type: string DnsServers: # Override this via parameter_defaults default: [] description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. diff --git a/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml b/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml index 6095aa8a65..6729463a89 100644 --- a/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml +++ b/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml @@ -6,18 +6,6 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - {%- for network in networks %} - {{network.name}}IpSubnet: - default: '' - description: IP address/subnet on the {{network.name_lower}} network - type: string - {%- endfor %} - {%- for network in networks %} - {{network.name}}NetworkVlanID: - default: {{network.vlan}} - description: Vlan ID for the {{network.name_lower}} network traffic. - type: number - {%- endfor %} ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. @@ -26,6 +14,14 @@ parameters: description: The default route of the control plane network. type: string {%- for network in networks %} + {{network.name}}IpSubnet: + default: '' + description: IP address/subnet on the {{network.name_lower}} network + type: string + {{network.name}}NetworkVlanID: + default: {{network.vlan}} + description: Vlan ID for the {{network.name_lower}} network traffic. + type: number {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %} {{network.name}}InterfaceDefaultRoute: default: '{{network.gateway_ipv6}}' diff --git a/network/config/single-nic-vlans/controller-no-external.j2.yaml b/network/config/single-nic-vlans/controller-no-external.j2.yaml index 600991033e..3f4f033be6 100644 --- a/network/config/single-nic-vlans/controller-no-external.j2.yaml +++ b/network/config/single-nic-vlans/controller-no-external.j2.yaml @@ -10,18 +10,6 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - {%- for network in networks %} - {{network.name}}IpSubnet: - default: '' - description: IP address/subnet on the {{network.name_lower}} network - type: string - {%- endfor %} - {%- for network in networks %} - {{network.name}}NetworkVlanID: - default: {{network.vlan}} - description: Vlan ID for the {{network.name_lower}} network traffic. - type: number - {%- endfor %} ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. @@ -30,6 +18,14 @@ parameters: description: The default route of the control plane network. type: string {%- for network in networks %} + {{network.name}}IpSubnet: + default: '' + description: IP address/subnet on the {{network.name_lower}} network + type: string + {{network.name}}NetworkVlanID: + default: {{network.vlan}} + description: Vlan ID for the {{network.name_lower}} network traffic. + type: number {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %} {{network.name}}InterfaceDefaultRoute: default: '{{network.gateway_ipv6}}' diff --git a/network/config/single-nic-vlans/controller-v6.j2.yaml b/network/config/single-nic-vlans/controller-v6.j2.yaml index b8d3b6835d..1b30749893 100644 --- a/network/config/single-nic-vlans/controller-v6.j2.yaml +++ b/network/config/single-nic-vlans/controller-v6.j2.yaml @@ -7,18 +7,6 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - {%- for network in networks %} - {{network.name}}IpSubnet: - default: '' - description: IP address/subnet on the {{network.name_lower}} network - type: string - {%- endfor %} - {%- for network in networks %} - {{network.name}}NetworkVlanID: - default: {{network.vlan}} - description: Vlan ID for the {{network.name_lower}} network traffic. - type: number - {%- endfor %} ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. @@ -27,6 +15,14 @@ parameters: description: The default route of the control plane network. type: string {%- for network in networks %} + {{network.name}}IpSubnet: + default: '' + description: IP address/subnet on the {{network.name_lower}} network + type: string + {{network.name}}NetworkVlanID: + default: {{network.vlan}} + description: Vlan ID for the {{network.name_lower}} network traffic. + type: number {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %} {{network.name}}InterfaceDefaultRoute: default: '{{network.gateway_ipv6}}' diff --git a/network/config/single-nic-vlans/role.role.j2.yaml b/network/config/single-nic-vlans/role.role.j2.yaml index f49406d14c..27f5a11599 100644 --- a/network/config/single-nic-vlans/role.role.j2.yaml +++ b/network/config/single-nic-vlans/role.role.j2.yaml @@ -6,18 +6,6 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - {%- for network in networks %} - {{network.name}}IpSubnet: - default: '' - description: IP address/subnet on the {{network.name_lower}} network - type: string - {%- endfor %} - {%- for network in networks %} - {{network.name}}NetworkVlanID: - default: {{network.vlan}} - description: Vlan ID for the {{network.name_lower}} network traffic. - type: number - {%- endfor %} ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. @@ -26,6 +14,14 @@ parameters: description: The default route of the control plane network. type: string {%- for network in networks %} + {{network.name}}IpSubnet: + default: '' + description: IP address/subnet on the {{network.name_lower}} network + type: string + {{network.name}}NetworkVlanID: + default: {{network.vlan}} + description: Vlan ID for the {{network.name_lower}} network traffic. + type: number {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %} {{network.name}}InterfaceDefaultRoute: default: '{{network.gateway_ipv6}}'