Browse code

Enable vlan networking for newer neutron plugin

Ironic's CI makes extensive use of VLAN based networking
and the newer neutron plugin hardcodes the tenant networking
type to vxlan which is naturally problematic. It also lacks the
ability to set the necessary constraints for vlan networking
which are added for vxlan networking.

This patch enables the type of tenant networking to be defined
as vlan, and enables for a physical network vlan range mapping
setting to be configured which is required for a vlan to be
allocated upon network creation.

Change-Id: I55874c1ce82898e9dfb81505d8f3b14abde33579

Julia Kreger authored on 2019/01/10 10:00:45
Showing 1 changed files
... ...
@@ -100,6 +100,17 @@ NEUTRON_ROOTWRAP_DAEMON_CMD="$NEUTRON_ROOTWRAP-daemon $NEUTRON_ROOTWRAP_CONF_FIL
100 100
 PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex}
101 101
 PUBLIC_BRIDGE_MTU=${PUBLIC_BRIDGE_MTU:-1500}
102 102
 
103
+# Network type - default vxlan, however enables vlan based jobs to override
104
+# using the legacy environment variable as well as a new variable in greater
105
+# alignment with the naming scheme of this plugin.
106
+NEUTRON_TENANT_NETWORK_TYPE=${NEUTRON_TENANT_NETWORK_TYPE:-vxlan}
107
+
108
+NEUTRON_TENANT_VLAN_RANGE=${NEUTRON_TENANT_VLAN_RANGE:-${TENANT_VLAN_RANGE:-100:150}}
109
+
110
+# Physical network for VLAN network usage.
111
+NEUTRON_PHYSICAL_NETWORK=${NEUTRON_PHYSICAL_NETWORK:-}
112
+
113
+
103 114
 # Additional neutron api config files
104 115
 declare -a -g _NEUTRON_SERVER_EXTRA_CONF_FILES_ABS
105 116
 
... ...
@@ -203,9 +214,8 @@ function configure_neutron_new {
203 203
         configure_auth_token_middleware $NEUTRON_CONF neutron $NEUTRON_AUTH_CACHE_DIR keystone_authtoken
204 204
         configure_auth_token_middleware $NEUTRON_CONF nova $NEUTRON_AUTH_CACHE_DIR nova
205 205
 
206
-        # Configure VXLAN
207
-        # TODO(sc68cal) not hardcode?
208
-        iniset $NEUTRON_CORE_PLUGIN_CONF ml2 tenant_network_types vxlan
206
+        # Configure tenant network type
207
+        iniset $NEUTRON_CORE_PLUGIN_CONF ml2 tenant_network_types $NEUTRON_TENANT_NETWORK_TYPE
209 208
 
210 209
         local mech_drivers="openvswitch"
211 210
         if [[ "$NEUTRON_DISTRIBUTED_ROUTING" = "True" ]]; then
... ...
@@ -217,6 +227,9 @@ function configure_neutron_new {
217 217
 
218 218
         iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_vxlan vni_ranges 1001:2000
219 219
         iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_flat flat_networks public
220
+        if [[ "$NEUTRON_TENANT_NETWORK_TYPE" =~ "vlan" ]] && [[ "$NEUTRON_PHYSICAL_NETWORK" != "" ]]; then
221
+            iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_vlan network_vlan_ranges ${NEUTRON_PHYSICAL_NETWORK}:${NEUTRON_TENANT_VLAN_RANGE}
222
+        fi
220 223
         if [[ "$NEUTRON_PORT_SECURITY" = "True" ]]; then
221 224
             neutron_ml2_extension_driver_add port_security
222 225
         fi