blob: bd3b6d69883d7dcf08487feaec79a3eb15386202 [file] [log] [blame]
Mark McClainb05c8762013-07-06 23:29:39 -04001# lib/neutron
Joe Gordon23946052014-01-15 21:42:32 +00002# functions - functions specific to neutron
Mark McClainb05c8762013-07-06 23:29:39 -04003
4# Dependencies:
5# ``functions`` file
6# ``DEST`` must be defined
Stephan Renatuse578eff2013-11-19 13:31:04 +01007# ``STACK_USER`` must be defined
Mark McClainb05c8762013-07-06 23:29:39 -04008
9# ``stack.sh`` calls the entry points in this order:
10#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010011# - install_neutron
12# - install_neutronclient
13# - install_neutron_agent_packages
14# - install_neutron_third_party
15# - configure_neutron
16# - init_neutron
17# - configure_neutron_third_party
18# - init_neutron_third_party
19# - start_neutron_third_party
Emilien Macchia677b7f2013-11-25 23:40:20 +010020# - create_neutron_cache_dir
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010021# - create_nova_conf_neutron
22# - start_neutron_service_and_check
23# - create_neutron_initial_network
24# - setup_neutron_debug
25# - start_neutron_agents
Mark McClainb05c8762013-07-06 23:29:39 -040026#
27# ``unstack.sh`` calls the entry points in this order:
28#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010029# - stop_neutron
Mark McClainb05c8762013-07-06 23:29:39 -040030
31# Functions in lib/neutron are classified into the following categories:
32#
33# - entry points (called from stack.sh or unstack.sh)
34# - internal functions
35# - neutron exercises
36# - 3rd party programs
37
38
39# Neutron Networking
40# ------------------
41
42# Make sure that neutron is enabled in ``ENABLED_SERVICES``. If you want
43# to run Neutron on this host, make sure that q-svc is also in
44# ``ENABLED_SERVICES``.
45#
46# If you're planning to use the Neutron openvswitch plugin, set
47# ``Q_PLUGIN`` to "openvswitch" and make sure the q-agt service is enabled
48# in ``ENABLED_SERVICES``. If you're planning to use the Neutron
49# linuxbridge plugin, set ``Q_PLUGIN`` to "linuxbridge" and make sure the
50# q-agt service is enabled in ``ENABLED_SERVICES``.
51#
52# See "Neutron Network Configuration" below for additional variables
53# that must be set in localrc for connectivity across hosts with
54# Neutron.
55#
56# With Neutron networking the NETWORK_MANAGER variable is ignored.
57#
58# To enable specific configuration options for either the Open vSwitch or
59# LinuxBridge plugin, please see the top level README file under the
60# Neutron section.
61
Mark McClainb05c8762013-07-06 23:29:39 -040062
63# Neutron Network Configuration
64# -----------------------------
65
66# Gateway and subnet defaults, in case they are not customized in localrc
67NETWORK_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1}
Salvatore Orlando90234ac2013-11-25 05:44:10 -080068PUBLIC_NETWORK_GATEWAY=${PUBLIC_NETWORK_GATEWAY:-172.24.4.1}
Mark McClainb05c8762013-07-06 23:29:39 -040069PRIVATE_SUBNET_NAME=${PRIVATE_SUBNET_NAME:-"private-subnet"}
70PUBLIC_SUBNET_NAME=${PUBLIC_SUBNET_NAME:-"public-subnet"}
71
72# Set up default directories
73NEUTRON_DIR=$DEST/neutron
74NEUTRONCLIENT_DIR=$DEST/python-neutronclient
75NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron}
76
77# Support entry points installation of console scripts
78if [[ -d $NEUTRON_DIR/bin/neutron-server ]]; then
79 NEUTRON_BIN_DIR=$NEUTRON_DIR/bin
Sean Dague3bdb9222013-10-22 08:36:16 -040080else
81 NEUTRON_BIN_DIR=$(get_python_exec_prefix)
Mark McClainb05c8762013-07-06 23:29:39 -040082fi
83
84NEUTRON_CONF_DIR=/etc/neutron
85NEUTRON_CONF=$NEUTRON_CONF_DIR/neutron.conf
86export NEUTRON_TEST_CONFIG_FILE=${NEUTRON_TEST_CONFIG_FILE:-"$NEUTRON_CONF_DIR/debug.ini"}
87
Adam Gandelman7614d212014-08-11 14:27:50 -070088# Agent binaries. Note, binary paths for other agents are set in per-service
89# scripts in lib/neutron_plugins/services/
90AGENT_DHCP_BINARY="$NEUTRON_BIN_DIR/neutron-dhcp-agent"
91AGENT_L3_BINARY=${AGENT_L3_BINARY:-"$NEUTRON_BIN_DIR/neutron-l3-agent"}
92AGENT_META_BINARY="$NEUTRON_BIN_DIR/neutron-metadata-agent"
93
94# Agent config files. Note, plugin-specific Q_PLUGIN_CONF_FILE is set and
95# loaded from per-plugin scripts in lib/neutron_plugins/
96Q_DHCP_CONF_FILE=$NEUTRON_CONF_DIR/dhcp_agent.ini
97Q_L3_CONF_FILE=$NEUTRON_CONF_DIR/l3_agent.ini
98Q_FWAAS_CONF_FILE=$NEUTRON_CONF_DIR/fwaas_driver.ini
99Q_VPN_CONF_FILE=$NEUTRON_CONF_DIR/vpn_agent.ini
100Q_META_CONF_FILE=$NEUTRON_CONF_DIR/metadata_agent.ini
101
Henry Gessau0fc1cc22014-07-06 22:54:34 -0400102# Default name for Neutron database
103Q_DB_NAME=${Q_DB_NAME:-neutron}
Mark McClainb05c8762013-07-06 23:29:39 -0400104# Default Neutron Plugin
Kyle Mestery6d235002013-09-18 20:27:08 +0000105Q_PLUGIN=${Q_PLUGIN:-ml2}
Mark McClainb05c8762013-07-06 23:29:39 -0400106# Default Neutron Port
107Q_PORT=${Q_PORT:-9696}
108# Default Neutron Host
109Q_HOST=${Q_HOST:-$SERVICE_HOST}
110# Default admin username
111Q_ADMIN_USERNAME=${Q_ADMIN_USERNAME:-neutron}
112# Default auth strategy
113Q_AUTH_STRATEGY=${Q_AUTH_STRATEGY:-keystone}
114# Use namespace or not
115Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True}
116# RHEL's support for namespaces requires using veths with ovs
117Q_OVS_USE_VETH=${Q_OVS_USE_VETH:-False}
118Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True}
119# Meta data IP
120Q_META_DATA_IP=${Q_META_DATA_IP:-$SERVICE_HOST}
121# Allow Overlapping IP among subnets
122Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-True}
123# Use neutron-debug command
124Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False}
125# The name of the default q-l3 router
126Q_ROUTER_NAME=${Q_ROUTER_NAME:-router1}
Aaron Rosen4540d002013-10-24 13:59:33 -0700127# nova vif driver that all plugins should use
128NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"}
Terry Wilsonf06c4432014-05-20 10:54:51 -0500129Q_NOTIFY_NOVA_PORT_STATUS_CHANGES=${Q_NOTIFY_NOVA_PORT_STATUS_CHANGES:-True}
130Q_NOTIFY_NOVA_PORT_DATA_CHANGES=${Q_NOTIFY_NOVA_PORT_DATA_CHANGES:-True}
Aaron Rosencea32b12014-03-04 16:20:14 -0800131VIF_PLUGGING_IS_FATAL=${VIF_PLUGGING_IS_FATAL:-True}
132VIF_PLUGGING_TIMEOUT=${VIF_PLUGGING_TIMEOUT:-300}
Aaron Rosen4540d002013-10-24 13:59:33 -0700133
Sean M. Collins5ec6f8f2014-05-14 17:01:03 -0400134## Provider Network Information
135PROVIDER_SUBNET_NAME=${PROVIDER_SUBNET_NAME:-"provider_net"}
136
YAMAMOTO Takashi6a633fd2014-07-23 12:02:18 +0900137# Use flat providernet for public network
138#
139# If Q_USE_PROVIDERNET_FOR_PUBLIC=True, use a flat provider network
140# for external interface of neutron l3-agent. In that case,
141# PUBLIC_PHYSICAL_NETWORK specifies provider:physical_network value
142# used for the network. In case of openvswitch agent, you should
143# add the corresponding entry to your OVS_BRIDGE_MAPPINGS.
144#
145# eg.
146# Q_USE_PROVIDERNET_FOR_PUBLIC=True
147# PUBLIC_PHYSICAL_NETWORK=public
148# OVS_BRIDGE_MAPPINGS=public:br-ex
149Q_USE_PROVIDERNET_FOR_PUBLIC=${Q_USE_PROVIDERNET_FOR_PUBLIC:-False}
150PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK:-public}
151
Tomoe Sugiharaafbc6312013-11-14 20:02:47 +0000152# The next two variables are configured by plugin
153# e.g. _configure_neutron_l3_agent or lib/neutron_plugins/*
154#
155# The plugin supports L3.
156Q_L3_ENABLED=${Q_L3_ENABLED:-False}
157# L3 routers exist per tenant
158Q_L3_ROUTER_PER_TENANT=${Q_L3_ROUTER_PER_TENANT:-False}
Aaron Rosen4540d002013-10-24 13:59:33 -0700159
Mark McClainb05c8762013-07-06 23:29:39 -0400160# List of config file names in addition to the main plugin config file
161# See _configure_neutron_common() for details about setting it up
162declare -a Q_PLUGIN_EXTRA_CONF_FILES
163
Paul Michali746dcee2014-04-02 19:12:22 +0000164# List of (optional) config files for VPN device drivers to use with
165# the neutron-q-vpn agent
166declare -a Q_VPN_EXTRA_CONF_FILES
167
Mark McClainb05c8762013-07-06 23:29:39 -0400168
Dean Troyere2907b42014-02-26 17:35:37 -0600169Q_RR_CONF_FILE=$NEUTRON_CONF_DIR/rootwrap.conf
170if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
171 Q_RR_COMMAND="sudo"
172else
173 NEUTRON_ROOTWRAP=$(get_rootwrap_location neutron)
174 Q_RR_COMMAND="sudo $NEUTRON_ROOTWRAP $Q_RR_CONF_FILE"
Mark McClainb05c8762013-07-06 23:29:39 -0400175fi
176
Brian Haleyeea76212014-06-27 11:45:50 -0400177
178# Distributed Virtual Router (DVR) configuration
179# Can be:
Dean Troyer3324f192014-09-18 09:26:39 -0500180# - ``legacy`` - No DVR functionality
181# - ``dvr_snat`` - Controller or single node DVR
182# - ``dvr`` - Compute node in multi-node DVR
183#
Brian Haleyeea76212014-06-27 11:45:50 -0400184Q_DVR_MODE=${Q_DVR_MODE:-legacy}
185if [[ "$Q_DVR_MODE" != "legacy" ]]; then
186 Q_ML2_PLUGIN_MECHANISM_DRIVERS=openvswitch,linuxbridge,l2population
187fi
188
Dean Troyere2907b42014-02-26 17:35:37 -0600189# Provider Network Configurations
190# --------------------------------
191
192# The following variables control the Neutron openvswitch and
193# linuxbridge plugins' allocation of tenant networks and
194# availability of provider networks. If these are not configured
195# in ``localrc``, tenant networks will be local to the host (with no
196# remote connectivity), and no physical resources will be
197# available for the allocation of provider networks.
198
Attila Fazekas8feaf6c2014-07-27 20:47:04 +0200199# To disable tunnels (GRE or VXLAN) for tenant networks,
200# set to False in ``local.conf``.
201# GRE tunnels are only supported by the openvswitch.
202ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-True}
Dean Troyere2907b42014-02-26 17:35:37 -0600203
204# If using GRE tunnels for tenant networks, specify the range of
205# tunnel IDs from which tenant networks are allocated. Can be
206# overriden in ``localrc`` in necesssary.
Anant Patil3827dc02014-07-03 21:38:16 +0530207TENANT_TUNNEL_RANGES=${TENANT_TUNNEL_RANGES:-1:1000}
Dean Troyere2907b42014-02-26 17:35:37 -0600208
209# To use VLANs for tenant networks, set to True in localrc. VLANs
210# are supported by the openvswitch and linuxbridge plugins, each
211# requiring additional configuration described below.
212ENABLE_TENANT_VLANS=${ENABLE_TENANT_VLANS:-False}
213
214# If using VLANs for tenant networks, set in ``localrc`` to specify
215# the range of VLAN VIDs from which tenant networks are
216# allocated. An external network switch must be configured to
217# trunk these VLANs between hosts for multi-host connectivity.
218#
219# Example: ``TENANT_VLAN_RANGE=1000:1999``
220TENANT_VLAN_RANGE=${TENANT_VLAN_RANGE:-}
221
222# If using VLANs for tenant networks, or if using flat or VLAN
223# provider networks, set in ``localrc`` to the name of the physical
224# network, and also configure ``OVS_PHYSICAL_BRIDGE`` for the
225# openvswitch agent or ``LB_PHYSICAL_INTERFACE`` for the linuxbridge
226# agent, as described below.
227#
228# Example: ``PHYSICAL_NETWORK=default``
229PHYSICAL_NETWORK=${PHYSICAL_NETWORK:-}
230
231# With the openvswitch plugin, if using VLANs for tenant networks,
232# or if using flat or VLAN provider networks, set in ``localrc`` to
233# the name of the OVS bridge to use for the physical network. The
234# bridge will be created if it does not already exist, but a
235# physical interface must be manually added to the bridge as a
236# port for external connectivity.
237#
238# Example: ``OVS_PHYSICAL_BRIDGE=br-eth1``
239OVS_PHYSICAL_BRIDGE=${OVS_PHYSICAL_BRIDGE:-}
240
241# With the linuxbridge plugin, if using VLANs for tenant networks,
242# or if using flat or VLAN provider networks, set in ``localrc`` to
243# the name of the network interface to use for the physical
244# network.
245#
246# Example: ``LB_PHYSICAL_INTERFACE=eth1``
247LB_PHYSICAL_INTERFACE=${LB_PHYSICAL_INTERFACE:-}
248
Edgar Magana6f335b92014-07-10 15:42:44 -0700249# When Neutron tunnels are enabled it is needed to specify the
250# IP address of the end point in the local server. This IP is set
251# by default to the same IP address that the HOST IP.
252# This variable can be used to specify a different end point IP address
253# Example: ``TUNNEL_ENDPOINT_IP=1.1.1.1``
254TUNNEL_ENDPOINT_IP=${TUNNEL_ENDPOINT_IP:-$HOST_IP}
255
Dean Troyere2907b42014-02-26 17:35:37 -0600256# With the openvswitch plugin, set to True in ``localrc`` to enable
257# provider GRE tunnels when ``ENABLE_TENANT_TUNNELS`` is False.
258#
259# Example: ``OVS_ENABLE_TUNNELING=True``
260OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS}
261
Mark McClainb05c8762013-07-06 23:29:39 -0400262# Neutron plugin specific functions
263# ---------------------------------
264
265# Please refer to ``lib/neutron_plugins/README.md`` for details.
266source $TOP_DIR/lib/neutron_plugins/$Q_PLUGIN
267
268# Agent loadbalancer service plugin functions
269# -------------------------------------------
270
271# Hardcoding for 1 service plugin for now
272source $TOP_DIR/lib/neutron_plugins/services/loadbalancer
273
Emilien Macchi40546f72013-09-24 15:10:25 +0200274# Agent metering service plugin functions
275# -------------------------------------------
276
277# Hardcoding for 1 service plugin for now
278source $TOP_DIR/lib/neutron_plugins/services/metering
279
Nachi Ueno69b3ff62013-06-07 10:28:33 -0700280# VPN service plugin functions
281# -------------------------------------------
282# Hardcoding for 1 service plugin for now
283source $TOP_DIR/lib/neutron_plugins/services/vpn
284
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700285# Firewall Service Plugin functions
Adam Spierscb961592013-10-05 12:11:07 +0100286# ---------------------------------
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700287source $TOP_DIR/lib/neutron_plugins/services/firewall
288
Mark McClainb05c8762013-07-06 23:29:39 -0400289# Use security group or not
290if has_neutron_plugin_security_group; then
291 Q_USE_SECGROUP=${Q_USE_SECGROUP:-True}
292else
293 Q_USE_SECGROUP=False
294fi
295
Dean Troyer4237f592014-01-29 16:22:11 -0600296# Tell Tempest this project is present
297TEMPEST_SERVICES+=,neutron
298
299
Dean Troyere2907b42014-02-26 17:35:37 -0600300# Save trace setting
301XTRACE=$(set +o | grep xtrace)
302set +o xtrace
303
304
Mark McClainb05c8762013-07-06 23:29:39 -0400305# Functions
306# ---------
307
Adam Gandelman7614d212014-08-11 14:27:50 -0700308function _determine_config_server {
309 local cfg_file
310 local opts="--config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE"
311 for cfg_file in ${Q_PLUGIN_EXTRA_CONF_FILES[@]}; do
312 opts+=" --config-file /$cfg_file"
313 done
314 echo "$opts"
315}
316
317function _determine_config_vpn {
318 local cfg_file
319 local opts="--config-file $NEUTRON_CONF --config-file=$Q_L3_CONF_FILE --config-file=$Q_VPN_CONF_FILE"
320 if is_service_enabled q-fwaas; then
321 opts+=" --config-file $Q_FWAAS_CONF_FILE"
322 fi
323 for cfg_file in ${Q_VPN_EXTRA_CONF_FILES[@]}; do
324 opts+=" --config-file $cfg_file"
325 done
326 echo "$opts"
327
328}
329
330function _determine_config_l3 {
331 local opts="--config-file $NEUTRON_CONF --config-file=$Q_L3_CONF_FILE"
332 if is_service_enabled q-fwaas; then
333 opts+=" --config-file $Q_FWAAS_CONF_FILE"
334 fi
335 echo "$opts"
336}
337
338# For services and agents that require it, dynamically construct a list of
339# --config-file arguments that are passed to the binary.
340function determine_config_files {
341 local opts=""
342 case "$1" in
343 "neutron-server") opts="$(_determine_config_server)" ;;
344 "neutron-vpn-agent") opts="$(_determine_config_vpn)" ;;
345 "neutron-l3-agent") opts="$(_determine_config_l3)" ;;
346 esac
347 if [ -z "$opts" ] ; then
348 die $LINENO "Could not determine config files for $1."
349 fi
350 echo "$opts"
351}
352
Dean Troyere4fa7212014-01-15 15:04:49 -0600353# Test if any Neutron services are enabled
354# is_neutron_enabled
355function is_neutron_enabled {
356 [[ ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0
357 return 1
358}
359
Mark McClainb05c8762013-07-06 23:29:39 -0400360# configure_neutron()
361# Set common config for all neutron server and agents.
Ian Wienandaee18c72014-02-21 15:35:08 +1100362function configure_neutron {
Mark McClainb05c8762013-07-06 23:29:39 -0400363 _configure_neutron_common
364 iniset_rpc_backend neutron $NEUTRON_CONF DEFAULT
365
366 # goes before q-svc to init Q_SERVICE_PLUGIN_CLASSES
367 if is_service_enabled q-lbaas; then
368 _configure_neutron_lbaas
369 fi
Emilien Macchi40546f72013-09-24 15:10:25 +0200370 if is_service_enabled q-metering; then
371 _configure_neutron_metering
372 fi
Nachi Ueno69b3ff62013-06-07 10:28:33 -0700373 if is_service_enabled q-vpn; then
374 _configure_neutron_vpn
375 fi
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700376 if is_service_enabled q-fwaas; then
377 _configure_neutron_fwaas
378 fi
Stephen Ma9b38eb22014-04-02 02:13:09 +0000379 if is_service_enabled q-agt q-svc; then
Mark McClainb05c8762013-07-06 23:29:39 -0400380 _configure_neutron_service
381 fi
382 if is_service_enabled q-agt; then
383 _configure_neutron_plugin_agent
384 fi
385 if is_service_enabled q-dhcp; then
386 _configure_neutron_dhcp_agent
387 fi
388 if is_service_enabled q-l3; then
389 _configure_neutron_l3_agent
390 fi
391 if is_service_enabled q-meta; then
392 _configure_neutron_metadata_agent
393 fi
394
Brian Haleyeea76212014-06-27 11:45:50 -0400395 if [[ "$Q_DVR_MODE" != "legacy" ]]; then
396 _configure_dvr
397 fi
Dina Belova58adaa62014-07-11 18:18:12 +0400398 if is_service_enabled ceilometer; then
399 _configure_neutron_ceilometer_notifications
400 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400401
402 _configure_neutron_debug_command
403}
404
Ian Wienandaee18c72014-02-21 15:35:08 +1100405function create_nova_conf_neutron {
Yong Sheng Gong032e4542013-08-25 10:21:10 +0800406 iniset $NOVA_CONF DEFAULT network_api_class "nova.network.neutronv2.api.API"
Gary Kotton13d385e2014-06-17 23:24:53 -0700407 iniset $NOVA_CONF neutron admin_username "$Q_ADMIN_USERNAME"
408 iniset $NOVA_CONF neutron admin_password "$SERVICE_PASSWORD"
409 iniset $NOVA_CONF neutron admin_auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0"
410 iniset $NOVA_CONF neutron auth_strategy "$Q_AUTH_STRATEGY"
411 iniset $NOVA_CONF neutron admin_tenant_name "$SERVICE_TENANT_NAME"
Bartosz Górski0abde392014-02-28 14:15:19 +0100412 iniset $NOVA_CONF neutron region_name "$REGION_NAME"
Gary Kotton13d385e2014-06-17 23:24:53 -0700413 iniset $NOVA_CONF neutron url "http://$Q_HOST:$Q_PORT"
Mark McClainb05c8762013-07-06 23:29:39 -0400414
415 if [[ "$Q_USE_SECGROUP" == "True" ]]; then
416 LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver
Jeff Peeler1143f7e2013-10-31 16:21:52 -0400417 iniset $NOVA_CONF DEFAULT firewall_driver $LIBVIRT_FIREWALL_DRIVER
Yong Sheng Gong032e4542013-08-25 10:21:10 +0800418 iniset $NOVA_CONF DEFAULT security_group_api neutron
Mark McClainb05c8762013-07-06 23:29:39 -0400419 fi
420
421 # set NOVA_VIF_DRIVER and optionally set options in nova_conf
422 neutron_plugin_create_nova_conf
423
Gary Kotton51c681d2014-04-22 01:40:56 -0700424 iniset $NOVA_CONF libvirt vif_driver "$NOVA_VIF_DRIVER"
Mark McClainb05c8762013-07-06 23:29:39 -0400425 iniset $NOVA_CONF DEFAULT linuxnet_interface_driver "$LINUXNET_VIF_DRIVER"
426 if is_service_enabled q-meta; then
Gary Kottondd745502014-08-11 23:38:47 -0700427 iniset $NOVA_CONF neutron service_metadata_proxy "True"
Mark McClainb05c8762013-07-06 23:29:39 -0400428 fi
Aaron Rosencea32b12014-03-04 16:20:14 -0800429
430 iniset $NOVA_CONF DEFAULT vif_plugging_is_fatal "$VIF_PLUGGING_IS_FATAL"
431 iniset $NOVA_CONF DEFAULT vif_plugging_timeout "$VIF_PLUGGING_TIMEOUT"
Mark McClainb05c8762013-07-06 23:29:39 -0400432}
433
Emilien Macchia677b7f2013-11-25 23:40:20 +0100434# create_neutron_cache_dir() - Part of the _neutron_setup_keystone() process
Ian Wienandaee18c72014-02-21 15:35:08 +1100435function create_neutron_cache_dir {
Emilien Macchia677b7f2013-11-25 23:40:20 +0100436 # Create cache dir
437 sudo mkdir -p $NEUTRON_AUTH_CACHE_DIR
438 sudo chown $STACK_USER $NEUTRON_AUTH_CACHE_DIR
439 rm -f $NEUTRON_AUTH_CACHE_DIR/*
440}
441
Mark McClainb05c8762013-07-06 23:29:39 -0400442# create_neutron_accounts() - Set up common required neutron accounts
443
444# Tenant User Roles
445# ------------------------------------------------------------------
446# service neutron admin # if enabled
447
448# Migrated from keystone_data.sh
Ian Wienandaee18c72014-02-21 15:35:08 +1100449function create_neutron_accounts {
Mark McClainb05c8762013-07-06 23:29:39 -0400450
Dean Troyer188493d2014-07-25 15:54:11 -0500451 local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
452 local admin_role=$(openstack role list | awk "/ admin / { print \$2 }")
Mark McClainb05c8762013-07-06 23:29:39 -0400453
454 if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
Bartosz Górski0abde392014-02-28 14:15:19 +0100455
Dean Troyer188493d2014-07-25 15:54:11 -0500456 local neutron_user=$(get_or_create_user "neutron" \
457 "$SERVICE_PASSWORD" $service_tenant)
458 get_or_add_user_role $admin_role $neutron_user $service_tenant
Bartosz Górski0abde392014-02-28 14:15:19 +0100459
Mark McClainb05c8762013-07-06 23:29:39 -0400460 if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
Bartosz Górski0abde392014-02-28 14:15:19 +0100461
Dean Troyer188493d2014-07-25 15:54:11 -0500462 local neutron_service=$(get_or_create_service "neutron" \
Bartosz Górski0abde392014-02-28 14:15:19 +0100463 "network" "Neutron Service")
Dean Troyer188493d2014-07-25 15:54:11 -0500464 get_or_create_endpoint $neutron_service \
Bartosz Górski0abde392014-02-28 14:15:19 +0100465 "$REGION_NAME" \
Aaron Rosen186119c2014-07-25 15:35:09 -0700466 "http://$SERVICE_HOST:$Q_PORT/" \
467 "http://$SERVICE_HOST:$Q_PORT/" \
468 "http://$SERVICE_HOST:$Q_PORT/"
Mark McClainb05c8762013-07-06 23:29:39 -0400469 fi
470 fi
471}
472
Ian Wienandaee18c72014-02-21 15:35:08 +1100473function create_neutron_initial_network {
Steve Martinelli19685422014-01-24 13:02:26 -0600474 TENANT_ID=$(openstack project list | grep " demo " | get_field 1)
DennyZhang23178a92013-10-22 17:07:32 -0500475 die_if_not_set $LINENO TENANT_ID "Failure retrieving TENANT_ID for demo"
Mark McClainb05c8762013-07-06 23:29:39 -0400476
477 # Create a small network
478 # Since neutron command is executed in admin context at this point,
Dirk Mueller25049cd2014-01-09 13:53:52 +0100479 # ``--tenant-id`` needs to be specified.
Mark McClainb05c8762013-07-06 23:29:39 -0400480 if is_baremetal; then
sbauzae2c4ee22013-08-29 17:29:46 +0200481 if [[ "$PUBLIC_INTERFACE" == '' || "$OVS_PHYSICAL_BRIDGE" == '' ]]; then
482 die $LINENO "Neutron settings for baremetal not set.. exiting"
483 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400484 sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
485 for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do
486 sudo ip addr del $IP dev $PUBLIC_INTERFACE
487 sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE
488 done
Dirk Mueller25049cd2014-01-09 13:53:52 +0100489 NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant-id $TENANT_ID --provider:network_type flat --provider:physical_network "$PHYSICAL_NETWORK" | grep ' id ' | get_field 2)
DennyZhang23178a92013-10-22 17:07:32 -0500490 die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $TENANT_ID"
Dirk Mueller25049cd2014-01-09 13:53:52 +0100491 SUBNET_ID=$(neutron subnet-create --tenant-id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
DennyZhang23178a92013-10-22 17:07:32 -0500492 die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $TENANT_ID"
Mark McClainb05c8762013-07-06 23:29:39 -0400493 sudo ifconfig $OVS_PHYSICAL_BRIDGE up
sbauzae2c4ee22013-08-29 17:29:46 +0200494 sudo route add default gw $NETWORK_GATEWAY dev $OVS_PHYSICAL_BRIDGE
Sean M. Collins5ec6f8f2014-05-14 17:01:03 -0400495 elif is_provider_network; then
Satoru Moriyaaf9b2512014-09-01 20:43:08 +0900496 die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK"
Sean M. Collins5ec6f8f2014-05-14 17:01:03 -0400497 die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specifiy the PROVIDER_NETWORK_TYPE"
Satoru Moriyaaf9b2512014-09-01 20:43:08 +0900498 NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type $PROVIDER_NETWORK_TYPE --provider:physical_network "$PHYSICAL_NETWORK" ${SEGMENTATION_ID:+--provider:segmentation_id $SEGMENTATION_ID} --shared | grep ' id ' | get_field 2)
Sean M. Collins5ec6f8f2014-05-14 17:01:03 -0400499 SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --name $PROVIDER_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
Sean M. Collinse13fd602014-05-14 17:01:53 -0400500 SUBNET_V6_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 6 --ipv6-address-mode slaac --gateway $V6_NETWORK_GATEWAY --name $PROVIDER_SUBNET_NAME_V6 $NET_ID $FIXED_RANGE_V6 | grep 'id' | get_field 2)
Sean M. Collins5ec6f8f2014-05-14 17:01:03 -0400501 sudo ip link set $OVS_PHYSICAL_BRIDGE up
502 sudo ip link set br-int up
503 sudo ip link set $PUBLIC_INTERFACE up
Mark McClainb05c8762013-07-06 23:29:39 -0400504 else
Dirk Mueller25049cd2014-01-09 13:53:52 +0100505 NET_ID=$(neutron net-create --tenant-id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
DennyZhang23178a92013-10-22 17:07:32 -0500506 die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $TENANT_ID"
Dirk Mueller25049cd2014-01-09 13:53:52 +0100507 SUBNET_ID=$(neutron subnet-create --tenant-id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
DennyZhang23178a92013-10-22 17:07:32 -0500508 die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $TENANT_ID"
Mark McClainb05c8762013-07-06 23:29:39 -0400509 fi
510
511 if [[ "$Q_L3_ENABLED" == "True" ]]; then
512 # Create a router, and add the private subnet as one of its interfaces
513 if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then
514 # create a tenant-owned router.
Dirk Mueller25049cd2014-01-09 13:53:52 +0100515 ROUTER_ID=$(neutron router-create --tenant-id $TENANT_ID $Q_ROUTER_NAME | grep ' id ' | get_field 2)
DennyZhang23178a92013-10-22 17:07:32 -0500516 die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $TENANT_ID $Q_ROUTER_NAME"
Mark McClainb05c8762013-07-06 23:29:39 -0400517 else
518 # Plugin only supports creating a single router, which should be admin owned.
519 ROUTER_ID=$(neutron router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
DennyZhang23178a92013-10-22 17:07:32 -0500520 die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $Q_ROUTER_NAME"
Mark McClainb05c8762013-07-06 23:29:39 -0400521 fi
522 neutron router-interface-add $ROUTER_ID $SUBNET_ID
523 # Create an external network, and a subnet. Configure the external network as router gw
YAMAMOTO Takashi6a633fd2014-07-23 12:02:18 +0900524 if [ "$Q_USE_PROVIDERNET_FOR_PUBLIC" = "True" ]; then
525 EXT_NET_ID=$(neutron net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True --provider:network_type=flat --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} | grep ' id ' | get_field 2)
526 else
527 EXT_NET_ID=$(neutron net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2)
528 fi
DennyZhang23178a92013-10-22 17:07:32 -0500529 die_if_not_set $LINENO EXT_NET_ID "Failure creating EXT_NET_ID for $PUBLIC_NETWORK_NAME"
Mark McClainb05c8762013-07-06 23:29:39 -0400530 EXT_GW_IP=$(neutron subnet-create --ip_version 4 ${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} --gateway $PUBLIC_NETWORK_GATEWAY --name $PUBLIC_SUBNET_NAME $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2)
DennyZhang23178a92013-10-22 17:07:32 -0500531 die_if_not_set $LINENO EXT_GW_IP "Failure creating EXT_GW_IP"
Mark McClainb05c8762013-07-06 23:29:39 -0400532 neutron router-gateway-set $ROUTER_ID $EXT_NET_ID
533
534 if is_service_enabled q-l3; then
535 # logic is specific to using the l3-agent for l3
536 if is_neutron_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then
YAMAMOTO Takashiea3dac92014-07-23 16:07:21 +0900537 # Disable in-band as we are going to use local port
538 # to communicate with VMs
539 sudo ovs-vsctl set Bridge $PUBLIC_BRIDGE other_config:disable-in-band=true
Mark McClainb05c8762013-07-06 23:29:39 -0400540 CIDR_LEN=${FLOATING_RANGE#*/}
541 sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE
542 sudo ip link set $PUBLIC_BRIDGE up
543 ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'`
DennyZhang23178a92013-10-22 17:07:32 -0500544 die_if_not_set $LINENO ROUTER_GW_IP "Failure retrieving ROUTER_GW_IP"
Mark McClainb05c8762013-07-06 23:29:39 -0400545 sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP
546 fi
547 if [[ "$Q_USE_NAMESPACE" == "False" ]]; then
548 # Explicitly set router id in l3 agent configuration
549 iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID
550 fi
551 fi
Sean Dague3bdb9222013-10-22 08:36:16 -0400552 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400553}
554
555# init_neutron() - Initialize databases, etc.
Ian Wienandaee18c72014-02-21 15:35:08 +1100556function init_neutron {
Salvatore Orlandodd649882013-08-05 08:56:17 -0700557 recreate_database $Q_DB_NAME utf8
558 # Run Neutron db migrations
559 $NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
Mark McClainb05c8762013-07-06 23:29:39 -0400560}
561
562# install_neutron() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100563function install_neutron {
Mark McClainb05c8762013-07-06 23:29:39 -0400564 git_clone $NEUTRON_REPO $NEUTRON_DIR $NEUTRON_BRANCH
565 setup_develop $NEUTRON_DIR
566}
567
568# install_neutronclient() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100569function install_neutronclient {
Mark McClainb05c8762013-07-06 23:29:39 -0400570 git_clone $NEUTRONCLIENT_REPO $NEUTRONCLIENT_DIR $NEUTRONCLIENT_BRANCH
571 setup_develop $NEUTRONCLIENT_DIR
Attila Fazekasfac533e2013-08-14 16:04:01 +0200572 sudo install -D -m 0644 -o $STACK_USER {$NEUTRONCLIENT_DIR/tools/,/etc/bash_completion.d/}neutron.bash_completion
Mark McClainb05c8762013-07-06 23:29:39 -0400573}
574
575# install_neutron_agent_packages() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100576function install_neutron_agent_packages {
Robert Li72b3e442014-07-17 15:04:52 -0400577 # radvd doesn't come with the OS. Install it if the l3 service is enabled.
578 if is_service_enabled q-l3; then
579 install_package radvd
580 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400581 # install packages that are specific to plugin agent(s)
582 if is_service_enabled q-agt q-dhcp q-l3; then
583 neutron_plugin_install_agent_packages
584 fi
585
586 if is_service_enabled q-lbaas; then
Sean Dague3bdb9222013-10-22 08:36:16 -0400587 neutron_agent_lbaas_install_agent_packages
Mark McClainb05c8762013-07-06 23:29:39 -0400588 fi
589}
590
591# Start running processes, including screen
Ian Wienandaee18c72014-02-21 15:35:08 +1100592function start_neutron_service_and_check {
Adam Gandelman7614d212014-08-11 14:27:50 -0700593 local cfg_file_options="$(determine_config_files neutron-server)"
Mark McClainb05c8762013-07-06 23:29:39 -0400594 # Start the Neutron service
Chris Dent2f27a0e2014-09-09 13:46:02 +0100595 run_process q-svc "python $NEUTRON_BIN_DIR/neutron-server $cfg_file_options"
Mark McClainb05c8762013-07-06 23:29:39 -0400596 echo "Waiting for Neutron to start..."
JUN JIE NAN0aa85342013-09-13 15:47:09 +0800597 if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- http://$Q_HOST:$Q_PORT; do sleep 1; done"; then
Sean Dague3bdb9222013-10-22 08:36:16 -0400598 die $LINENO "Neutron did not start"
Mark McClainb05c8762013-07-06 23:29:39 -0400599 fi
600}
601
602# Start running processes, including screen
Ian Wienandaee18c72014-02-21 15:35:08 +1100603function start_neutron_agents {
Mark McClainb05c8762013-07-06 23:29:39 -0400604 # Start up the neutron agents if enabled
Chris Dent2f27a0e2014-09-09 13:46:02 +0100605 run_process q-agt "python $AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE"
606 run_process q-dhcp "python $AGENT_DHCP_BINARY --config-file $NEUTRON_CONF --config-file=$Q_DHCP_CONF_FILE"
Nachi Ueno584750f2013-07-15 18:22:21 -0700607
Sean M. Collins5ec6f8f2014-05-14 17:01:03 -0400608 if is_provider_network; then
609 sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
610 sudo ip link set $OVS_PHYSICAL_BRIDGE up
611 sudo ip link set br-int up
612 sudo ip link set $PUBLIC_INTERFACE up
613 fi
614
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700615 if is_service_enabled q-vpn; then
Chris Dent2f27a0e2014-09-09 13:46:02 +0100616 run_process q-vpn "$AGENT_VPN_BINARY $(determine_config_files neutron-vpn-agent)"
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700617 else
Chris Dent2f27a0e2014-09-09 13:46:02 +0100618 run_process q-l3 "python $AGENT_L3_BINARY $(determine_config_files neutron-l3-agent)"
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700619 fi
620
Chris Dent2f27a0e2014-09-09 13:46:02 +0100621 run_process q-meta "python $AGENT_META_BINARY --config-file $NEUTRON_CONF --config-file=$Q_META_CONF_FILE"
Mark McClainb05c8762013-07-06 23:29:39 -0400622
623 if [ "$VIRT_DRIVER" = 'xenserver' ]; then
624 # For XenServer, start an agent for the domU openvswitch
Chris Dent2f27a0e2014-09-09 13:46:02 +0100625 run_process q-domua "python $AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE.domU"
Mark McClainb05c8762013-07-06 23:29:39 -0400626 fi
627
628 if is_service_enabled q-lbaas; then
Chris Dent2f27a0e2014-09-09 13:46:02 +0100629 run_process q-lbaas "python $AGENT_LBAAS_BINARY --config-file $NEUTRON_CONF --config-file=$LBAAS_AGENT_CONF_FILENAME"
Mark McClainb05c8762013-07-06 23:29:39 -0400630 fi
Emilien Macchi40546f72013-09-24 15:10:25 +0200631
632 if is_service_enabled q-metering; then
Chris Dent2f27a0e2014-09-09 13:46:02 +0100633 run_process q-metering "python $AGENT_METERING_BINARY --config-file $NEUTRON_CONF --config-file $METERING_AGENT_CONF_FILENAME"
Emilien Macchi40546f72013-09-24 15:10:25 +0200634 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400635}
636
637# stop_neutron() - Stop running processes (non-screen)
Ian Wienandaee18c72014-02-21 15:35:08 +1100638function stop_neutron {
Mark McClainb05c8762013-07-06 23:29:39 -0400639 if is_service_enabled q-dhcp; then
640 pid=$(ps aux | awk '/[d]nsmasq.+interface=(tap|ns-)/ { print $2 }')
641 [ ! -z "$pid" ] && sudo kill -9 $pid
642 fi
643 if is_service_enabled q-meta; then
Jakub Libosvar1f763282014-01-28 23:01:38 +0100644 sudo pkill -9 -f neutron-ns-metadata-proxy || :
Mark McClainb05c8762013-07-06 23:29:39 -0400645 fi
Akihiro Motokiedddb1f2013-12-09 20:21:06 +0900646
647 if is_service_enabled q-lbaas; then
648 neutron_lbaas_stop
649 fi
650 if is_service_enabled q-fwaas; then
651 neutron_fwaas_stop
652 fi
653 if is_service_enabled q-vpn; then
654 neutron_vpn_stop
655 fi
656 if is_service_enabled q-metering; then
657 neutron_metering_stop
658 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400659}
660
661# cleanup_neutron() - Remove residual data files, anything left over from previous
662# runs that a clean run would need to clean up
Ian Wienandaee18c72014-02-21 15:35:08 +1100663function cleanup_neutron {
Mark McClainb05c8762013-07-06 23:29:39 -0400664 if is_neutron_ovs_base_plugin; then
665 neutron_ovs_base_cleanup
666 fi
667
668 # delete all namespaces created by neutron
Brian Haleyeea76212014-06-27 11:45:50 -0400669 for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|qlbaas|fip|snat)-[0-9a-f-]*'); do
Mark McClainb05c8762013-07-06 23:29:39 -0400670 sudo ip netns delete ${ns}
671 done
672}
673
674# _configure_neutron_common()
675# Set common config for all neutron server and agents.
676# This MUST be called before other ``_configure_neutron_*`` functions.
Ian Wienandaee18c72014-02-21 15:35:08 +1100677function _configure_neutron_common {
Mark McClainb05c8762013-07-06 23:29:39 -0400678 # Put config files in ``NEUTRON_CONF_DIR`` for everyone to find
679 if [[ ! -d $NEUTRON_CONF_DIR ]]; then
680 sudo mkdir -p $NEUTRON_CONF_DIR
681 fi
682 sudo chown $STACK_USER $NEUTRON_CONF_DIR
683
684 cp $NEUTRON_DIR/etc/neutron.conf $NEUTRON_CONF
685
686 # Set plugin-specific variables ``Q_DB_NAME``, ``Q_PLUGIN_CLASS``.
687 # For main plugin config file, set ``Q_PLUGIN_CONF_PATH``, ``Q_PLUGIN_CONF_FILENAME``.
688 # For addition plugin config files, set ``Q_PLUGIN_EXTRA_CONF_PATH``,
689 # ``Q_PLUGIN_EXTRA_CONF_FILES``. For example:
Adam Spierscb961592013-10-05 12:11:07 +0100690 #
Mark McClainb05c8762013-07-06 23:29:39 -0400691 # ``Q_PLUGIN_EXTRA_CONF_FILES=(file1, file2)``
692 neutron_plugin_configure_common
693
sbauzae2c4ee22013-08-29 17:29:46 +0200694 if [[ "$Q_PLUGIN_CONF_PATH" == '' || "$Q_PLUGIN_CONF_FILENAME" == '' || "$Q_PLUGIN_CLASS" == '' ]]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400695 die $LINENO "Neutron plugin not set.. exiting"
696 fi
697
698 # If needed, move config file from ``$NEUTRON_DIR/etc/neutron`` to ``NEUTRON_CONF_DIR``
699 mkdir -p /$Q_PLUGIN_CONF_PATH
700 Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
701 cp $NEUTRON_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE
702
Ihar Hrachyshkab816e5d2014-07-21 13:53:50 +0200703 iniset $NEUTRON_CONF database connection `database_connection_url $Q_DB_NAME`
Mark McClainb05c8762013-07-06 23:29:39 -0400704 iniset $NEUTRON_CONF DEFAULT state_path $DATA_DIR/neutron
705
706 # If addition config files are set, make sure their path name is set as well
707 if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then
708 die $LINENO "Neutron additional plugin config not set.. exiting"
709 fi
710
711 # If additional config files exist, copy them over to neutron configuration
712 # directory
713 if [[ $Q_PLUGIN_EXTRA_CONF_PATH != '' ]]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400714 local f
715 for (( f=0; $f < ${#Q_PLUGIN_EXTRA_CONF_FILES[@]}; f+=1 )); do
716 Q_PLUGIN_EXTRA_CONF_FILES[$f]=$Q_PLUGIN_EXTRA_CONF_PATH/${Q_PLUGIN_EXTRA_CONF_FILES[$f]}
Mark McClainb05c8762013-07-06 23:29:39 -0400717 done
718 fi
719
Joe Gordonbee5c502013-08-30 13:48:08 -0400720 if [ "$VIRT_DRIVER" = 'fake' ]; then
721 # Disable arbitrary limits
722 iniset $NEUTRON_CONF quotas quota_network -1
723 iniset $NEUTRON_CONF quotas quota_subnet -1
724 iniset $NEUTRON_CONF quotas quota_port -1
725 iniset $NEUTRON_CONF quotas quota_security_group -1
726 iniset $NEUTRON_CONF quotas quota_security_group_rule -1
727 fi
728
Salvatore Orlando05ae8332013-08-20 14:51:08 -0700729 # Format logging
730 if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
Salvatore Orlandobc7f6432013-11-25 10:11:14 -0800731 setup_colorized_logging $NEUTRON_CONF DEFAULT project_id
Salvatore Orlando05ae8332013-08-20 14:51:08 -0700732 fi
733
Mark McClainb05c8762013-07-06 23:29:39 -0400734 _neutron_setup_rootwrap
735}
736
Ian Wienandaee18c72014-02-21 15:35:08 +1100737function _configure_neutron_debug_command {
Mark McClainb05c8762013-07-06 23:29:39 -0400738 if [[ "$Q_USE_DEBUG_COMMAND" != "True" ]]; then
739 return
740 fi
741
742 cp $NEUTRON_DIR/etc/l3_agent.ini $NEUTRON_TEST_CONFIG_FILE
743
744 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT verbose False
745 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT debug False
746 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
Mark McClainb05c8762013-07-06 23:29:39 -0400747 iniset $NEUTRON_TEST_CONFIG_FILE agent root_helper "$Q_RR_COMMAND"
748
Mark McClainb05c8762013-07-06 23:29:39 -0400749 _neutron_setup_interface_driver $NEUTRON_TEST_CONFIG_FILE
750
751 neutron_plugin_configure_debug_command
752}
753
Ian Wienandaee18c72014-02-21 15:35:08 +1100754function _configure_neutron_dhcp_agent {
Mark McClainb05c8762013-07-06 23:29:39 -0400755
756 cp $NEUTRON_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE
757
758 iniset $Q_DHCP_CONF_FILE DEFAULT verbose True
Ben Nemec03997942013-08-10 09:56:16 -0500759 iniset $Q_DHCP_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400760 iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
761 iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
762
Mark McClainb05c8762013-07-06 23:29:39 -0400763 _neutron_setup_interface_driver $Q_DHCP_CONF_FILE
764
765 neutron_plugin_configure_dhcp_agent
766}
767
Ian Wienandaee18c72014-02-21 15:35:08 +1100768function _configure_neutron_l3_agent {
Paul Michali746dcee2014-04-02 19:12:22 +0000769 local cfg_file
Mark McClainb05c8762013-07-06 23:29:39 -0400770 Q_L3_ENABLED=True
771 # for l3-agent, only use per tenant router if we have namespaces
772 Q_L3_ROUTER_PER_TENANT=$Q_USE_NAMESPACE
Nachi Ueno69b3ff62013-06-07 10:28:33 -0700773
Paul Michali746dcee2014-04-02 19:12:22 +0000774 if is_service_enabled q-vpn; then
Paul Michali746dcee2014-04-02 19:12:22 +0000775 cp $NEUTRON_DIR/etc/vpn_agent.ini $Q_VPN_CONF_FILE
Paul Michali746dcee2014-04-02 19:12:22 +0000776 fi
777
Mark McClainb05c8762013-07-06 23:29:39 -0400778 cp $NEUTRON_DIR/etc/l3_agent.ini $Q_L3_CONF_FILE
779
780 iniset $Q_L3_CONF_FILE DEFAULT verbose True
Ben Nemec03997942013-08-10 09:56:16 -0500781 iniset $Q_L3_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400782 iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
783 iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
784
Mark McClainb05c8762013-07-06 23:29:39 -0400785 _neutron_setup_interface_driver $Q_L3_CONF_FILE
786
787 neutron_plugin_configure_l3_agent
788}
789
Ian Wienandaee18c72014-02-21 15:35:08 +1100790function _configure_neutron_metadata_agent {
Mark McClainb05c8762013-07-06 23:29:39 -0400791 cp $NEUTRON_DIR/etc/metadata_agent.ini $Q_META_CONF_FILE
792
793 iniset $Q_META_CONF_FILE DEFAULT verbose True
Ben Nemec03997942013-08-10 09:56:16 -0500794 iniset $Q_META_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400795 iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP
796 iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
797
Jamie Lennox3561d7f2014-05-21 17:18:43 +1000798 _neutron_setup_keystone $Q_META_CONF_FILE DEFAULT True True
Maru Newbybf10ac52013-08-10 21:27:54 +0000799
Mark McClainb05c8762013-07-06 23:29:39 -0400800}
801
Dina Belova58adaa62014-07-11 18:18:12 +0400802function _configure_neutron_ceilometer_notifications {
803 iniset $NEUTRON_CONF DEFAULT notification_driver neutron.openstack.common.notifier.rpc_notifier
804}
805
Ian Wienandaee18c72014-02-21 15:35:08 +1100806function _configure_neutron_lbaas {
Mark McClainb05c8762013-07-06 23:29:39 -0400807 neutron_agent_lbaas_configure_common
808 neutron_agent_lbaas_configure_agent
809}
810
Ian Wienandaee18c72014-02-21 15:35:08 +1100811function _configure_neutron_metering {
Emilien Macchi40546f72013-09-24 15:10:25 +0200812 neutron_agent_metering_configure_common
813 neutron_agent_metering_configure_agent
814}
815
Ian Wienandaee18c72014-02-21 15:35:08 +1100816function _configure_neutron_fwaas {
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700817 neutron_fwaas_configure_common
818 neutron_fwaas_configure_driver
819}
820
Ian Wienandaee18c72014-02-21 15:35:08 +1100821function _configure_neutron_vpn {
Nachi Ueno69b3ff62013-06-07 10:28:33 -0700822 neutron_vpn_install_agent_packages
823 neutron_vpn_configure_common
Nachi Ueno69b3ff62013-06-07 10:28:33 -0700824}
825
Brian Haleyeea76212014-06-27 11:45:50 -0400826function _configure_dvr {
827 iniset $NEUTRON_CONF DEFAULT router_distributed True
828 iniset $Q_L3_CONF_FILE DEFAULT agent_mode $Q_DVR_MODE
829}
830
831
Mark McClainb05c8762013-07-06 23:29:39 -0400832# _configure_neutron_plugin_agent() - Set config files for neutron plugin agent
833# It is called when q-agt is enabled.
Ian Wienandaee18c72014-02-21 15:35:08 +1100834function _configure_neutron_plugin_agent {
Mark McClainb05c8762013-07-06 23:29:39 -0400835 # Specify the default root helper prior to agent configuration to
836 # ensure that an agent's configuration can override the default
837 iniset /$Q_PLUGIN_CONF_FILE agent root_helper "$Q_RR_COMMAND"
838 iniset $NEUTRON_CONF DEFAULT verbose True
Ben Nemec03997942013-08-10 09:56:16 -0500839 iniset $NEUTRON_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400840
841 # Configure agent for plugin
842 neutron_plugin_configure_plugin_agent
843}
844
845# _configure_neutron_service() - Set config files for neutron service
846# It is called when q-svc is enabled.
Ian Wienandaee18c72014-02-21 15:35:08 +1100847function _configure_neutron_service {
Mark McClainb05c8762013-07-06 23:29:39 -0400848 Q_API_PASTE_FILE=$NEUTRON_CONF_DIR/api-paste.ini
849 Q_POLICY_FILE=$NEUTRON_CONF_DIR/policy.json
850
851 cp $NEUTRON_DIR/etc/api-paste.ini $Q_API_PASTE_FILE
852 cp $NEUTRON_DIR/etc/policy.json $Q_POLICY_FILE
853
Mark McClainb05c8762013-07-06 23:29:39 -0400854 # Update either configuration file with plugin
855 iniset $NEUTRON_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS
856
857 if [[ $Q_SERVICE_PLUGIN_CLASSES != '' ]]; then
858 iniset $NEUTRON_CONF DEFAULT service_plugins $Q_SERVICE_PLUGIN_CLASSES
859 fi
860
861 iniset $NEUTRON_CONF DEFAULT verbose True
Ben Nemec03997942013-08-10 09:56:16 -0500862 iniset $NEUTRON_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400863 iniset $NEUTRON_CONF DEFAULT policy_file $Q_POLICY_FILE
864 iniset $NEUTRON_CONF DEFAULT allow_overlapping_ips $Q_ALLOW_OVERLAPPING_IP
865
866 iniset $NEUTRON_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY
867 _neutron_setup_keystone $NEUTRON_CONF keystone_authtoken
868
Aaron Rosencea32b12014-03-04 16:20:14 -0800869 # Configuration for neutron notifations to nova.
Terry Wilsonf06c4432014-05-20 10:54:51 -0500870 iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_status_changes $Q_NOTIFY_NOVA_PORT_STATUS_CHANGES
871 iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_data_changes $Q_NOTIFY_NOVA_PORT_DATA_CHANGES
Aaron Rosencea32b12014-03-04 16:20:14 -0800872 iniset $NEUTRON_CONF DEFAULT nova_url "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2"
Dirk Mueller5ca261a2014-04-04 22:48:02 +0200873 iniset $NEUTRON_CONF DEFAULT nova_admin_username nova
Aaron Rosencea32b12014-03-04 16:20:14 -0800874 iniset $NEUTRON_CONF DEFAULT nova_admin_password $SERVICE_PASSWORD
875 ADMIN_TENANT_ID=$(openstack project list | awk "/ service / { print \$2 }")
876 iniset $NEUTRON_CONF DEFAULT nova_admin_tenant_id $ADMIN_TENANT_ID
877 iniset $NEUTRON_CONF DEFAULT nova_admin_auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0"
878
Mark McClainb05c8762013-07-06 23:29:39 -0400879 # Configure plugin
880 neutron_plugin_configure_service
881}
882
883# Utility Functions
884#------------------
885
Isaku Yamahata9e136b42013-12-16 15:52:03 +0900886# _neutron_service_plugin_class_add() - add service plugin class
Ian Wienandaee18c72014-02-21 15:35:08 +1100887function _neutron_service_plugin_class_add {
Isaku Yamahata9e136b42013-12-16 15:52:03 +0900888 local service_plugin_class=$1
889 if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
890 Q_SERVICE_PLUGIN_CLASSES=$service_plugin_class
891 elif [[ ! ,${Q_SERVICE_PLUGIN_CLASSES}, =~ ,${service_plugin_class}, ]]; then
892 Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$service_plugin_class"
893 fi
894}
895
Mark McClainb05c8762013-07-06 23:29:39 -0400896# _neutron_setup_rootwrap() - configure Neutron's rootwrap
Ian Wienandaee18c72014-02-21 15:35:08 +1100897function _neutron_setup_rootwrap {
Mark McClainb05c8762013-07-06 23:29:39 -0400898 if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
899 return
900 fi
901 # Deploy new rootwrap filters files (owned by root).
902 # Wipe any existing ``rootwrap.d`` files first
903 Q_CONF_ROOTWRAP_D=$NEUTRON_CONF_DIR/rootwrap.d
904 if [[ -d $Q_CONF_ROOTWRAP_D ]]; then
905 sudo rm -rf $Q_CONF_ROOTWRAP_D
906 fi
907 # Deploy filters to ``$NEUTRON_CONF_DIR/rootwrap.d``
908 mkdir -p -m 755 $Q_CONF_ROOTWRAP_D
909 cp -pr $NEUTRON_DIR/etc/neutron/rootwrap.d/* $Q_CONF_ROOTWRAP_D/
910 sudo chown -R root:root $Q_CONF_ROOTWRAP_D
911 sudo chmod 644 $Q_CONF_ROOTWRAP_D/*
912 # Set up ``rootwrap.conf``, pointing to ``$NEUTRON_CONF_DIR/rootwrap.d``
913 # location moved in newer versions, prefer new location
914 if test -r $NEUTRON_DIR/etc/neutron/rootwrap.conf; then
Sean Dague3bdb9222013-10-22 08:36:16 -0400915 sudo cp -p $NEUTRON_DIR/etc/neutron/rootwrap.conf $Q_RR_CONF_FILE
Mark McClainb05c8762013-07-06 23:29:39 -0400916 else
Sean Dague3bdb9222013-10-22 08:36:16 -0400917 sudo cp -p $NEUTRON_DIR/etc/rootwrap.conf $Q_RR_CONF_FILE
Mark McClainb05c8762013-07-06 23:29:39 -0400918 fi
919 sudo sed -e "s:^filters_path=.*$:filters_path=$Q_CONF_ROOTWRAP_D:" -i $Q_RR_CONF_FILE
920 sudo chown root:root $Q_RR_CONF_FILE
921 sudo chmod 0644 $Q_RR_CONF_FILE
922 # Specify ``rootwrap.conf`` as first parameter to neutron-rootwrap
923 ROOTWRAP_SUDOER_CMD="$NEUTRON_ROOTWRAP $Q_RR_CONF_FILE *"
924
925 # Set up the rootwrap sudoers for neutron
926 TEMPFILE=`mktemp`
Stephan Renatuse578eff2013-11-19 13:31:04 +0100927 echo "$STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_SUDOER_CMD" >$TEMPFILE
Mark McClainb05c8762013-07-06 23:29:39 -0400928 chmod 0440 $TEMPFILE
929 sudo chown root:root $TEMPFILE
930 sudo mv $TEMPFILE /etc/sudoers.d/neutron-rootwrap
931
932 # Update the root_helper
933 iniset $NEUTRON_CONF agent root_helper "$Q_RR_COMMAND"
934}
935
936# Configures keystone integration for neutron service and agents
Ian Wienandaee18c72014-02-21 15:35:08 +1100937function _neutron_setup_keystone {
Mark McClainb05c8762013-07-06 23:29:39 -0400938 local conf_file=$1
939 local section=$2
940 local use_auth_url=$3
Maru Newbybf10ac52013-08-10 21:27:54 +0000941 local skip_auth_cache=$4
Jamie Lennox3561d7f2014-05-21 17:18:43 +1000942
Hirofumi Ichihara469a6d82014-09-03 10:03:33 +0900943 if [[ -n $use_auth_url ]]; then
944 iniset $conf_file $section auth_url $KEYSTONE_SERVICE_URI/v2.0
945 else
946 iniset $conf_file $section auth_uri $KEYSTONE_SERVICE_URI
947 iniset $conf_file $section identity_uri $KEYSTONE_AUTH_URI
948 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400949 iniset $conf_file $section admin_tenant_name $SERVICE_TENANT_NAME
950 iniset $conf_file $section admin_user $Q_ADMIN_USERNAME
951 iniset $conf_file $section admin_password $SERVICE_PASSWORD
Maru Newbybf10ac52013-08-10 21:27:54 +0000952 if [[ -z $skip_auth_cache ]]; then
953 iniset $conf_file $section signing_dir $NEUTRON_AUTH_CACHE_DIR
954 # Create cache dir
Emilien Macchia677b7f2013-11-25 23:40:20 +0100955 create_neutron_cache_dir
Maru Newbybf10ac52013-08-10 21:27:54 +0000956 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400957}
958
Ian Wienandaee18c72014-02-21 15:35:08 +1100959function _neutron_setup_interface_driver {
Mark McClainb05c8762013-07-06 23:29:39 -0400960
961 # ovs_use_veth needs to be set before the plugin configuration
962 # occurs to allow plugins to override the setting.
963 iniset $1 DEFAULT ovs_use_veth $Q_OVS_USE_VETH
964
965 neutron_plugin_setup_interface_driver $1
966}
967
968# Functions for Neutron Exercises
969#--------------------------------
970
Ian Wienandaee18c72014-02-21 15:35:08 +1100971function delete_probe {
Mark McClainb05c8762013-07-06 23:29:39 -0400972 local from_net="$1"
973 net_id=`_get_net_id $from_net`
974 probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}'`
975 neutron-debug --os-tenant-name admin --os-username admin probe-delete $probe_id
976}
977
Ian Wienandaee18c72014-02-21 15:35:08 +1100978function setup_neutron_debug {
Mark McClainb05c8762013-07-06 23:29:39 -0400979 if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
980 public_net_id=`_get_net_id $PUBLIC_NETWORK_NAME`
981 neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create --device-owner compute $public_net_id
982 private_net_id=`_get_net_id $PRIVATE_NETWORK_NAME`
983 neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create --device-owner compute $private_net_id
984 fi
985}
986
Ian Wienandaee18c72014-02-21 15:35:08 +1100987function teardown_neutron_debug {
Mark McClainb05c8762013-07-06 23:29:39 -0400988 delete_probe $PUBLIC_NETWORK_NAME
989 delete_probe $PRIVATE_NETWORK_NAME
990}
991
Ian Wienandaee18c72014-02-21 15:35:08 +1100992function _get_net_id {
Mark McClainb05c8762013-07-06 23:29:39 -0400993 neutron --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk '{print $2}'
994}
995
Ian Wienandaee18c72014-02-21 15:35:08 +1100996function _get_probe_cmd_prefix {
Mark McClainb05c8762013-07-06 23:29:39 -0400997 local from_net="$1"
998 net_id=`_get_net_id $from_net`
999 probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}' | head -n 1`
1000 echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id"
1001}
1002
Ian Wienandaee18c72014-02-21 15:35:08 +11001003function _ping_check_neutron {
Mark McClainb05c8762013-07-06 23:29:39 -04001004 local from_net=$1
1005 local ip=$2
1006 local timeout_sec=$3
1007 local expected=${4:-"True"}
1008 local check_command=""
1009 probe_cmd=`_get_probe_cmd_prefix $from_net`
1010 if [[ "$expected" = "True" ]]; then
1011 check_command="while ! $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done"
1012 else
1013 check_command="while $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done"
1014 fi
1015 if ! timeout $timeout_sec sh -c "$check_command"; then
1016 if [[ "$expected" = "True" ]]; then
1017 die $LINENO "[Fail] Couldn't ping server"
1018 else
1019 die $LINENO "[Fail] Could ping server"
1020 fi
1021 fi
1022}
1023
1024# ssh check
Ian Wienandaee18c72014-02-21 15:35:08 +11001025function _ssh_check_neutron {
Mark McClainb05c8762013-07-06 23:29:39 -04001026 local from_net=$1
1027 local key_file=$2
1028 local ip=$3
1029 local user=$4
1030 local timeout_sec=$5
1031 local probe_cmd = ""
1032 probe_cmd=`_get_probe_cmd_prefix $from_net`
1033 if ! timeout $timeout_sec sh -c "while ! $probe_cmd ssh -o StrictHostKeyChecking=no -i $key_file ${user}@$ip echo success; do sleep 1; done"; then
1034 die $LINENO "server didn't become ssh-able!"
1035 fi
1036}
1037
1038# Neutron 3rd party programs
1039#---------------------------
1040
1041# please refer to ``lib/neutron_thirdparty/README.md`` for details
1042NEUTRON_THIRD_PARTIES=""
1043for f in $TOP_DIR/lib/neutron_thirdparty/*; do
Sean Dague3bdb9222013-10-22 08:36:16 -04001044 third_party=$(basename $f)
1045 if is_service_enabled $third_party; then
1046 source $TOP_DIR/lib/neutron_thirdparty/$third_party
1047 NEUTRON_THIRD_PARTIES="$NEUTRON_THIRD_PARTIES,$third_party"
1048 fi
Mark McClainb05c8762013-07-06 23:29:39 -04001049done
1050
Ian Wienandaee18c72014-02-21 15:35:08 +11001051function _neutron_third_party_do {
Mark McClainb05c8762013-07-06 23:29:39 -04001052 for third_party in ${NEUTRON_THIRD_PARTIES//,/ }; do
1053 ${1}_${third_party}
1054 done
1055}
1056
1057# configure_neutron_third_party() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +11001058function configure_neutron_third_party {
Mark McClainb05c8762013-07-06 23:29:39 -04001059 _neutron_third_party_do configure
1060}
1061
1062# init_neutron_third_party() - Initialize databases, etc.
Ian Wienandaee18c72014-02-21 15:35:08 +11001063function init_neutron_third_party {
Mark McClainb05c8762013-07-06 23:29:39 -04001064 _neutron_third_party_do init
1065}
1066
1067# install_neutron_third_party() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +11001068function install_neutron_third_party {
Mark McClainb05c8762013-07-06 23:29:39 -04001069 _neutron_third_party_do install
1070}
1071
1072# start_neutron_third_party() - Start running processes, including screen
Ian Wienandaee18c72014-02-21 15:35:08 +11001073function start_neutron_third_party {
Mark McClainb05c8762013-07-06 23:29:39 -04001074 _neutron_third_party_do start
1075}
1076
1077# stop_neutron_third_party - Stop running processes (non-screen)
Ian Wienandaee18c72014-02-21 15:35:08 +11001078function stop_neutron_third_party {
Mark McClainb05c8762013-07-06 23:29:39 -04001079 _neutron_third_party_do stop
1080}
1081
armando-migliaccioef1e0802014-01-02 16:33:53 -08001082# check_neutron_third_party_integration() - Check that third party integration is sane
Ian Wienandaee18c72014-02-21 15:35:08 +11001083function check_neutron_third_party_integration {
armando-migliaccioef1e0802014-01-02 16:33:53 -08001084 _neutron_third_party_do check
1085}
1086
Sean M. Collins5ec6f8f2014-05-14 17:01:03 -04001087function is_provider_network {
1088 if [ "$Q_USE_PROVIDER_NETWORKING" == "True" ] && [ "$Q_L3_ENABLED" == "False" ]; then
1089 return 0
1090 fi
1091 return 1
1092}
1093
Mark McClainb05c8762013-07-06 23:29:39 -04001094
1095# Restore xtrace
1096$XTRACE
1097
Adam Spiers6a5aa7c2013-10-24 11:27:02 +01001098# Tell emacs to use shell-script-mode
1099## Local variables:
1100## mode: shell-script
1101## End: