blob: fcff8703e57f3776d575a2e658e90dce25fa785e [file] [log] [blame]
Mark McClainb05c8762013-07-06 23:29:39 -04001# Neutron Modular Layer 2 plugin
Bob Kukurac9b0f1a2013-04-23 16:28:24 -04002# ------------------------------
3
4# Save trace setting
5MY_XTRACE=$(set +o | grep xtrace)
6set +o xtrace
7
8# Default openvswitch L2 agent
9Q_AGENT=${Q_AGENT:-openvswitch}
Mark McClainb05c8762013-07-06 23:29:39 -040010source $TOP_DIR/lib/neutron_plugins/${Q_AGENT}_agent
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040011
Mark McClainb05c8762013-07-06 23:29:39 -040012function neutron_plugin_configure_common() {
13 Q_PLUGIN_CONF_PATH=etc/neutron/plugins/ml2
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040014 Q_PLUGIN_CONF_FILENAME=ml2_conf.ini
Mark McClainb05c8762013-07-06 23:29:39 -040015 Q_DB_NAME="neutron_ml2"
16 Q_PLUGIN_CLASS="neutron.plugins.ml2.plugin.Ml2Plugin"
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040017}
18
Mark McClainb05c8762013-07-06 23:29:39 -040019function neutron_plugin_configure_service() {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040020 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 McClainb05c8762013-07-06 23:29:39 -040043 # neutron.agent.securitygroups_rpc.is_firewall_enabled() which is
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040044 # 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 McClainb05c8762013-07-06 23:29:39 -040050 iniset /$Q_PLUGIN_CONF_FILE SECURITYGROUP firewall_driver neutron.agent.not.a.real.FirewallDriver
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040051 else
Mark McClainb05c8762013-07-06 23:29:39 -040052 iniset /$Q_PLUGIN_CONF_FILE SECURITYGROUP firewall_driver neutron.agent.firewall.NoopFirewallDriver
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040053 fi
54
55}
56
Mark McClainb05c8762013-07-06 23:29:39 -040057function has_neutron_plugin_security_group() {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040058 return 0
59}
60
61# Restore xtrace
62$MY_XTRACE