From 9c4cb2055d768416c990895f85afd8d6e377e419 Mon Sep 17 00:00:00 2001
From: Harald Jensas <hjensas@redhat.com>
Date: Wed, 14 Feb 2018 21:03:18 +0100
Subject: [PATCH] Add static routes for routed ctlplane

Add static routes to non-local subnets on the ctlplane
network.

Depends-On: I5fbac0c4a75ad2fb719bfd10887778c8eaeacfd6
Change-Id: I43f8fc0aa150f9470e67c8c16a14273abc749c00
---
 environments/undercloud.yaml  | 9 +++++++++
 net-config-undercloud.j2.yaml | 5 +++++
 2 files changed, 14 insertions(+)

diff --git a/environments/undercloud.yaml b/environments/undercloud.yaml
index d18ce683b9..4ebb66ac43 100644
--- a/environments/undercloud.yaml
+++ b/environments/undercloud.yaml
@@ -81,3 +81,12 @@ parameter_defaults:
   NeutronPortQuota: '-1'
   MigrateLegacyNeutronDb: true
   SwiftCorsAllowedOrigin: '*'
+  # A list of static routes for the control plane network. Ensure traffic to
+  # nodes on remote control plane networks use the correct network path.
+  # Example:
+  #   ControlPlaneStaticRoutes:
+  #     - ip_netmask: 192.168.25.0/24
+  #       next_hop: 192.168.24.1
+  #     - ip_netmask: 192.168.26.0/24
+  #       next_hop: 192.168.24.1
+  ControlPlaneStaticRoutes: []
diff --git a/net-config-undercloud.j2.yaml b/net-config-undercloud.j2.yaml
index 38e4b6cdac..03b0b6795a 100644
--- a/net-config-undercloud.j2.yaml
+++ b/net-config-undercloud.j2.yaml
@@ -17,6 +17,10 @@ parameters:
     default: '24'
     description: The subnet CIDR of the control plane network.
     type: string
+  ControlPlaneStaticRoutes:
+    default: []
+    description: A list of static routes
+    type: json
   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.
@@ -53,6 +57,7 @@ resources:
                     - /
                     - - get_param: ControlPlaneIp
                       - get_param: ControlPlaneSubnetCidr
+                routes: {get_param: ControlPlaneStaticRoutes}
                 members:
                 - type: interface
                   name: interface_name