blob: 88c49c5b5e1fa93d2acb678d7cbe63c7e1ff1f7f [file] [log] [blame]
Mark McClainb05c8762013-07-06 23:29:39 -04001# Neutron Linux Bridge L2 agent
Bob Kukurac9b0f1a2013-04-23 16:28:24 -04002# -----------------------------
3
4# Save trace setting
5PLUGIN_XTRACE=$(set +o | grep xtrace)
6set +o xtrace
7
Mark McClainb05c8762013-07-06 23:29:39 -04008function is_neutron_ovs_base_plugin() {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -04009 # linuxbridge doesn't use OVS
10 return 1
11}
12
Mark McClainb05c8762013-07-06 23:29:39 -040013function neutron_plugin_create_nova_conf() {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040014 NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"}
15}
16
Mark McClainb05c8762013-07-06 23:29:39 -040017function neutron_plugin_install_agent_packages() {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040018 install_package bridge-utils
19}
20
Mark McClainb05c8762013-07-06 23:29:39 -040021function neutron_plugin_configure_debug_command() {
22 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040023}
24
Mark McClainb05c8762013-07-06 23:29:39 -040025function neutron_plugin_configure_dhcp_agent() {
26 iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040027}
28
Mark McClainb05c8762013-07-06 23:29:39 -040029function neutron_plugin_configure_l3_agent() {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040030 iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge
Mark McClainb05c8762013-07-06 23:29:39 -040031 iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040032}
33
Mark McClainb05c8762013-07-06 23:29:39 -040034function neutron_plugin_configure_plugin_agent() {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040035 # Setup physical network interface mappings. Override
36 # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more
37 # complex physical network configurations.
38 if [[ "$LB_INTERFACE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then
39 LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE
40 fi
41 if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000042 iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040043 fi
44 if [[ "$Q_USE_SECGROUP" == "True" ]]; then
Mark McClainb05c8762013-07-06 23:29:39 -040045 iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040046 else
Mark McClainb05c8762013-07-06 23:29:39 -040047 iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040048 fi
Mark McClainb05c8762013-07-06 23:29:39 -040049 AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent"
Kyle Mesteryebfac642013-05-17 15:20:56 -050050 # Define extra "AGENT" configuration options when q-agt is configured by defining
51 # the array ``Q_AGENT_EXTRA_AGENT_OPTS``.
52 # For Example: ``Q_AGENT_EXTRA_AGENT_OPTS=(foo=true bar=2)``
53 for I in "${Q_AGENT_EXTRA_AGENT_OPTS[@]}"; do
54 # Replace the first '=' with ' ' for iniset syntax
Gary Kottond42634f2013-06-24 09:26:55 +000055 iniset /$Q_PLUGIN_CONF_FILE agent ${I/=/ }
Kyle Mesteryebfac642013-05-17 15:20:56 -050056 done
57 # Define extra "LINUX_BRIDGE" configuration options when q-agt is configured by defining
58 # the array ``Q_AGENT_EXTRA_SRV_OPTS``.
59 # For Example: ``Q_AGENT_EXTRA_SRV_OPTS=(foo=true bar=2)``
60 for I in "${Q_AGENT_EXTRA_SRV_OPTS[@]}"; do
61 # Replace the first '=' with ' ' for iniset syntax
Gary Kottond42634f2013-06-24 09:26:55 +000062 iniset /$Q_PLUGIN_CONF_FILE linux_bridge ${I/=/ }
Kyle Mesteryebfac642013-05-17 15:20:56 -050063 done
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040064}
65
Mark McClainb05c8762013-07-06 23:29:39 -040066function neutron_plugin_setup_interface_driver() {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040067 local conf_file=$1
Mark McClainb05c8762013-07-06 23:29:39 -040068 iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040069}
70
Mark McClainb05c8762013-07-06 23:29:39 -040071function neutron_plugin_check_adv_test_requirements() {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040072 is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
73}
74
75# Restore xtrace
76$PLUGIN_XTRACE