blob: 3b6567cd0a943830a6c89008ab78da87b4d72181 [file] [log] [blame]
YAMAMOTO Takashi15130cd2014-10-28 11:49:58 +09001# Common code used by cisco and embrane plugins
2# ---------------------------------------------
3
4# This module used to be for Open vSwitch monolithic plugin,
5# which has been removed in Juno.
Isaku Yamahata0dd34df2012-12-28 13:15:31 +09006
7# Save trace setting
Dean Troyere3a91602014-03-28 12:40:56 -05008OVS_XTRACE=$(set +o | grep xtrace)
Isaku Yamahata0dd34df2012-12-28 13:15:31 +09009set +o xtrace
10
Mark McClainb05c8762013-07-06 23:29:39 -040011source $TOP_DIR/lib/neutron_plugins/openvswitch_agent
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090012
Ian Wienandaee18c72014-02-21 15:35:08 +110013function neutron_plugin_configure_common {
Mark McClainb05c8762013-07-06 23:29:39 -040014 Q_PLUGIN_CONF_PATH=etc/neutron/plugins/openvswitch
15 Q_PLUGIN_CONF_FILENAME=ovs_neutron_plugin.ini
Mark McClainb05c8762013-07-06 23:29:39 -040016 Q_PLUGIN_CLASS="neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2"
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090017}
18
Ian Wienandaee18c72014-02-21 15:35:08 +110019function neutron_plugin_configure_service {
Kyle Mesterybd085502014-04-30 23:50:29 +000020 if [[ "$ENABLE_TENANT_TUNNELS" == "True" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000021 iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type gre
22 iniset /$Q_PLUGIN_CONF_FILE ovs tunnel_id_ranges $TENANT_TUNNEL_RANGES
Kyle Mesterybd085502014-04-30 23:50:29 +000023 elif [[ "$ENABLE_TENANT_VLANS" == "True" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000024 iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type vlan
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090025 else
26 echo "WARNING - The openvswitch plugin is using local tenant networks, with no connectivity between hosts."
27 fi
28
29 # Override ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc``
30 # for more complex physical network configurations.
Kyle Mesterybd085502014-04-30 23:50:29 +000031 if [[ "$OVS_VLAN_RANGES" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090032 OVS_VLAN_RANGES=$PHYSICAL_NETWORK
33 if [[ "$TENANT_VLAN_RANGE" != "" ]]; then
34 OVS_VLAN_RANGES=$OVS_VLAN_RANGES:$TENANT_VLAN_RANGE
35 fi
36 fi
37 if [[ "$OVS_VLAN_RANGES" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000038 iniset /$Q_PLUGIN_CONF_FILE ovs network_vlan_ranges $OVS_VLAN_RANGES
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090039 fi
40
Mark McClainb05c8762013-07-06 23:29:39 -040041 _neutron_ovs_base_configure_firewall_driver
Kyle Mesteryebfac642013-05-17 15:20:56 -050042
43 # Define extra "OVS" configuration options when q-svc is configured by defining
44 # the array ``Q_SRV_EXTRA_OPTS``.
45 # For Example: ``Q_SRV_EXTRA_OPTS=(foo=true bar=2)``
46 for I in "${Q_SRV_EXTRA_OPTS[@]}"; do
47 # Replace the first '=' with ' ' for iniset syntax
Gary Kottond42634f2013-06-24 09:26:55 +000048 iniset /$Q_PLUGIN_CONF_FILE ovs ${I/=/ }
Kyle Mesteryebfac642013-05-17 15:20:56 -050049 done
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090050}
51
Ian Wienandaee18c72014-02-21 15:35:08 +110052function has_neutron_plugin_security_group {
Akihiro MOTOKI3452f8e2013-03-21 14:11:27 +090053 return 0
54}
55
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090056# Restore xtrace
Dean Troyere3a91602014-03-28 12:40:56 -050057$OVS_XTRACE