| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1 | # Neutron Modular Layer 2 plugin | 
| Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 2 | # ------------------------------ | 
|  | 3 |  | 
|  | 4 | # Save trace setting | 
|  | 5 | MY_XTRACE=$(set +o | grep xtrace) | 
|  | 6 | set +o xtrace | 
|  | 7 |  | 
|  | 8 | # Default openvswitch L2 agent | 
|  | 9 | Q_AGENT=${Q_AGENT:-openvswitch} | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 10 | source $TOP_DIR/lib/neutron_plugins/${Q_AGENT}_agent | 
| Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 11 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 12 | function neutron_plugin_configure_common() { | 
|  | 13 | Q_PLUGIN_CONF_PATH=etc/neutron/plugins/ml2 | 
| Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 14 | Q_PLUGIN_CONF_FILENAME=ml2_conf.ini | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 15 | Q_DB_NAME="neutron_ml2" | 
|  | 16 | Q_PLUGIN_CLASS="neutron.plugins.ml2.plugin.Ml2Plugin" | 
| Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 17 | } | 
|  | 18 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 19 | function neutron_plugin_configure_service() { | 
| Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 20 | if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then | 
|  | 21 | iniset /$Q_PLUGIN_CONF_FILE ml2 tenant_network_types gre | 
|  | 22 | iniset /$Q_PLUGIN_CONF_FILE ml2_type_gre tunnel_id_ranges $TENANT_TUNNEL_RANGES | 
|  | 23 | elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then | 
|  | 24 | iniset /$Q_PLUGIN_CONF_FILE ml2 tenant_network_types vlan | 
|  | 25 | else | 
|  | 26 | echo "WARNING - The ml2 plugin is using local tenant networks, with no connectivity between hosts." | 
|  | 27 | fi | 
|  | 28 |  | 
|  | 29 | # Override ``ML2_VLAN_RANGES`` and any needed agent configuration | 
|  | 30 | # variables in ``localrc`` for more complex physical network | 
|  | 31 | # configurations. | 
|  | 32 | if [[ "$ML2_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then | 
|  | 33 | ML2_VLAN_RANGES=$PHYSICAL_NETWORK | 
|  | 34 | if [[ "$TENANT_VLAN_RANGE" != "" ]]; then | 
|  | 35 | ML2_VLAN_RANGES=$ML2_VLAN_RANGES:$TENANT_VLAN_RANGE | 
|  | 36 | fi | 
|  | 37 | fi | 
|  | 38 | if [[ "$ML2_VLAN_RANGES" != "" ]]; then | 
|  | 39 | iniset /$Q_PLUGIN_CONF_FILE ml2_type_vlan network_vlan_ranges $ML2_VLAN_RANGES | 
|  | 40 | fi | 
|  | 41 |  | 
|  | 42 | # REVISIT(rkukura): Setting firewall_driver here for | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 43 | # neutron.agent.securitygroups_rpc.is_firewall_enabled() which is | 
| Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 44 | # used in the server, in case no L2 agent is configured on the | 
|  | 45 | # server's node. If an L2 agent is configured, this will get | 
|  | 46 | # overridden with the correct driver. The ml2 plugin should | 
|  | 47 | # instead use its own config variable to indicate whether security | 
|  | 48 | # groups is enabled, and that will need to be set here instead. | 
|  | 49 | if [[ "$Q_USE_SECGROUP" == "True" ]]; then | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 50 | iniset /$Q_PLUGIN_CONF_FILE SECURITYGROUP firewall_driver neutron.agent.not.a.real.FirewallDriver | 
| Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 51 | else | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 52 | iniset /$Q_PLUGIN_CONF_FILE SECURITYGROUP firewall_driver neutron.agent.firewall.NoopFirewallDriver | 
| Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 53 | fi | 
|  | 54 |  | 
|  | 55 | } | 
|  | 56 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 57 | function has_neutron_plugin_security_group() { | 
| Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 58 | return 0 | 
|  | 59 | } | 
|  | 60 |  | 
|  | 61 | # Restore xtrace | 
|  | 62 | $MY_XTRACE |