From d27ec26e56685cc05426d6c0835c3ea84402ee87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Fri, 6 Jul 2018 10:30:03 +0200 Subject: [PATCH] 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 Partial: blueprint tripleo-routed-networks-templates Change-Id: Ie44b211c4aeab9ca79d7994f31961e34aa3517e6 --- puppet/role.role.j2.yaml | 20 +++++++++++++++++++ ...ttr-interface-routes-dfbe74adce15da1d.yaml | 7 +++++++ 2 files changed, 27 insertions(+) create mode 100644 releasenotes/notes/use-attr-interface-routes-dfbe74adce15da1d.yaml diff --git a/puppet/role.role.j2.yaml b/puppet/role.role.j2.yaml index 3825cd1924..24023c5ab4 100644 --- a/puppet/role.role.j2.yaml +++ b/puppet/role.role.j2.yaml @@ -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: diff --git a/releasenotes/notes/use-attr-interface-routes-dfbe74adce15da1d.yaml b/releasenotes/notes/use-attr-interface-routes-dfbe74adce15da1d.yaml new file mode 100644 index 0000000000..feb59f8804 --- /dev/null +++ b/releasenotes/notes/use-attr-interface-routes-dfbe74adce15da1d.yaml @@ -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``.)