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