Sean Dague | e263c82 | 2014-12-05 14:25:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
mathieu-rohon | 50187ee | 2014-11-21 22:12:40 +0100 | [diff] [blame] | 3 | # Neutron Linux Bridge L2 agent |
| 4 | # ----------------------------- |
| 5 | |
| 6 | # Save trace setting |
| 7 | PLUGIN_XTRACE=$(set +o | grep xtrace) |
| 8 | set +o xtrace |
| 9 | |
Sean M. Collins | 64d5ecf | 2015-06-01 14:13:41 -0400 | [diff] [blame^] | 10 | function neutron_lb_cleanup { |
| 11 | sudo brctl delbr $PUBLIC_BRIDGE |
| 12 | } |
| 13 | |
mathieu-rohon | 50187ee | 2014-11-21 22:12:40 +0100 | [diff] [blame] | 14 | function is_neutron_ovs_base_plugin { |
| 15 | # linuxbridge doesn't use OVS |
| 16 | return 1 |
| 17 | } |
| 18 | |
| 19 | function neutron_plugin_create_nova_conf { |
| 20 | : |
| 21 | } |
| 22 | |
| 23 | function neutron_plugin_install_agent_packages { |
| 24 | install_package bridge-utils |
| 25 | } |
| 26 | |
| 27 | function neutron_plugin_configure_debug_command { |
| 28 | iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge |
| 29 | } |
| 30 | |
| 31 | function neutron_plugin_configure_dhcp_agent { |
| 32 | iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport |
| 33 | } |
| 34 | |
| 35 | function neutron_plugin_configure_l3_agent { |
Sean M. Collins | 64d5ecf | 2015-06-01 14:13:41 -0400 | [diff] [blame^] | 36 | sudo brctl addbr $PUBLIC_BRIDGE |
mathieu-rohon | 50187ee | 2014-11-21 22:12:40 +0100 | [diff] [blame] | 37 | 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 | |
| 41 | function 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-rohon | 50187ee | 2014-11-21 22:12:40 +0100 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | function neutron_plugin_setup_interface_driver { |
| 61 | local conf_file=$1 |
| 62 | iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver |
| 63 | } |
| 64 | |
| 65 | function 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 |