blob: c468132bbb606c75e98aa6715dc2b4a29506a0c6 [file] [log] [blame]
Mark McClainb05c8762013-07-06 23:29:39 -04001# Neutron Open vSwitch plugin
Isaku Yamahata0dd34df2012-12-28 13:15:31 +09002# ---------------------------
3
4# Save trace setting
Dean Troyere3a91602014-03-28 12:40:56 -05005OVS_XTRACE=$(set +o | grep xtrace)
Isaku Yamahata0dd34df2012-12-28 13:15:31 +09006set +o xtrace
7
Mark McClainb05c8762013-07-06 23:29:39 -04008source $TOP_DIR/lib/neutron_plugins/openvswitch_agent
Isaku Yamahata0dd34df2012-12-28 13:15:31 +09009
Ian Wienandaee18c72014-02-21 15:35:08 +110010function neutron_plugin_configure_common {
Mark McClainb05c8762013-07-06 23:29:39 -040011 Q_PLUGIN_CONF_PATH=etc/neutron/plugins/openvswitch
12 Q_PLUGIN_CONF_FILENAME=ovs_neutron_plugin.ini
Mark McClainb05c8762013-07-06 23:29:39 -040013 Q_PLUGIN_CLASS="neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2"
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090014}
15
Ian Wienandaee18c72014-02-21 15:35:08 +110016function neutron_plugin_configure_service {
Kyle Mesterybd085502014-04-30 23:50:29 +000017 if [[ "$ENABLE_TENANT_TUNNELS" == "True" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000018 iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type gre
19 iniset /$Q_PLUGIN_CONF_FILE ovs tunnel_id_ranges $TENANT_TUNNEL_RANGES
Kyle Mesterybd085502014-04-30 23:50:29 +000020 elif [[ "$ENABLE_TENANT_VLANS" == "True" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000021 iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type vlan
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090022 else
23 echo "WARNING - The openvswitch plugin is using local tenant networks, with no connectivity between hosts."
24 fi
25
26 # Override ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc``
27 # for more complex physical network configurations.
Kyle Mesterybd085502014-04-30 23:50:29 +000028 if [[ "$OVS_VLAN_RANGES" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090029 OVS_VLAN_RANGES=$PHYSICAL_NETWORK
30 if [[ "$TENANT_VLAN_RANGE" != "" ]]; then
31 OVS_VLAN_RANGES=$OVS_VLAN_RANGES:$TENANT_VLAN_RANGE
32 fi
33 fi
34 if [[ "$OVS_VLAN_RANGES" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000035 iniset /$Q_PLUGIN_CONF_FILE ovs network_vlan_ranges $OVS_VLAN_RANGES
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090036 fi
37
38 # Enable tunnel networks if selected
Kyle Mesterybd085502014-04-30 23:50:29 +000039 if [[ $OVS_ENABLE_TUNNELING == "True" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000040 iniset /$Q_PLUGIN_CONF_FILE ovs enable_tunneling True
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090041 fi
Jiajun Liue6f2ee52013-05-14 09:48:15 +000042
Mark McClainb05c8762013-07-06 23:29:39 -040043 _neutron_ovs_base_configure_firewall_driver
Kyle Mesteryebfac642013-05-17 15:20:56 -050044
45 # Define extra "OVS" configuration options when q-svc is configured by defining
46 # the array ``Q_SRV_EXTRA_OPTS``.
47 # For Example: ``Q_SRV_EXTRA_OPTS=(foo=true bar=2)``
48 for I in "${Q_SRV_EXTRA_OPTS[@]}"; do
49 # Replace the first '=' with ' ' for iniset syntax
Gary Kottond42634f2013-06-24 09:26:55 +000050 iniset /$Q_PLUGIN_CONF_FILE ovs ${I/=/ }
Kyle Mesteryebfac642013-05-17 15:20:56 -050051 done
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090052}
53
Ian Wienandaee18c72014-02-21 15:35:08 +110054function has_neutron_plugin_security_group {
Akihiro MOTOKI3452f8e2013-03-21 14:11:27 +090055 return 0
56}
57
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090058# Restore xtrace
Dean Troyere3a91602014-03-28 12:40:56 -050059$OVS_XTRACE