mathieu-rohon | 50187ee | 2014-11-21 22:12:40 +0100 | [diff] [blame] | 1 | # Neutron Linux Bridge L2 agent |
| 2 | # ----------------------------- |
| 3 | |
| 4 | # Save trace setting |
| 5 | PLUGIN_XTRACE=$(set +o | grep xtrace) |
| 6 | set +o xtrace |
| 7 | |
| 8 | function is_neutron_ovs_base_plugin { |
| 9 | # linuxbridge doesn't use OVS |
| 10 | return 1 |
| 11 | } |
| 12 | |
| 13 | function neutron_plugin_create_nova_conf { |
| 14 | : |
| 15 | } |
| 16 | |
| 17 | function neutron_plugin_install_agent_packages { |
| 18 | install_package bridge-utils |
| 19 | } |
| 20 | |
| 21 | function neutron_plugin_configure_debug_command { |
| 22 | iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge |
| 23 | } |
| 24 | |
| 25 | function neutron_plugin_configure_dhcp_agent { |
| 26 | iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport |
| 27 | } |
| 28 | |
| 29 | function neutron_plugin_configure_l3_agent { |
| 30 | iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge |
| 31 | iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport |
| 32 | } |
| 33 | |
| 34 | function neutron_plugin_configure_plugin_agent { |
| 35 | # 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 |
| 42 | iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS |
| 43 | fi |
| 44 | if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
| 45 | iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver |
| 46 | else |
| 47 | iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver |
| 48 | fi |
| 49 | AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent" |
| 50 | iniset /$Q_PLUGIN_CONF_FILE agent tunnel_types $Q_TUNNEL_TYPES |
| 51 | # 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 |
| 56 | iniset /$Q_PLUGIN_CONF_FILE agent ${I/=/ } |
| 57 | 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 |
| 63 | iniset /$Q_PLUGIN_CONF_FILE linux_bridge ${I/=/ } |
| 64 | done |
| 65 | } |
| 66 | |
| 67 | function neutron_plugin_setup_interface_driver { |
| 68 | local conf_file=$1 |
| 69 | iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver |
| 70 | } |
| 71 | |
| 72 | function neutron_plugin_check_adv_test_requirements { |
| 73 | is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
| 74 | } |
| 75 | |
| 76 | # Restore xtrace |
| 77 | $PLUGIN_XTRACE |