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 | |
| 10 | function is_neutron_ovs_base_plugin { |
| 11 | # linuxbridge doesn't use OVS |
| 12 | return 1 |
| 13 | } |
| 14 | |
| 15 | function neutron_plugin_create_nova_conf { |
| 16 | : |
| 17 | } |
| 18 | |
| 19 | function neutron_plugin_install_agent_packages { |
| 20 | install_package bridge-utils |
| 21 | } |
| 22 | |
| 23 | function neutron_plugin_configure_debug_command { |
| 24 | iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge |
| 25 | } |
| 26 | |
| 27 | function neutron_plugin_configure_dhcp_agent { |
| 28 | iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport |
| 29 | } |
| 30 | |
| 31 | function neutron_plugin_configure_l3_agent { |
| 32 | iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge |
| 33 | iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport |
| 34 | } |
| 35 | |
| 36 | function neutron_plugin_configure_plugin_agent { |
| 37 | # Setup physical network interface mappings. Override |
| 38 | # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more |
| 39 | # complex physical network configurations. |
| 40 | if [[ "$LB_INTERFACE_MAPPINGS" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then |
| 41 | LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE |
| 42 | fi |
| 43 | if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then |
| 44 | iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS |
| 45 | fi |
| 46 | if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
| 47 | iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver |
| 48 | else |
| 49 | iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver |
| 50 | fi |
| 51 | AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent" |
| 52 | iniset /$Q_PLUGIN_CONF_FILE agent tunnel_types $Q_TUNNEL_TYPES |
| 53 | # Define extra "AGENT" configuration options when q-agt is configured by defining |
| 54 | # the array ``Q_AGENT_EXTRA_AGENT_OPTS``. |
| 55 | # For Example: ``Q_AGENT_EXTRA_AGENT_OPTS=(foo=true bar=2)`` |
| 56 | for I in "${Q_AGENT_EXTRA_AGENT_OPTS[@]}"; do |
| 57 | # Replace the first '=' with ' ' for iniset syntax |
| 58 | iniset /$Q_PLUGIN_CONF_FILE agent ${I/=/ } |
| 59 | done |
| 60 | # Define extra "LINUX_BRIDGE" configuration options when q-agt is configured by defining |
| 61 | # the array ``Q_AGENT_EXTRA_SRV_OPTS``. |
| 62 | # For Example: ``Q_AGENT_EXTRA_SRV_OPTS=(foo=true bar=2)`` |
| 63 | for I in "${Q_AGENT_EXTRA_SRV_OPTS[@]}"; do |
| 64 | # Replace the first '=' with ' ' for iniset syntax |
| 65 | iniset /$Q_PLUGIN_CONF_FILE linux_bridge ${I/=/ } |
| 66 | done |
| 67 | } |
| 68 | |
| 69 | function neutron_plugin_setup_interface_driver { |
| 70 | local conf_file=$1 |
| 71 | iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver |
| 72 | } |
| 73 | |
| 74 | function neutron_plugin_check_adv_test_requirements { |
| 75 | is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
| 76 | } |
| 77 | |
| 78 | # Restore xtrace |
| 79 | $PLUGIN_XTRACE |