Sean Dague | e263c82 | 2014-12-05 14:25:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
YAMAMOTO Takashi | 15130cd | 2014-10-28 11:49:58 +0900 | [diff] [blame] | 3 | # 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 Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 8 | |
| 9 | # Save trace setting |
Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 10 | _XTRACE_NEUTRON_OVS=$(set +o | grep xtrace) |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 11 | set +o xtrace |
| 12 | |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 13 | source $TOP_DIR/lib/neutron_plugins/openvswitch_agent |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 14 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 15 | function neutron_plugin_configure_common { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 16 | Q_PLUGIN_CONF_PATH=etc/neutron/plugins/openvswitch |
| 17 | Q_PLUGIN_CONF_FILENAME=ovs_neutron_plugin.ini |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 18 | Q_PLUGIN_CLASS="neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2" |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 19 | } |
| 20 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 21 | function neutron_plugin_configure_service { |
Kyle Mestery | bd08550 | 2014-04-30 23:50:29 +0000 | [diff] [blame] | 22 | if [[ "$ENABLE_TENANT_TUNNELS" == "True" ]]; then |
Gary Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame] | 23 | iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type gre |
| 24 | iniset /$Q_PLUGIN_CONF_FILE ovs tunnel_id_ranges $TENANT_TUNNEL_RANGES |
Kyle Mestery | bd08550 | 2014-04-30 23:50:29 +0000 | [diff] [blame] | 25 | elif [[ "$ENABLE_TENANT_VLANS" == "True" ]]; then |
Gary Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame] | 26 | iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type vlan |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 27 | 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 Mestery | bd08550 | 2014-04-30 23:50:29 +0000 | [diff] [blame] | 33 | if [[ "$OVS_VLAN_RANGES" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 34 | 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 Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame] | 40 | iniset /$Q_PLUGIN_CONF_FILE ovs network_vlan_ranges $OVS_VLAN_RANGES |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 41 | fi |
| 42 | |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 43 | _neutron_ovs_base_configure_firewall_driver |
Kyle Mestery | ebfac64 | 2013-05-17 15:20:56 -0500 | [diff] [blame] | 44 | |
| 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 Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame] | 50 | iniset /$Q_PLUGIN_CONF_FILE ovs ${I/=/ } |
Kyle Mestery | ebfac64 | 2013-05-17 15:20:56 -0500 | [diff] [blame] | 51 | done |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 52 | } |
| 53 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 54 | function has_neutron_plugin_security_group { |
Akihiro MOTOKI | 3452f8e | 2013-03-21 14:11:27 +0900 | [diff] [blame] | 55 | return 0 |
| 56 | } |
| 57 | |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 58 | # Restore xtrace |
Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 59 | $_XTRACE_NEUTRON_OVS |
| 60 | |