blob: 2638dd37250cd4e71cdf03736a2ff9e114be658e [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
Ian Wienandaee18c72014-02-21 15:35:08 +11008function is_neutron_ovs_base_plugin {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -04009 # linuxbridge doesn't use OVS
10 return 1
11}
12
Ian Wienandaee18c72014-02-21 15:35:08 +110013function neutron_plugin_create_nova_conf {
Aaron Rosen4540d002013-10-24 13:59:33 -070014 :
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040015}
16
Ian Wienandaee18c72014-02-21 15:35:08 +110017function neutron_plugin_install_agent_packages {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040018 install_package bridge-utils
19}
20
Ian Wienandaee18c72014-02-21 15:35:08 +110021function neutron_plugin_configure_debug_command {
Mark McClainb05c8762013-07-06 23:29:39 -040022 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040023}
24
Ian Wienandaee18c72014-02-21 15:35:08 +110025function neutron_plugin_configure_dhcp_agent {
Mark McClainb05c8762013-07-06 23:29:39 -040026 iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040027}
28
Ian Wienandaee18c72014-02-21 15:35:08 +110029function 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
Ian Wienandaee18c72014-02-21 15:35:08 +110034function 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.
Kyle Mesterybd085502014-04-30 23:50:29 +000038 if [[ "$LB_INTERFACE_MAPPINGS" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040039 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"
Akihiro Motoki2307f9d2014-08-09 18:58:20 +090050 iniset /$Q_PLUGIN_CONF_FILE agent tunnel_types $Q_TUNNEL_TYPES
Kyle Mesteryebfac642013-05-17 15:20:56 -050051 # Define extra "AGENT" configuration options when q-agt is configured by defining
52 # the array ``Q_AGENT_EXTRA_AGENT_OPTS``.
53 # For Example: ``Q_AGENT_EXTRA_AGENT_OPTS=(foo=true bar=2)``
54 for I in "${Q_AGENT_EXTRA_AGENT_OPTS[@]}"; do
55 # Replace the first '=' with ' ' for iniset syntax
Gary Kottond42634f2013-06-24 09:26:55 +000056 iniset /$Q_PLUGIN_CONF_FILE agent ${I/=/ }
Kyle Mesteryebfac642013-05-17 15:20:56 -050057 done
58 # Define extra "LINUX_BRIDGE" configuration options when q-agt is configured by defining
59 # the array ``Q_AGENT_EXTRA_SRV_OPTS``.
60 # For Example: ``Q_AGENT_EXTRA_SRV_OPTS=(foo=true bar=2)``
61 for I in "${Q_AGENT_EXTRA_SRV_OPTS[@]}"; do
62 # Replace the first '=' with ' ' for iniset syntax
Gary Kottond42634f2013-06-24 09:26:55 +000063 iniset /$Q_PLUGIN_CONF_FILE linux_bridge ${I/=/ }
Kyle Mesteryebfac642013-05-17 15:20:56 -050064 done
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040065}
66
Ian Wienandaee18c72014-02-21 15:35:08 +110067function neutron_plugin_setup_interface_driver {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040068 local conf_file=$1
Mark McClainb05c8762013-07-06 23:29:39 -040069 iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040070}
71
Ian Wienandaee18c72014-02-21 15:35:08 +110072function neutron_plugin_check_adv_test_requirements {
Bob Kukurac9b0f1a2013-04-23 16:28:24 -040073 is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
74}
75
76# Restore xtrace
77$PLUGIN_XTRACE