blob: 130eaacab3878773b425fdeb067c92d8a2a6f9dd [file] [log] [blame]
Sean Daguee263c822014-12-05 14:25:28 -05001#!/bin/bash
2#
YAMAMOTO Takashi15130cd2014-10-28 11:49:58 +09003# Common code used by cisco and embrane plugins
4# ---------------------------------------------
5
6# This module used to be for Open vSwitch monolithic plugin,
7# which has been removed in Juno.
Isaku Yamahata0dd34df2012-12-28 13:15:31 +09008
9# Save trace setting
Ian Wienand523f4882015-10-13 11:03:03 +110010_XTRACE_NEUTRON_OVS=$(set +o | grep xtrace)
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090011set +o xtrace
12
Mark McClainb05c8762013-07-06 23:29:39 -040013source $TOP_DIR/lib/neutron_plugins/openvswitch_agent
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090014
Ian Wienandaee18c72014-02-21 15:35:08 +110015function neutron_plugin_configure_common {
Mark McClainb05c8762013-07-06 23:29:39 -040016 Q_PLUGIN_CONF_PATH=etc/neutron/plugins/openvswitch
17 Q_PLUGIN_CONF_FILENAME=ovs_neutron_plugin.ini
Mark McClainb05c8762013-07-06 23:29:39 -040018 Q_PLUGIN_CLASS="neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2"
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090019}
20
Ian Wienandaee18c72014-02-21 15:35:08 +110021function neutron_plugin_configure_service {
Kyle Mesterybd085502014-04-30 23:50:29 +000022 if [[ "$ENABLE_TENANT_TUNNELS" == "True" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000023 iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type gre
24 iniset /$Q_PLUGIN_CONF_FILE ovs tunnel_id_ranges $TENANT_TUNNEL_RANGES
Kyle Mesterybd085502014-04-30 23:50:29 +000025 elif [[ "$ENABLE_TENANT_VLANS" == "True" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000026 iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type vlan
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090027 else
28 echo "WARNING - The openvswitch plugin is using local tenant networks, with no connectivity between hosts."
29 fi
30
31 # Override ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc``
32 # for more complex physical network configurations.
Kyle Mesterybd085502014-04-30 23:50:29 +000033 if [[ "$OVS_VLAN_RANGES" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090034 OVS_VLAN_RANGES=$PHYSICAL_NETWORK
35 if [[ "$TENANT_VLAN_RANGE" != "" ]]; then
36 OVS_VLAN_RANGES=$OVS_VLAN_RANGES:$TENANT_VLAN_RANGE
37 fi
38 fi
39 if [[ "$OVS_VLAN_RANGES" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000040 iniset /$Q_PLUGIN_CONF_FILE ovs network_vlan_ranges $OVS_VLAN_RANGES
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090041 fi
42
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
Ian Wienand523f4882015-10-13 11:03:03 +110059$_XTRACE_NEUTRON_OVS
60