host_routes using get_attr (Composable Networks)

Uses get_attr on the port resource to resolve attribute
value from neutron subnet 'host_routes' attribute and
pass it to the parameter '{{network.name}}InterfaceRoutes'
in network configuration templates.

A conditional is used in puppet/role.role.j2.yaml. The
user provided parameter value is used whenever it is
not the default: []. This allow advanced user's to
override the routes in neutron.

Co-Authored-By: Dan Sneddon <dsneddon@redhat.com>
Partial: blueprint tripleo-routed-networks-templates
Change-Id: Ie44b211c4aeab9ca79d7994f31961e34aa3517e6
This commit is contained in:
Harald Jensås 2018-07-06 10:30:03 +02:00
parent f5f6553797
commit d27ec26e56
2 changed files with 27 additions and 0 deletions

View File

@ -267,6 +267,16 @@ 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 %}
{{network.name}}InterfaceRoutes:
default: []
description: >
Routes for the {{network.name_lower}} network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
{%- endfor %}
ServerDeletionPolicy:
description: Whether to retain or delete servers on deletion of the stack
@ -337,6 +347,11 @@ conditions:
equals:
- {get_param: [{{role.name}}IPs, '{{network.name_lower}}', {get_param: NodeIndex}]}
- ''
{{network.name_lower}}_interface_routes_set:
not:
equals:
- {get_param: {{network.name}}InterfaceRoutes}
- []
{%- endfor %}
ctlplane_subnet_cidr_set:
not:
@ -504,6 +519,11 @@ resources:
{%- for network in networks %}
{{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
{{network.name}}InterfaceRoutes:
if:
- {{network.name_lower}}_interface_routes_set
- {get_param: {{network.name}}InterfaceRoutes}
- {get_attr: [{{network.name}}Port, host_routes]}
{%- endfor %}
NetIpMap:

View File

@ -0,0 +1,7 @@
---
features:
- |
Routes specified in the ``host_routes`` attribute of neutron subnets is
passed to ``{{network.name}}InterfaceRoutes`` in network templates. (The
routes in neutron subnet's ``host_routes`` can be configured by setting the
``routes`` field in ``network_data.yaml``.)