Sean Dague | e263c82 | 2014-12-05 14:25:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 3 | # Neutron Open vSwitch L2 agent |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 4 | # ----------------------------- |
| 5 | |
| 6 | # Save trace setting |
Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 7 | _XTRACE_NEUTRON_OVSL2=$(set +o | grep xtrace) |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 8 | set +o xtrace |
| 9 | |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 10 | source $TOP_DIR/lib/neutron_plugins/ovs_base |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 11 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 12 | function neutron_plugin_create_nova_conf { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 13 | _neutron_ovs_base_configure_nova_vif_driver |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 14 | } |
| 15 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 16 | function neutron_plugin_install_agent_packages { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 17 | _neutron_ovs_base_install_agent_packages |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 18 | } |
| 19 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 20 | function neutron_plugin_configure_dhcp_agent { |
Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 21 | local conf_file=$1 |
Armando Migliaccio | 14b12a7 | 2016-08-12 19:07:12 -0700 | [diff] [blame] | 22 | : |
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_l3_agent { |
Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 26 | local conf_file=$1 |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 27 | _neutron_ovs_base_configure_l3_agent |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 28 | } |
| 29 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 30 | function neutron_plugin_configure_plugin_agent { |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 31 | # Setup integration bridge |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 32 | _neutron_ovs_base_setup_bridge $OVS_BRIDGE |
| 33 | _neutron_ovs_base_configure_firewall_driver |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 34 | |
| 35 | # Setup agent for tunneling |
Kyle Mestery | bd08550 | 2014-04-30 23:50:29 +0000 | [diff] [blame] | 36 | if [[ "$OVS_ENABLE_TUNNELING" == "True" ]]; then |
Edgar Magana | 6f335b9 | 2014-07-10 15:42:44 -0700 | [diff] [blame] | 37 | iniset /$Q_PLUGIN_CONF_FILE ovs local_ip $TUNNEL_ENDPOINT_IP |
Hirofumi Ichihara | d48d672 | 2015-07-04 22:58:44 +0900 | [diff] [blame] | 38 | iniset /$Q_PLUGIN_CONF_FILE ovs tunnel_bridge $OVS_TUNNEL_BRIDGE |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 39 | fi |
| 40 | |
| 41 | # Setup physical network bridge mappings. Override |
| 42 | # ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` for more |
| 43 | # complex physical network configurations. |
Lenny Verkhovsky | d6a7b73 | 2019-11-12 15:54:32 +0200 | [diff] [blame] | 44 | if [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then |
| 45 | if [[ "$OVS_BRIDGE_MAPPINGS" == "" ]]; then |
| 46 | OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE |
| 47 | fi |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 48 | |
Sean M. Collins | 54d16f7 | 2016-03-15 15:18:14 -0400 | [diff] [blame] | 49 | # Configure bridge manually with physical interface as port for multi-node |
| 50 | _neutron_ovs_base_add_bridge $OVS_PHYSICAL_BRIDGE |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 51 | fi |
| 52 | if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then |
Gary Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame] | 53 | iniset /$Q_PLUGIN_CONF_FILE ovs bridge_mappings $OVS_BRIDGE_MAPPINGS |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 54 | fi |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 55 | AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-openvswitch-agent" |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 56 | |
Akihiro Motoki | 2307f9d | 2014-08-09 18:58:20 +0900 | [diff] [blame] | 57 | iniset /$Q_PLUGIN_CONF_FILE agent tunnel_types $Q_TUNNEL_TYPES |
Michal Ptacek | c160555 | 2015-09-23 21:02:02 +0100 | [diff] [blame] | 58 | iniset /$Q_PLUGIN_CONF_FILE ovs datapath_type $OVS_DATAPATH_TYPE |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 59 | } |
| 60 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 61 | function neutron_plugin_setup_interface_driver { |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 62 | local conf_file=$1 |
Martin Hickey | dca49de | 2015-10-20 12:13:19 +0100 | [diff] [blame] | 63 | iniset $conf_file DEFAULT interface_driver openvswitch |
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_check_adv_test_requirements { |
Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 67 | is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
| 68 | } |
| 69 | |
| 70 | # Restore xtrace |
Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 71 | $_XTRACE_NEUTRON_OVSL2 |