blob: b348af9c4f2caac5114d282c9bf696d9020d40da [file] [log] [blame]
Sean Daguee263c822014-12-05 14:25:28 -05001#!/bin/bash
2#
mathieu-rohon50187ee2014-11-21 22:12:40 +01003# Neutron Linux Bridge L2 agent
4# -----------------------------
5
6# Save trace setting
7PLUGIN_XTRACE=$(set +o | grep xtrace)
8set +o xtrace
9
Sean M. Collins64d5ecf2015-06-01 14:13:41 -040010function neutron_lb_cleanup {
11 sudo brctl delbr $PUBLIC_BRIDGE
12}
13
mathieu-rohon50187ee2014-11-21 22:12:40 +010014function is_neutron_ovs_base_plugin {
15 # linuxbridge doesn't use OVS
16 return 1
17}
18
19function neutron_plugin_create_nova_conf {
20 :
21}
22
23function neutron_plugin_install_agent_packages {
24 install_package bridge-utils
25}
26
27function neutron_plugin_configure_debug_command {
28 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge
29}
30
31function neutron_plugin_configure_dhcp_agent {
32 iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
33}
34
35function neutron_plugin_configure_l3_agent {
Sean M. Collins64d5ecf2015-06-01 14:13:41 -040036 sudo brctl addbr $PUBLIC_BRIDGE
mathieu-rohon50187ee2014-11-21 22:12:40 +010037 iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge
38 iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport
39}
40
41function neutron_plugin_configure_plugin_agent {
42 # Setup physical network interface mappings. Override
43 # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more
44 # complex physical network configurations.
45 if [[ "$LB_INTERFACE_MAPPINGS" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then
46 LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE
47 fi
48 if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then
49 iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS
50 fi
51 if [[ "$Q_USE_SECGROUP" == "True" ]]; then
52 iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
53 else
54 iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver
55 fi
56 AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent"
57 iniset /$Q_PLUGIN_CONF_FILE agent tunnel_types $Q_TUNNEL_TYPES
mathieu-rohon50187ee2014-11-21 22:12:40 +010058}
59
60function neutron_plugin_setup_interface_driver {
61 local conf_file=$1
62 iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver
63}
64
65function neutron_plugin_check_adv_test_requirements {
66 is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
67}
68
69# Restore xtrace
70$PLUGIN_XTRACE