blob: 588561695160ca9ecddc5090989a8c007952e988 [file] [log] [blame]
Sean Daguee263c822014-12-05 14:25:28 -05001#!/bin/bash
2#
mathieu-rohon50187ee2014-11-21 22:12:40 +01003# Neutron Linux Bridge L2 agent
4# -----------------------------
5
6# Save trace setting
Ian Wienand523f4882015-10-13 11:03:03 +11007_XTRACE_NEUTRON_LB=$(set +o | grep xtrace)
mathieu-rohon50187ee2014-11-21 22:12:40 +01008set +o xtrace
9
Sean M. Collins64d5ecf2015-06-01 14:13:41 -040010function neutron_lb_cleanup {
Hirofumi Ichihara40aae6a2017-02-08 00:08:53 +090011 sudo ip link set $PUBLIC_BRIDGE down
Sean M. Collins64d5ecf2015-06-01 14:13:41 -040012 sudo brctl delbr $PUBLIC_BRIDGE
Hirofumi Ichihara5c0546e2015-06-26 17:43:28 +090013
14 if [[ "$Q_ML2_TENANT_NETWORK_TYPE" = "vxlan" ]]; then
15 for port in $(sudo brctl show | grep -o -e [a-zA-Z\-]*tap[0-9a-f\-]* -e vxlan-[0-9a-f\-]*); do
16 sudo ip link delete $port
17 done
18 elif [[ "$Q_ML2_TENANT_NETWORK_TYPE" = "vlan" ]]; then
19 for port in $(sudo brctl show | grep -o -e [a-zA-Z\-]*tap[0-9a-f\-]* -e ${LB_PHYSICAL_INTERFACE}\.[0-9a-f\-]*); do
20 sudo ip link delete $port
21 done
22 fi
23 for bridge in $(sudo brctl show |grep -o -e brq[0-9a-f\-]*); do
24 sudo ip link set $bridge down
25 sudo brctl delbr $bridge
26 done
Sean M. Collins64d5ecf2015-06-01 14:13:41 -040027}
28
mathieu-rohon50187ee2014-11-21 22:12:40 +010029function is_neutron_ovs_base_plugin {
30 # linuxbridge doesn't use OVS
31 return 1
32}
33
34function neutron_plugin_create_nova_conf {
35 :
36}
37
38function neutron_plugin_install_agent_packages {
39 install_package bridge-utils
40}
41
42function neutron_plugin_configure_debug_command {
43 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge
44}
45
46function neutron_plugin_configure_dhcp_agent {
Sean M. Collins2a242512016-05-03 09:03:09 -040047 local conf_file=$1
Armando Migliaccio14b12a72016-08-12 19:07:12 -070048 :
mathieu-rohon50187ee2014-11-21 22:12:40 +010049}
50
51function neutron_plugin_configure_l3_agent {
Sean M. Collins2a242512016-05-03 09:03:09 -040052 local conf_file=$1
Sean M. Collins64d5ecf2015-06-01 14:13:41 -040053 sudo brctl addbr $PUBLIC_BRIDGE
Ihar Hrachyshka7b5c7dc2016-07-15 20:17:13 +020054 set_mtu $PUBLIC_BRIDGE $PUBLIC_BRIDGE_MTU
Sean M. Collins2a242512016-05-03 09:03:09 -040055 iniset $conf_file DEFAULT external_network_bridge
mathieu-rohon50187ee2014-11-21 22:12:40 +010056}
57
58function neutron_plugin_configure_plugin_agent {
59 # Setup physical network interface mappings. Override
60 # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more
61 # complex physical network configurations.
62 if [[ "$LB_INTERFACE_MAPPINGS" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then
63 LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE
64 fi
Kevin Benton6a42a852016-07-21 11:11:54 -070065 if [[ "$PUBLIC_BRIDGE" != "" ]] && [[ "$PUBLIC_PHYSICAL_NETWORK" != "" ]]; then
Armando Migliaccio1c08b192016-11-29 15:58:53 -080066 if is_service_enabled q-l3 || is_service_enabled neutron-l3; then
67 iniset /$Q_PLUGIN_CONF_FILE linux_bridge bridge_mappings "$PUBLIC_PHYSICAL_NETWORK:$PUBLIC_BRIDGE"
68 fi
Kevin Benton6a42a852016-07-21 11:11:54 -070069 fi
mathieu-rohon50187ee2014-11-21 22:12:40 +010070 if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then
71 iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS
72 fi
73 if [[ "$Q_USE_SECGROUP" == "True" ]]; then
74 iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
Ihar Hrachyshkab3a210f2016-09-29 13:26:30 +000075 enable_kernel_bridge_firewall
mathieu-rohon50187ee2014-11-21 22:12:40 +010076 else
77 iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver
78 fi
79 AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent"
80 iniset /$Q_PLUGIN_CONF_FILE agent tunnel_types $Q_TUNNEL_TYPES
Nickc295bca2015-08-04 09:28:19 +080081
82 # Configure vxlan tunneling
83 if [[ "$ENABLE_TENANT_TUNNELS" == "True" ]]; then
84 if [[ "$Q_ML2_TENANT_NETWORK_TYPE" == "vxlan" ]]; then
85 iniset /$Q_PLUGIN_CONF_FILE vxlan enable_vxlan "True"
86 iniset /$Q_PLUGIN_CONF_FILE vxlan local_ip $TUNNEL_ENDPOINT_IP
87 else
88 iniset /$Q_PLUGIN_CONF_FILE vxlan enable_vxlan "False"
89 fi
90 else
91 iniset /$Q_PLUGIN_CONF_FILE vxlan enable_vxlan "False"
92 fi
mathieu-rohon50187ee2014-11-21 22:12:40 +010093}
94
95function neutron_plugin_setup_interface_driver {
96 local conf_file=$1
Martin Hickeydca49de2015-10-20 12:13:19 +010097 iniset $conf_file DEFAULT interface_driver linuxbridge
mathieu-rohon50187ee2014-11-21 22:12:40 +010098}
99
100function neutron_plugin_check_adv_test_requirements {
101 is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
102}
103
104# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +1100105$_XTRACE_NEUTRON_LB