Use get_attr to set %network%InterfaceDefaultRoute
For networks in role.default_route_networks use get_attr to fetch the gateway_ip of the port's subnet and pass it to the nic-config template. Changes the default in nic-config templates to ''. Closes-Bug: #1821046 Change-Id: Ic07a3166fafba3aa307a9e1953b3e3be2594a6f5
This commit is contained in:
parent
e4854d6ce1
commit
ce9a83c8cd
@ -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 %}
|
||||
|
@ -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: >
|
||||
|
@ -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: >
|
||||
|
@ -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: >
|
||||
|
@ -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: >
|
||||
|
@ -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: >
|
||||
|
@ -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: >
|
||||
|
@ -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: >
|
||||
|
@ -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: >
|
||||
|
@ -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: >
|
||||
|
@ -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: >
|
||||
|
@ -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: >
|
||||
|
@ -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: ''
|
||||
|
@ -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]
|
@ -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 %}
|
||||
|
||||
|
@ -539,6 +539,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 %}
|
||||
|
||||
|
@ -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.
|
Loading…
Reference in New Issue
Block a user