Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1 | # Neutron Linux Bridge L2 agent |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 2 | # ----------------------------- |
| 3 | |
| 4 | # Save trace setting |
| 5 | PLUGIN_XTRACE=$(set +o | grep xtrace) |
| 6 | set +o xtrace |
| 7 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame^] | 8 | function is_neutron_ovs_base_plugin { |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 9 | # linuxbridge doesn't use OVS |
| 10 | return 1 |
| 11 | } |
| 12 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame^] | 13 | function neutron_plugin_create_nova_conf { |
Aaron Rosen | 4540d00 | 2013-10-24 13:59:33 -0700 | [diff] [blame] | 14 | : |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 15 | } |
| 16 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame^] | 17 | function neutron_plugin_install_agent_packages { |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 18 | install_package bridge-utils |
| 19 | } |
| 20 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame^] | 21 | function neutron_plugin_configure_debug_command { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 22 | iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 23 | } |
| 24 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame^] | 25 | function neutron_plugin_configure_dhcp_agent { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 26 | iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 27 | } |
| 28 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame^] | 29 | function neutron_plugin_configure_l3_agent { |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 30 | iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 31 | iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 32 | } |
| 33 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame^] | 34 | function neutron_plugin_configure_plugin_agent { |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 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 |
Gary Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame] | 42 | iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 43 | fi |
| 44 | if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 45 | iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 46 | else |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 47 | iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 48 | fi |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 49 | AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent" |
Kyle Mestery | ebfac64 | 2013-05-17 15:20:56 -0500 | [diff] [blame] | 50 | # Define extra "AGENT" configuration options when q-agt is configured by defining |
| 51 | # the array ``Q_AGENT_EXTRA_AGENT_OPTS``. |
| 52 | # For Example: ``Q_AGENT_EXTRA_AGENT_OPTS=(foo=true bar=2)`` |
| 53 | for I in "${Q_AGENT_EXTRA_AGENT_OPTS[@]}"; do |
| 54 | # Replace the first '=' with ' ' for iniset syntax |
Gary Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame] | 55 | iniset /$Q_PLUGIN_CONF_FILE agent ${I/=/ } |
Kyle Mestery | ebfac64 | 2013-05-17 15:20:56 -0500 | [diff] [blame] | 56 | done |
| 57 | # Define extra "LINUX_BRIDGE" configuration options when q-agt is configured by defining |
| 58 | # the array ``Q_AGENT_EXTRA_SRV_OPTS``. |
| 59 | # For Example: ``Q_AGENT_EXTRA_SRV_OPTS=(foo=true bar=2)`` |
| 60 | for I in "${Q_AGENT_EXTRA_SRV_OPTS[@]}"; do |
| 61 | # Replace the first '=' with ' ' for iniset syntax |
Gary Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame] | 62 | iniset /$Q_PLUGIN_CONF_FILE linux_bridge ${I/=/ } |
Kyle Mestery | ebfac64 | 2013-05-17 15:20:56 -0500 | [diff] [blame] | 63 | done |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 64 | } |
| 65 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame^] | 66 | function neutron_plugin_setup_interface_driver { |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 67 | local conf_file=$1 |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 68 | iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 69 | } |
| 70 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame^] | 71 | function neutron_plugin_check_adv_test_requirements { |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 72 | is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
| 73 | } |
| 74 | |
| 75 | # Restore xtrace |
| 76 | $PLUGIN_XTRACE |