blob: 67d0405c23aef0b0624d36388efecd366ee32a93 [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 {
11 sudo brctl delbr $PUBLIC_BRIDGE
Hirofumi Ichihara5c0546e2015-06-26 17:43:28 +090012
13 if [[ "$Q_ML2_TENANT_NETWORK_TYPE" = "vxlan" ]]; then
14 for port in $(sudo brctl show | grep -o -e [a-zA-Z\-]*tap[0-9a-f\-]* -e vxlan-[0-9a-f\-]*); do
15 sudo ip link delete $port
16 done
17 elif [[ "$Q_ML2_TENANT_NETWORK_TYPE" = "vlan" ]]; then
18 for port in $(sudo brctl show | grep -o -e [a-zA-Z\-]*tap[0-9a-f\-]* -e ${LB_PHYSICAL_INTERFACE}\.[0-9a-f\-]*); do
19 sudo ip link delete $port
20 done
21 fi
22 for bridge in $(sudo brctl show |grep -o -e brq[0-9a-f\-]*); do
23 sudo ip link set $bridge down
24 sudo brctl delbr $bridge
25 done
Sean M. Collins64d5ecf2015-06-01 14:13:41 -040026}
27
mathieu-rohon50187ee2014-11-21 22:12:40 +010028function is_neutron_ovs_base_plugin {
29 # linuxbridge doesn't use OVS
30 return 1
31}
32
33function neutron_plugin_create_nova_conf {
34 :
35}
36
37function neutron_plugin_install_agent_packages {
38 install_package bridge-utils
39}
40
41function neutron_plugin_configure_debug_command {
42 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge
43}
44
45function neutron_plugin_configure_dhcp_agent {
Sean M. Collins2a242512016-05-03 09:03:09 -040046 local conf_file=$1
Armando Migliaccio14b12a72016-08-12 19:07:12 -070047 :
mathieu-rohon50187ee2014-11-21 22:12:40 +010048}
49
50function neutron_plugin_configure_l3_agent {
Sean M. Collins2a242512016-05-03 09:03:09 -040051 local conf_file=$1
Sean M. Collins64d5ecf2015-06-01 14:13:41 -040052 sudo brctl addbr $PUBLIC_BRIDGE
Sean M. Collins2a242512016-05-03 09:03:09 -040053 iniset $conf_file DEFAULT external_network_bridge
mathieu-rohon50187ee2014-11-21 22:12:40 +010054}
55
56function neutron_plugin_configure_plugin_agent {
57 # Setup physical network interface mappings. Override
58 # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more
59 # complex physical network configurations.
60 if [[ "$LB_INTERFACE_MAPPINGS" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then
61 LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE
62 fi
63 if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then
64 iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS
65 fi
66 if [[ "$Q_USE_SECGROUP" == "True" ]]; then
67 iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
68 else
69 iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver
70 fi
71 AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent"
72 iniset /$Q_PLUGIN_CONF_FILE agent tunnel_types $Q_TUNNEL_TYPES
Nickc295bca2015-08-04 09:28:19 +080073
74 # Configure vxlan tunneling
75 if [[ "$ENABLE_TENANT_TUNNELS" == "True" ]]; then
76 if [[ "$Q_ML2_TENANT_NETWORK_TYPE" == "vxlan" ]]; then
77 iniset /$Q_PLUGIN_CONF_FILE vxlan enable_vxlan "True"
78 iniset /$Q_PLUGIN_CONF_FILE vxlan local_ip $TUNNEL_ENDPOINT_IP
79 else
80 iniset /$Q_PLUGIN_CONF_FILE vxlan enable_vxlan "False"
81 fi
82 else
83 iniset /$Q_PLUGIN_CONF_FILE vxlan enable_vxlan "False"
84 fi
mathieu-rohon50187ee2014-11-21 22:12:40 +010085}
86
87function neutron_plugin_setup_interface_driver {
88 local conf_file=$1
Martin Hickeydca49de2015-10-20 12:13:19 +010089 iniset $conf_file DEFAULT interface_driver linuxbridge
mathieu-rohon50187ee2014-11-21 22:12:40 +010090}
91
92function neutron_plugin_check_adv_test_requirements {
93 is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
94}
95
96# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +110097$_XTRACE_NEUTRON_LB