Browse code

Merge "Enable vlan networking for newer neutron plugin"

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