Merge "Use get_attr to set %network%InterfaceDefaultRoute"

This commit is contained in:
Zuul 2019-03-25 21:52:55 +00:00 committed by Gerrit Code Review
commit cf25304879
17 changed files with 72 additions and 116 deletions

View File

@ -59,14 +59,9 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{%- if network.name in role.default_route_networks %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
default: ''
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}

View File

@ -50,17 +50,6 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{{network.name}}InterfaceRoutes:
default: []
description: >
@ -70,6 +59,10 @@ parameters:
from the subnet host_routes attribute.
type: json
{%- endfor %}
ExternalInterfaceDefaultRoute:
default: ''
description: default route for the external network
type: string
DnsServers: # Override this via parameter_defaults
default: []
description: >

View File

@ -48,17 +48,6 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{{network.name}}InterfaceRoutes:
default: []
description: >
@ -68,6 +57,10 @@ parameters:
from the subnet host_routes attribute.
type: json
{%- endfor %}
ExternalInterfaceDefaultRoute:
default: ''
description: default route for the external network
type: string
DnsServers: # Override this via parameter_defaults
default: []
description: >

View File

@ -57,17 +57,12 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{%- if network.name in role.default_route_networks %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
default: ''
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{%- endif %}
{{network.name}}InterfaceRoutes:
default: []
description: >

View File

@ -48,17 +48,6 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{{network.name}}InterfaceRoutes:
default: []
description: >
@ -68,6 +57,14 @@ parameters:
from the subnet host_routes attribute.
type: json
{%- endfor %}
# Uncomment when including environments/network-management.yaml and setting
# default route on the Management interface. Also comment out the default
# route on the Control Plane and add the Management network to the roles
# default_route_networks in roles data.
# ManagementInterfaceDefaultRoute:
# default: ''
# description: default route for the management network
# type: string
DnsServers: # Override this via parameter_defaults
default: []
description: >

View File

@ -47,17 +47,6 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{{network.name}}InterfaceRoutes:
default: []
description: >
@ -67,6 +56,10 @@ parameters:
from the subnet host_routes attribute.
type: json
{%- endfor %}
ExternalInterfaceDefaultRoute:
default: ''
description: default route for the external network
type: string
DnsServers: # Override this via parameter_defaults
default: []
description: >

View File

@ -57,17 +57,12 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{%- if network.name in role.default_route_networks %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
default: ''
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{%- endif %}
{{network.name}}InterfaceRoutes:
default: []
description: >

View File

@ -47,17 +47,6 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{{network.name}}InterfaceRoutes:
default: []
description: >
@ -67,6 +56,10 @@ parameters:
from the subnet host_routes attribute.
type: json
{%- endfor %}
ExternalInterfaceDefaultRoute:
default: ''
description: default route for the external network
type: string
DnsServers: # Override this via parameter_defaults
default: []
description: >

View File

@ -57,17 +57,12 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{%- if network.name in role.default_route_networks %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
default: ''
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{%- endif %}
{{network.name}}InterfaceRoutes:
default: []
description: >

View File

@ -50,17 +50,6 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{{network.name}}InterfaceRoutes:
default: []
description: >
@ -70,6 +59,10 @@ parameters:
from the subnet host_routes attribute.
type: json
{%- endfor %}
ExternalInterfaceDefaultRoute:
default: ''
description: default route for the external network
type: string
DnsServers: # Override this via parameter_defaults
default: []
description: >

View File

@ -47,17 +47,6 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{{network.name}}InterfaceRoutes:
default: []
description: >
@ -67,6 +56,10 @@ parameters:
from the subnet host_routes attribute.
type: json
{%- endfor %}
ExternalInterfaceDefaultRoute:
default: ''
description: default route for the external network
type: string
DnsServers: # Override this via parameter_defaults
default: []
description: >

View File

@ -57,17 +57,12 @@ parameters:
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{%- if network.name in role.default_route_networks %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
default: ''
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{%- endif %}
{{network.name}}InterfaceRoutes:
default: []
description: >

View File

@ -76,3 +76,6 @@ outputs:
description: The maximum transmission unit (MTU)
value:
get_param: ControlPlaneMtu
gateway_ip: # Here for compatibility
description: Gateway IP of the ports subnet
value: ''

View File

@ -107,3 +107,7 @@ outputs:
description: The maximum transmission unit (MTU)
value:
get_attr: [{{network.name}}Port, network, mtu]
gateway_ip:
description: Gateway IP of the ports subnet
value:
get_attr: [{{network.name}}Port, subnets, 0, gateway_ip]

View File

@ -84,4 +84,11 @@ outputs:
mtu:
description: The maximum transmission unit (MTU)
value: {{network.mtu|default('1500')}}
gateway_ip:
description: Gateway IP of the ports subnet
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
value: {{network.gateway_ipv6|default('')}}
{%- else %}
value: {{network.gateway_ip|default('')}}
{%- endif %}

View File

@ -542,6 +542,9 @@ resources:
- {get_param: {{network.name}}InterfaceRoutes}
- {get_attr: [{{network.name}}Port, host_routes]}
{{network.name}}Mtu: {get_attr: [{{network.name}}Port, mtu]}
{%- if network.name in role.default_route_networks %}
{{network.name}}InterfaceDefaultRoute: {get_attr: [{{network.name}}Port, gateway_ip]}
{%- endif %}
{%- endif %}
{%- endfor %}

View File

@ -0,0 +1,9 @@
---
features:
- |
The *get_attr* function is now used to read the ``gateway_ip`` of a ports
subnet. The gateway_ip value is passed to nic config templates using the
``%network%InterfaceDefaultRoute`` parameter. (This parameter is only used
if the network is present in the roles ``default_route_networks``.) Using
*get_attr* ensures that the correct gateway ip address is used when
networks have multiple subnets.