Browse code

Merge "Begin new lib/neutron"

Jenkins authored on 2016/05/12 01:59:17
Showing 13 changed files
... ...
@@ -49,6 +49,7 @@ source $TOP_DIR/lib/nova
49 49
 source $TOP_DIR/lib/cinder
50 50
 source $TOP_DIR/lib/swift
51 51
 source $TOP_DIR/lib/heat
52
+source $TOP_DIR/lib/neutron
52 53
 source $TOP_DIR/lib/neutron-legacy
53 54
 
54 55
 set -o xtrace
... ...
@@ -32,6 +32,7 @@ source $TOP_DIR/functions
32 32
 
33 33
 # Import project functions
34 34
 source $TOP_DIR/lib/cinder
35
+source $TOP_DIR/lib/neutron
35 36
 source $TOP_DIR/lib/neutron-legacy
36 37
 
37 38
 # Import configuration
... ...
@@ -31,6 +31,7 @@ source $TOP_DIR/functions
31 31
 source $TOP_DIR/openrc
32 32
 
33 33
 # Import project functions
34
+source $TOP_DIR/lib/neutron
34 35
 source $TOP_DIR/lib/neutron-legacy
35 36
 
36 37
 # Import exercise configuration
... ...
@@ -37,6 +37,7 @@ source $TOP_DIR/functions
37 37
 source $TOP_DIR/openrc
38 38
 
39 39
 # Import neutron functions
40
+source $TOP_DIR/lib/neutron
40 41
 source $TOP_DIR/lib/neutron-legacy
41 42
 
42 43
 # If neutron is not enabled we exit with exitcode 55, which means exercise is skipped.
... ...
@@ -32,6 +32,7 @@ source $TOP_DIR/openrc
32 32
 
33 33
 # Import project functions
34 34
 source $TOP_DIR/lib/cinder
35
+source $TOP_DIR/lib/neutron
35 36
 source $TOP_DIR/lib/neutron-legacy
36 37
 
37 38
 # Import exercise configuration
38 39
new file mode 100644
... ...
@@ -0,0 +1,556 @@
0
+#!/bin/bash
1
+#
2
+# lib/neutron
3
+# Install and start **Neutron** network services
4
+
5
+# Dependencies:
6
+#
7
+# ``functions`` file
8
+# ``DEST`` must be defined
9
+
10
+# ``stack.sh`` calls the entry points in this order:
11
+#
12
+# - is_XXXX_enabled
13
+# - install_XXXX
14
+# - configure_XXXX
15
+# - init_XXXX
16
+# - start_XXXX
17
+# - stop_XXXX
18
+# - cleanup_XXXX
19
+
20
+# Save trace setting
21
+XTRACE=$(set +o | grep xtrace)
22
+set +o xtrace
23
+
24
+# Defaults
25
+# --------
26
+
27
+# Set up default directories
28
+GITDIR["python-neutronclient"]=$DEST/python-neutronclient
29
+
30
+NEUTRON_AGENT=${NEUTRON_AGENT:-openvswitch}
31
+NEUTRON_DIR=$DEST/neutron
32
+NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron}
33
+
34
+NEUTRON_BIN_DIR=$(get_python_exec_prefix)
35
+NEUTRON_DHCP_BINARY="neutron-dhcp-agent"
36
+
37
+NEUTRON_CONF_DIR=/etc/neutron
38
+NEUTRON_CONF=$NEUTRON_CONF_DIR/neutron.conf
39
+NEUTRON_META_CONF=$NEUTRON_CONF_DIR/metadata_agent.ini
40
+
41
+NEUTRON_DHCP_CONF=$NEUTRON_CONF_DIR/dhcp_agent.ini
42
+NEUTRON_L3_CONF=$NEUTRON_CONF_DIR/l3_agent.ini
43
+NEUTRON_AGENT_CONF=$NEUTRON_CONF_DIR/
44
+
45
+NEUTRON_STATE_PATH=${NEUTRON_STATE_PATH:=$DATA_DIR/neutron}
46
+NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron}
47
+
48
+# By default, use the ML2 plugin
49
+NEUTRON_PLUGIN=${NEUTRON_PLUGIN:-ml2}
50
+NEUTRON_PLUGIN_CONF_FILENAME=${NEUTRON_PLUGIN_CONF_FILENAME:-ml2_conf.ini}
51
+NEUTRON_PLUGIN_CONF_PATH=$NEUTRON_CONF_DIR/plugins/$NEUTRON_PLUGIN
52
+NEUTRON_PLUGIN_CONF=$NEUTRON_PLUGIN_CONF_PATH/$NEUTRON_PLUGIN_CONF_FILENAME
53
+
54
+NEUTRON_AGENT_BINARY=${NEUTRON_AGENT_BINARY:-neutron-$NEUTRON_AGENT-agent}
55
+NEUTRON_L3_BINARY=${NEUTRON_L3_BINARY:-neutron-l3-agent}
56
+NEUTRON_META_BINARY=${NEUTRON_META_BINARY:-neutron-metadata-agent}
57
+
58
+# Public facing bits
59
+if is_ssl_enabled_service "neutron" || is_service_enabled tls-proxy; then
60
+    NEUTRON_SERVICE_PROTOCOL="https"
61
+fi
62
+NEUTRON_SERVICE_HOST=${NEUTRON_SERVICE_HOST:-$SERVICE_HOST}
63
+NEUTRON_SERVICE_PORT=${NEUTRON_SERVICE_PORT:-9696}
64
+NEUTRON_SERVICE_PORT_INT=${NEUTRON_SERVICE_PORT_INT:-19696}
65
+NEUTRON_SERVICE_PROTOCOL=${NEUTRON_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
66
+
67
+NEUTRON_AUTH_STRATEGY=${NEUTRON_AUTH_STRATEGY:-keystone}
68
+NEUTRON_ROOTWRAP=$(get_rootwrap_location neutron)
69
+NEUTRON_ROOTWRAP_CONF_FILE=$NEUTRON_CONF_DIR/rootwrap.conf
70
+NEUTRON_ROOTWRAP_DAEMON_CMD="sudo $NEUTRON_ROOTWRAP-daemon $NEUTRON_ROOTWRAP_CONF_FILE"
71
+
72
+# Add all enabled config files to a single config arg
73
+NEUTRON_CONFIG_ARG=${NEUTRON_CONFIG_ARG:-""}
74
+
75
+# Functions
76
+# ---------
77
+
78
+# Test if any Neutron services are enabled
79
+# is_neutron_enabled
80
+function is_neutron_enabled {
81
+    [[ ,${ENABLED_SERVICES} =~ ,"neutron-" || ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0
82
+    return 1
83
+}
84
+
85
+# Test if any Neutron services are enabled
86
+# is_neutron_enabled
87
+function is_neutron_legacy_enabled {
88
+    [[ ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0
89
+    return 1
90
+}
91
+
92
+# cleanup_neutron() - Remove residual data files, anything left over from previous
93
+# runs that a clean run would need to clean up
94
+function cleanup_neutron_new {
95
+    source $TOP_DIR/lib/neutron_plugins/${NEUTRON_AGENT}_agent
96
+    if is_neutron_ovs_base_plugin; then
97
+        neutron_ovs_base_cleanup
98
+    fi
99
+
100
+    if [[ $NEUTRON_AGENT == "linuxbridge" ]]; then
101
+        neutron_lb_cleanup
102
+    fi
103
+    # delete all namespaces created by neutron
104
+    for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|qlbaas|fip|snat)-[0-9a-f-]*'); do
105
+        sudo ip netns delete ${ns}
106
+    done
107
+}
108
+
109
+# configure_neutron() - Set config files, create data dirs, etc
110
+function configure_neutron_new {
111
+    sudo install -d -o $STACK_USER $NEUTRON_CONF_DIR
112
+
113
+    (cd $NEUTRON_DIR && exec ./tools/generate_config_file_samples.sh)
114
+
115
+    cp $NEUTRON_DIR/etc/neutron.conf.sample $NEUTRON_CONF
116
+
117
+    configure_neutron_rootwrap
118
+
119
+    mkdir -p $NEUTRON_PLUGIN_CONF_PATH
120
+
121
+    cp $NEUTRON_DIR/etc/neutron/plugins/$NEUTRON_PLUGIN/$NEUTRON_PLUGIN_CONF_FILENAME.sample $NEUTRON_PLUGIN_CONF
122
+
123
+    iniset $NEUTRON_CONF database connection `database_connection_url neutron`
124
+    iniset $NEUTRON_CONF DEFAULT state_path $NEUTRON_STATE_PATH
125
+    iniset $NEUTRON_CONF oslo_concurrency lock_path $NEUTRON_STATE_PATH/lock
126
+    iniset $NEUTRON_CONF DEFAULT use_syslog $SYSLOG
127
+
128
+    # Neutron API server & Neutron plugin
129
+    if is_service_enabled neutron-api; then
130
+        local policy_file=$NEUTRON_CONF_DIR/policy.json
131
+        cp $NEUTRON_DIR/etc/policy.json $policy_file
132
+        # Allow neutron user to administer neutron to match neutron account
133
+        sed -i 's/"context_is_admin":  "role:admin"/"context_is_admin":  "role:admin or user_name:neutron"/g' $policy_file
134
+
135
+        cp $NEUTRON_DIR/etc/api-paste.ini $NEUTRON_CONF_DIR/api-paste.ini
136
+
137
+        iniset $NEUTRON_CONF DEFAULT core_plugin ml2
138
+
139
+        iniset $NEUTRON_CONF DEFAULT verbose True
140
+        iniset $NEUTRON_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
141
+        iniset $NEUTRON_CONF DEFAULT policy_file $policy_file
142
+        iniset $NEUTRON_CONF DEFAULT allow_overlapping_ips True
143
+
144
+        iniset $NEUTRON_CONF DEFAULT auth_strategy $NEUTRON_AUTH_STRATEGY
145
+        configure_auth_token_middleware $NEUTRON_CONF neutron $NEUTRON_AUTH_CACHE_DIR keystone_authtoken
146
+
147
+        # Configuration for neutron notifations to nova.
148
+        iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_status_changes $Q_NOTIFY_NOVA_PORT_STATUS_CHANGES
149
+        iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_data_changes $Q_NOTIFY_NOVA_PORT_DATA_CHANGES
150
+
151
+        iniset $NEUTRON_CONF nova auth_type password
152
+        iniset $NEUTRON_CONF nova auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v3"
153
+        iniset $NEUTRON_CONF nova username nova
154
+        iniset $NEUTRON_CONF nova password $SERVICE_PASSWORD
155
+        iniset $NEUTRON_CONF nova user_domain_id default
156
+        iniset $NEUTRON_CONF nova project_name $SERVICE_TENANT_NAME
157
+        iniset $NEUTRON_CONF nova project_domain_id default
158
+        iniset $NEUTRON_CONF nova region_name $REGION_NAME
159
+
160
+        # Configure VXLAN
161
+        # TODO(sc68cal) not hardcode?
162
+        iniset $NEUTRON_PLUGIN_CONF ml2 tenant_network_types vxlan
163
+        iniset $NEUTRON_PLUGIN_CONF ml2 type_drivers vxlan
164
+        iniset $NEUTRON_PLUGIN_CONF ml2 mechanism_drivers openvswitch,linuxbridge
165
+        iniset $NEUTRON_PLUGIN_CONF ml2_type_vxlan vni_ranges 1001:2000
166
+    fi
167
+
168
+    # Neutron OVS or LB agent
169
+    if is_service_enabled neutron-agent; then
170
+        iniset $NEUTRON_PLUGIN_CONF agent tunnel_types vxlan
171
+
172
+        # Configure the neutron agent
173
+        if [[ $NEUTRON_AGENT == "linuxbridge" ]]; then
174
+            iniset $NEUTRON_PLUGIN_CONF securitygroup iptables
175
+            iniset $NEUTRON_PLUGIN_CONF vxlan local_ip $HOST_IP
176
+        else
177
+            iniset $NEUTRON_PLUGIN_CONF securitygroup iptables_hybrid
178
+            iniset $NEUTRON_PLUGIN_CONF ovs local_ip $HOST_IP
179
+        fi
180
+    fi
181
+
182
+    # DHCP Agent
183
+    if is_service_enabled neutron-dhcp; then
184
+        cp $NEUTRON_DIR/etc/dhcp_agent.ini.sample $NEUTRON_DHCP_CONF
185
+
186
+        iniset $NEUTRON_DHCP_CONF DEFAULT verbose True
187
+        iniset $NEUTRON_DHCP_CONF DEFAULT debug True
188
+        iniset $NEUTRON_DHCP_CONF agent root_helper_daemon "$NEUTRON_ROOTWRAP_DAEMON_CMD"
189
+        iniset $NEUTRON_DHCP_CONF DEFAULT interface_driver $NEUTRON_AGENT
190
+        neutron_plugin_configure_dhcp_agent $NEUTRON_DHCP_CONF
191
+    fi
192
+
193
+    if is_service_enabled neutron-l3; then
194
+        cp $NEUTRON_DIR/etc/l3_agent.ini.sample $NEUTRON_L3_CONF
195
+        iniset $NEUTRON_L3_CONF DEFAULT interface_driver $NEUTRON_AGENT
196
+        iniset $NEUTRON_CONF DEFAULT service_plugins router
197
+        iniset $NEUTRON_L3_CONF agent root_helper_daemon "$NEUTRON_ROOTWRAP_DAEMON_CMD"
198
+        iniset $NEUTRON_L3_CONF DEFAULT debug True
199
+        iniset $NEUTRON_L3_CONF DEFAULT verbose True
200
+        neutron_plugin_configure_l3_agent $NEUTRON_L3_CONF
201
+    fi
202
+
203
+    # Metadata
204
+    if is_service_enabled neutron-meta; then
205
+        cp $NEUTRON_DIR/etc/metadata_agent.ini.sample $NEUTRON_META_CONF
206
+
207
+        iniset $NEUTRON_META_CONF DEFAULT verbose True
208
+        iniset $NEUTRON_META_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
209
+        iniset $NEUTRON_META_CONF DEFAULT nova_metadata_ip $SERVICE_HOST
210
+        iniset $NEUTRON_META_CONF agent root_helper_daemon "$NEUTRON_ROOTWRAP_DAEMON_CMD"
211
+
212
+        # TODO(dtroyer): remove the v2.0 hard code below
213
+        iniset $NEUTRON_META_CONF DEFAULT auth_url $KEYSTONE_SERVICE_URI/v2.0
214
+        configure_auth_token_middleware $NEUTRON_META_CONF neutron $NEUTRON_AUTH_CACHE_DIR DEFAULT
215
+    fi
216
+
217
+    # Format logging
218
+    if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
219
+        setup_colorized_logging $NEUTRON_CONF DEFAULT project_id
220
+    else
221
+        # Show user_name and project_name by default
222
+        iniset $NEUTRON_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
223
+    fi
224
+
225
+    if is_service_enabled tls-proxy; then
226
+        # Set the service port for a proxy to take the original
227
+        iniset $NEUTRON_CONF DEFAULT bind_port "$NEUTRON_SERVICE_PORT_INT"
228
+    fi
229
+
230
+    if is_ssl_enabled_service "nova"; then
231
+        iniset $NEUTRON_CONF nova cafile $SSL_BUNDLE_FILE
232
+    fi
233
+
234
+    if is_ssl_enabled_service "neutron"; then
235
+        ensure_certificates NEUTRON
236
+
237
+        iniset $NEUTRON_CONF DEFAULT use_ssl True
238
+        iniset $NEUTRON_CONF DEFAULT ssl_cert_file "$NEUTRON_SSL_CERT"
239
+        iniset $NEUTRON_CONF DEFAULT ssl_key_file "$NEUTRON_SSL_KEY"
240
+    fi
241
+
242
+}
243
+
244
+# configure_neutron_rootwrap() - configure Neutron's rootwrap
245
+function configure_neutron_rootwrap {
246
+    # Set the paths of certain binaries
247
+    neutron_rootwrap=$(get_rootwrap_location neutron)
248
+
249
+    # Specify ``rootwrap.conf`` as first parameter to neutron-rootwrap
250
+    local rootwrap_sudoer_cmd="${neutron_rootwrap} $NEUTRON_CONF_DIR/rootwrap.conf"
251
+
252
+    # Deploy new rootwrap filters files (owned by root).
253
+    # Wipe any existing rootwrap.d files first
254
+    if [[ -d $NEUTRON_CONF_DIR/rootwrap.d ]]; then
255
+        sudo rm -rf $NEUTRON_CONF_DIR/rootwrap.d
256
+    fi
257
+
258
+    # Deploy filters to /etc/neutron/rootwrap.d
259
+    sudo install -d -o root -g root -m 755 $NEUTRON_CONF_DIR/rootwrap.d
260
+    sudo install -o root -g root -m 644 $NEUTRON_DIR/etc/neutron/rootwrap.d/*.filters $NEUTRON_CONF_DIR/rootwrap.d
261
+
262
+    # Set up ``rootwrap.conf``, pointing to ``$NEUTRON_CONF_DIR/rootwrap.d``
263
+    sudo install -o root -g root -m 644 $NEUTRON_DIR/etc/rootwrap.conf $NEUTRON_CONF_DIR
264
+    sudo sed -e "s:^filters_path=.*$:filters_path=$NEUTRON_CONF_DIR/rootwrap.d:" -i $NEUTRON_CONF_DIR/rootwrap.conf
265
+
266
+    # Set up the rootwrap sudoers for Neutron
267
+    tempfile=`mktemp`
268
+    echo "$STACK_USER ALL=(root) NOPASSWD: $rootwrap_sudoer_cmd *" >$tempfile
269
+    chmod 0440 $tempfile
270
+    sudo chown root:root $tempfile
271
+    sudo mv $tempfile /etc/sudoers.d/neutron-rootwrap
272
+}
273
+
274
+# Make Neutron-required changes to nova.conf
275
+function configure_neutron_nova_new {
276
+    iniset $NOVA_CONF DEFAULT use_neutron True
277
+    iniset $NOVA_CONF neutron auth_type "password"
278
+    iniset $NOVA_CONF neutron auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v3"
279
+    iniset $NOVA_CONF neutron username neutron
280
+    iniset $NOVA_CONF neutron password "$SERVICE_PASSWORD"
281
+    iniset $NOVA_CONF neutron user_domain_name "Default"
282
+    iniset $NOVA_CONF neutron project_name "$SERVICE_TENANT_NAME"
283
+    iniset $NOVA_CONF neutron project_domain_name "Default"
284
+    iniset $NOVA_CONF neutron auth_strategy $NEUTRON_AUTH_STRATEGY
285
+    iniset $NOVA_CONF neutron region_name "$REGION_NAME"
286
+    iniset $NOVA_CONF neutron url $NEUTRON_SERVICE_PROTOCOL://$NEUTRON_SERVICE_HOST:$NEUTRON_SERVICE_PORT
287
+
288
+    iniset $NOVA_CONF DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
289
+
290
+    if is_service_enabled neutron-meta; then
291
+        iniset $NOVA_CONF neutron service_metadata_proxy "True"
292
+    fi
293
+
294
+}
295
+
296
+# Tenant               User       Roles
297
+# ------------------------------------------------------------------
298
+# service              neutron    admin        # if enabled
299
+
300
+# create_neutron_accounts() - Create required service accounts
301
+function create_neutron_accounts_new {
302
+    if [[ "$ENABLED_SERVICES" =~ "neutron-api" ]]; then
303
+
304
+        create_service_user "neutron"
305
+
306
+        neutron_service=$(get_or_create_service "neutron" \
307
+            "network" "Neutron Service")
308
+        get_or_create_endpoint $neutron_service \
309
+            "$REGION_NAME" \
310
+            "$NEUTRON_SERVICE_PROTOCOL://$NEUTRON_SERVICE_HOST:$NEUTRON_SERVICE_PORT/" \
311
+            "$NEUTRON_SERVICE_PROTOCOL://$NEUTRON_SERVICE_HOST:$NEUTRON_SERVICE_PORT/" \
312
+            "$NEUTRON_SERVICE_PROTOCOL://$NEUTRON_SERVICE_HOST:$NEUTRON_SERVICE_PORT/"
313
+    fi
314
+}
315
+
316
+# create_neutron_cache_dir() - Part of the init_neutron() process
317
+function create_neutron_cache_dir {
318
+    # Create cache dir
319
+    sudo install -d -o $STACK_USER $NEUTRON_AUTH_CACHE_DIR
320
+    rm -f $NEUTRON_AUTH_CACHE_DIR/*
321
+}
322
+
323
+# init_neutron() - Initialize databases, etc.
324
+function init_neutron_new {
325
+
326
+    recreate_database neutron
327
+
328
+    # Run Neutron db migrations
329
+    $NEUTRON_BIN_DIR/neutron-db-manage $NEUTRON_CONFIG_ARG upgrade heads
330
+
331
+    create_neutron_cache_dir
332
+}
333
+
334
+# install_neutron() - Collect source and prepare
335
+function install_neutron_new {
336
+    git_clone $NEUTRON_REPO $NEUTRON_DIR $NEUTRON_BRANCH
337
+    setup_develop $NEUTRON_DIR
338
+
339
+    # Install neutron-lib from git so we make sure we're testing
340
+    # the latest code.
341
+    if use_library_from_git "neutron-lib"; then
342
+        git_clone_by_name "neutron-lib"
343
+        setup_dev_lib "neutron-lib"
344
+    fi
345
+
346
+    # L3 service requires radvd
347
+    if is_service_enabled neutron-l3; then
348
+        install_package radvd
349
+    fi
350
+
351
+    if is_service_enabled neutron-agent neutron-dhcp neutron-l3; then
352
+        #TODO(sc68cal) - kind of ugly
353
+        source $TOP_DIR/lib/neutron_plugins/${NEUTRON_AGENT}_agent
354
+        neutron_plugin_install_agent_packages
355
+    fi
356
+
357
+}
358
+
359
+# install_neutronclient() - Collect source and prepare
360
+function install_neutronclient {
361
+    if use_library_from_git "python-neutronclient"; then
362
+        git_clone_by_name "python-neutronclient"
363
+        setup_dev_lib "python-neutronclient"
364
+        sudo install -D -m 0644 -o $STACK_USER {${GITDIR["python-neutronclient"]}/tools/,/etc/bash_completion.d/}neutron.bash_completion
365
+    fi
366
+}
367
+
368
+# start_neutron_api() - Start the API process ahead of other things
369
+function start_neutron_api {
370
+    local service_port=$NEUTRON_SERVICE_PORT
371
+    local service_protocol=$NEUTRON_SERVICE_PROTOCOL
372
+    if is_service_enabled tls-proxy; then
373
+        service_port=$NEUTRON_SERVICE_PORT_INT
374
+        service_protocol="http"
375
+    fi
376
+
377
+    # Start the Neutron service
378
+    # TODO(sc68cal) Stop hard coding this
379
+    run_process neutron-api "$NEUTRON_BIN_DIR/neutron-server --config-file $NEUTRON_CONF --config-file $NEUTRON_PLUGIN_CONF"
380
+
381
+    if is_ssl_enabled_service "neutron"; then
382
+        ssl_ca="--ca-certificate=${SSL_BUNDLE_FILE}"
383
+        local testcmd="wget ${ssl_ca} --no-proxy -q -O- $service_protocol://$NEUTRON_SERVICE_HOST:$service_port"
384
+        test_with_retry "$testcmd" "Neutron did not start" $SERVICE_TIMEOUT
385
+    else
386
+        if ! wait_for_service $SERVICE_TIMEOUT $service_protocol://$NEUTRON_SERVICE_HOST:$service_port; then
387
+            die $LINENO "neutron-api did not start"
388
+        fi
389
+    fi
390
+
391
+
392
+    # Start proxy if enabled
393
+    if is_service_enabled tls-proxy; then
394
+        start_tls_proxy '*' $NEUTRON_SERVICE_PORT $NEUTRON_SERVICE_HOST $NEUTRON_SERVICE_PORT_INT &
395
+    fi
396
+}
397
+
398
+# start_neutron() - Start running processes, including screen
399
+function start_neutron_new {
400
+    _set_config_files
401
+
402
+    # Start up the neutron agents if enabled
403
+    # TODO(sc68cal) Make this pluggable so different DevStack plugins for different Neutron plugins
404
+    # can resolve the $NEUTRON_AGENT_BINARY
405
+    if is_service_enabled neutron-agent; then
406
+        run_process neutron-agent "$NEUTRON_BIN_DIR/$NEUTRON_AGENT_BINARY $NEUTRON_CONFIG_ARG"
407
+    fi
408
+    if is_service_enabled neutron-dhcp; then
409
+        neutron_plugin_configure_dhcp_agent $NEUTRON_DHCP_CONF
410
+        run_process neutron-dhcp "$NEUTRON_BIN_DIR/$NEUTRON_DHCP_BINARY $NEUTRON_CONFIG_ARG"
411
+    fi
412
+    if is_service_enabled neutron-l3; then
413
+        run_process neutron-l3 "$NEUTRON_BIN_DIR/$NEUTRON_L3_BINARY $NEUTRON_CONFIG_ARG"
414
+        # XXX(sc68cal) - Here's where plugins can wire up their own networks instead
415
+        # of the code in lib/neutron_plugins/services/l3
416
+        if type -p neutron_plugin_create_initial_networks > /dev/null; then
417
+            neutron_plugin_create_initial_networks
418
+        else
419
+            # XXX(sc68cal) Load up the built in Neutron networking code and build a topology
420
+            source $TOP_DIR/lib/neutron_plugins/services/l3
421
+            # Create the networks using servic
422
+            create_neutron_initial_network
423
+        fi
424
+    fi
425
+    if is_service_enabled neutron-meta; then
426
+        run_process neutron-meta "$NEUTRON_BIN_DIR/$NEUTRON_META_BINARY $NEUTRON_CONFIG_ARG"
427
+    fi
428
+}
429
+
430
+# stop_neutron() - Stop running processes (non-screen)
431
+function stop_neutron_new {
432
+    for serv in neutron-api neutron-agent neutron-l3; do
433
+        stop_process $serv
434
+    done
435
+
436
+    if is_service_enabled neutron-dhcp; then
437
+        stop_process neutron-dhcp
438
+        pid=$(ps aux | awk '/[d]nsmasq.+interface=(tap|ns-)/ { print $2 }')
439
+        [ ! -z "$pid" ] && sudo kill -9 $pid
440
+    fi
441
+
442
+    if is_service_enabled neutron-meta; then
443
+        sudo pkill -9 -f neutron-ns-metadata-proxy || :
444
+        stop_process neutron-meta
445
+    fi
446
+}
447
+
448
+# Compile the lost of enabled config files
449
+function _set_config_files {
450
+
451
+    #TODO(sc68cal) - see if we can clean up this and only
452
+    # pass in config files that make sense for certain agents
453
+    if is_service_enabled neutron-api; then
454
+        NEUTRON_CONFIG_ARG+=" --config-file $NEUTRON_CONF"
455
+    fi
456
+
457
+    #TODO(sc68cal) OVS and LB agent uses settings in NEUTRON_PLUGIN_CONF (ml2_conf.ini) but others may not
458
+    if is_service_enabled neutron-agent; then
459
+        NEUTRON_CONFIG_ARG+=" --config-file $NEUTRON_PLUGIN_CONF"
460
+    fi
461
+
462
+    if is_service_enabled neutron-dhcp; then
463
+        NEUTRON_CONFIG_ARG+=" --config-file $NEUTRON_DHCP_CONF"
464
+    fi
465
+
466
+    if is_service_enabled neutron-l3; then
467
+        NEUTRON_CONFIG_ARG+=" --config-file $NEUTRON_L3_CONF"
468
+    fi
469
+
470
+    if is_service_enabled neutron-meta; then
471
+        NEUTRON_CONFIG_ARG+=" --config-file $NEUTRON_META_CONF"
472
+    fi
473
+
474
+}
475
+
476
+# Dispatch functions
477
+# These are needed for compatibility between the old and new implementations
478
+# where there are function name overlaps.  These will be removed when
479
+# neutron-legacy is removed.
480
+# TODO(sc68cal) Remove when neutron-legacy is no more.
481
+function cleanup_neutron {
482
+    if is_neutron_legacy_enabled; then
483
+        # Call back to old function
484
+        cleanup_mutnauq "$@"
485
+    else
486
+        cleanup_neutron_new "$@"
487
+    fi
488
+}
489
+
490
+function configure_neutron {
491
+    if is_neutron_legacy_enabled; then
492
+        # Call back to old function
493
+        configure_mutnauq "$@"
494
+    else
495
+        configure_neutron_new "$@"
496
+    fi
497
+}
498
+
499
+function configure_neutron_nova {
500
+    if is_neutron_legacy_enabled; then
501
+        # Call back to old function
502
+        create_nova_conf_neutron "$@"
503
+    else
504
+        configure_neutron_nova_new "$@"
505
+    fi
506
+}
507
+
508
+function create_neutron_accounts {
509
+    if is_neutron_legacy_enabled; then
510
+        # Call back to old function
511
+        create_mutnauq_accounts "$@"
512
+    else
513
+        create_neutron_accounts_new "$@"
514
+    fi
515
+}
516
+
517
+function init_neutron {
518
+    if is_neutron_legacy_enabled; then
519
+        # Call back to old function
520
+        init_mutnauq "$@"
521
+    else
522
+        init_neutron_new "$@"
523
+    fi
524
+}
525
+
526
+function install_neutron {
527
+    if is_neutron_legacy_enabled; then
528
+        # Call back to old function
529
+        install_mutnauq "$@"
530
+    else
531
+        install_neutron_new "$@"
532
+    fi
533
+}
534
+
535
+function start_neutron {
536
+    if is_neutron_legacy_enabled; then
537
+        # Call back to old function
538
+        start_mutnauq_l2_agent "$@"
539
+        start_mutnauq_other_agents "$@"
540
+    else
541
+        start_neutron_new "$@"
542
+    fi
543
+}
544
+
545
+function stop_neutron {
546
+    if is_neutron_legacy_enabled; then
547
+        # Call back to old function
548
+        stop_mutnauq "$@"
549
+    else
550
+        stop_neutron_new "$@"
551
+    fi
552
+}
553
+
554
+# Restore xtrace
555
+$XTRACE
... ...
@@ -61,45 +61,12 @@
61 61
 # Neutron Network Configuration
62 62
 # -----------------------------
63 63
 
64
-# Subnet IP version
65
-IP_VERSION=${IP_VERSION:-"4+6"}
66
-# Validate IP_VERSION
67
-if [[ $IP_VERSION != "4" ]] && [[ $IP_VERSION != "6" ]] && [[ $IP_VERSION != "4+6" ]]; then
68
-    die $LINENO "IP_VERSION must be either 4, 6, or 4+6"
69
-fi
70
-# Gateway and subnet defaults, in case they are not customized in localrc
71
-NETWORK_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1}
72
-PUBLIC_NETWORK_GATEWAY=${PUBLIC_NETWORK_GATEWAY:-172.24.4.1}
73
-PRIVATE_SUBNET_NAME=${PRIVATE_SUBNET_NAME:-"private-subnet"}
74
-PUBLIC_SUBNET_NAME=${PUBLIC_SUBNET_NAME:-"public-subnet"}
75
-
76
-# Subnetpool defaults
77
-SUBNETPOOL_NAME=${SUBNETPOOL_NAME:-"shared-default-subnetpool"}
78
-
79
-SUBNETPOOL_PREFIX_V4=${SUBNETPOOL_PREFIX_V4:-10.0.0.0/8}
80
-SUBNETPOOL_PREFIX_V6=${SUBNETPOOL_PREFIX_V6:-2001:db8:8000::/48}
81
-
82
-SUBNETPOOL_SIZE_V4=${SUBNETPOOL_SIZE_V4:-24}
83
-SUBNETPOOL_SIZE_V6=${SUBNETPOOL_SIZE_V6:-64}
84 64
 
85 65
 
86 66
 if is_ssl_enabled_service "neutron" || is_service_enabled tls-proxy; then
87 67
     Q_PROTOCOL="https"
88 68
 fi
89 69
 
90
-# Generate 40-bit IPv6 Global ID to comply with RFC 4193
91
-IPV6_GLOBAL_ID=`uuidgen | sed s/-//g | cut -c 23- | sed -e "s/\(..\)\(....\)\(....\)/\1:\2:\3/"`
92
-
93
-# IPv6 gateway and subnet defaults, in case they are not customized in localrc
94
-IPV6_RA_MODE=${IPV6_RA_MODE:-slaac}
95
-IPV6_ADDRESS_MODE=${IPV6_ADDRESS_MODE:-slaac}
96
-IPV6_PUBLIC_SUBNET_NAME=${IPV6_PUBLIC_SUBNET_NAME:-ipv6-public-subnet}
97
-IPV6_PRIVATE_SUBNET_NAME=${IPV6_PRIVATE_SUBNET_NAME:-ipv6-private-subnet}
98
-FIXED_RANGE_V6=${FIXED_RANGE_V6:-fd$IPV6_GLOBAL_ID::/64}
99
-IPV6_PRIVATE_NETWORK_GATEWAY=${IPV6_PRIVATE_NETWORK_GATEWAY:-fd$IPV6_GLOBAL_ID::1}
100
-IPV6_PUBLIC_RANGE=${IPV6_PUBLIC_RANGE:-2001:db8::/64}
101
-IPV6_PUBLIC_NETWORK_GATEWAY=${IPV6_PUBLIC_NETWORK_GATEWAY:-2001:db8::2}
102
-IPV6_ROUTER_GW_IP=${IPV6_ROUTER_GW_IP:-2001:db8::1}
103 70
 
104 71
 # Set up default directories
105 72
 GITDIR["python-neutronclient"]=$DEST/python-neutronclient
... ...
@@ -171,56 +138,6 @@ Q_NOTIFY_NOVA_PORT_STATUS_CHANGES=${Q_NOTIFY_NOVA_PORT_STATUS_CHANGES:-True}
171 171
 Q_NOTIFY_NOVA_PORT_DATA_CHANGES=${Q_NOTIFY_NOVA_PORT_DATA_CHANGES:-True}
172 172
 VIF_PLUGGING_IS_FATAL=${VIF_PLUGGING_IS_FATAL:-True}
173 173
 VIF_PLUGGING_TIMEOUT=${VIF_PLUGGING_TIMEOUT:-300}
174
-# Specify if the initial private and external networks should be created
175
-NEUTRON_CREATE_INITIAL_NETWORKS=${NEUTRON_CREATE_INITIAL_NETWORKS:-True}
176
-
177
-## Provider Network Information
178
-PROVIDER_SUBNET_NAME=${PROVIDER_SUBNET_NAME:-"provider_net"}
179
-IPV6_PROVIDER_SUBNET_NAME=${IPV6_PROVIDER_SUBNET_NAME:-"provider_net_v6"}
180
-IPV6_PROVIDER_FIXED_RANGE=${IPV6_PROVIDER_FIXED_RANGE:-}
181
-IPV6_PROVIDER_NETWORK_GATEWAY=${IPV6_PROVIDER_NETWORK_GATEWAY:-}
182
-
183
-# Define the public bridge that will transmit traffic from VMs to the
184
-# physical network - used by both the OVS and Linux Bridge drivers.
185
-PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex}
186
-
187
-# Use flat providernet for public network
188
-#
189
-# If Q_USE_PROVIDERNET_FOR_PUBLIC=True, use a flat provider network
190
-# for external interface of neutron l3-agent.  In that case,
191
-# PUBLIC_PHYSICAL_NETWORK specifies provider:physical_network value
192
-# used for the network.  In case of ofagent, you should add the
193
-# corresponding entry to your OFAGENT_PHYSICAL_INTERFACE_MAPPINGS.
194
-# For openvswitch agent, you should add the corresponding entry to
195
-# your OVS_BRIDGE_MAPPINGS.
196
-#
197
-# eg.  (ofagent)
198
-#    Q_USE_PROVIDERNET_FOR_PUBLIC=True
199
-#    Q_USE_PUBLIC_VETH=True
200
-#    PUBLIC_PHYSICAL_NETWORK=public
201
-#    OFAGENT_PHYSICAL_INTERFACE_MAPPINGS=public:veth-pub-int
202
-#
203
-# eg.  (openvswitch agent)
204
-#    Q_USE_PROVIDERNET_FOR_PUBLIC=True
205
-#    PUBLIC_PHYSICAL_NETWORK=public
206
-#    OVS_BRIDGE_MAPPINGS=public:br-ex
207
-Q_USE_PROVIDERNET_FOR_PUBLIC=${Q_USE_PROVIDERNET_FOR_PUBLIC:-False}
208
-PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK:-public}
209
-
210
-# If Q_USE_PUBLIC_VETH=True, create and use a veth pair instead of
211
-# PUBLIC_BRIDGE.  This is intended to be used with
212
-# Q_USE_PROVIDERNET_FOR_PUBLIC=True.
213
-Q_USE_PUBLIC_VETH=${Q_USE_PUBLIC_VETH:-False}
214
-Q_PUBLIC_VETH_EX=${Q_PUBLIC_VETH_EX:-veth-pub-ex}
215
-Q_PUBLIC_VETH_INT=${Q_PUBLIC_VETH_INT:-veth-pub-int}
216
-
217
-# The next two variables are configured by plugin
218
-# e.g.  _configure_neutron_l3_agent or lib/neutron_plugins/*
219
-#
220
-# The plugin supports L3.
221
-Q_L3_ENABLED=${Q_L3_ENABLED:-False}
222
-# L3 routers exist per tenant
223
-Q_L3_ROUTER_PER_TENANT=${Q_L3_ROUTER_PER_TENANT:-True}
224 174
 
225 175
 # List of config file names in addition to the main plugin config file
226 176
 # See _configure_neutron_common() for details about setting it up
... ...
@@ -354,6 +271,9 @@ source $TOP_DIR/lib/neutron_plugins/services/metering
354 354
 # ---------------------------------
355 355
 source $TOP_DIR/lib/neutron_plugins/services/firewall
356 356
 
357
+# L3 Service functions
358
+source $TOP_DIR/lib/neutron_plugins/services/l3
359
+
357 360
 # Use security group or not
358 361
 if has_neutron_plugin_security_group; then
359 362
     Q_USE_SECGROUP=${Q_USE_SECGROUP:-True}
... ...
@@ -400,16 +320,9 @@ function determine_config_files {
400 400
     echo "$opts"
401 401
 }
402 402
 
403
-# Test if any Neutron services are enabled
404
-# is_neutron_enabled
405
-function is_neutron_enabled {
406
-    [[ ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0
407
-    return 1
408
-}
409
-
410
-# configure_neutron()
403
+# configure_mutnauq()
411 404
 # Set common config for all neutron server and agents.
412
-function configure_neutron {
405
+function configure_mutnauq {
413 406
     _configure_neutron_common
414 407
     iniset_rpc_backend neutron $NEUTRON_CONF
415 408
 
... ...
@@ -482,21 +395,14 @@ function create_nova_conf_neutron {
482 482
     iniset $NOVA_CONF DEFAULT vif_plugging_timeout "$VIF_PLUGGING_TIMEOUT"
483 483
 }
484 484
 
485
-# create_neutron_cache_dir() - Part of the _neutron_setup_keystone() process
486
-function create_neutron_cache_dir {
487
-    # Create cache dir
488
-    sudo install -d -o $STACK_USER $NEUTRON_AUTH_CACHE_DIR
489
-    rm -f $NEUTRON_AUTH_CACHE_DIR/*
490
-}
491
-
492
-# create_neutron_accounts() - Set up common required neutron accounts
485
+# create_mutnauq_accounts() - Set up common required neutron accounts
493 486
 
494 487
 # Tenant               User       Roles
495 488
 # ------------------------------------------------------------------
496 489
 # service              neutron    admin        # if enabled
497 490
 
498 491
 # Migrated from keystone_data.sh
499
-function create_neutron_accounts {
492
+function create_mutnauq_accounts {
500 493
     if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
501 494
 
502 495
         create_service_user "neutron"
... ...
@@ -511,107 +417,15 @@ function create_neutron_accounts {
511 511
     fi
512 512
 }
513 513
 
514
-function create_neutron_initial_network {
515
-    local project_id
516
-    project_id=$(openstack project list | grep " demo " | get_field 1)
517
-    die_if_not_set $LINENO project_id "Failure retrieving project_id for demo"
518
-
519
-    # Allow drivers that need to create an initial network to do so here
520
-    if type -p neutron_plugin_create_initial_network_profile > /dev/null; then
521
-        neutron_plugin_create_initial_network_profile $PHYSICAL_NETWORK
522
-    fi
523
-
524
-    if is_provider_network; then
525
-        die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK"
526
-        die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specify the PROVIDER_NETWORK_TYPE"
527
-        NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create $PHYSICAL_NETWORK --tenant_id $project_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)
528
-        die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $project_id"
529
-
530
-        if [[ "$IP_VERSION" =~ 4.* ]]; then
531
-            SUBNET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create --tenant_id $project_id --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --name $PROVIDER_SUBNET_NAME --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
532
-            die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $PROVIDER_SUBNET_NAME $project_id"
533
-        fi
534
-
535
-        if [[ "$IP_VERSION" =~ .*6 ]] && [[ -n "$IPV6_PROVIDER_FIXED_RANGE" ]] && [[ -n "$IPV6_PROVIDER_NETWORK_GATEWAY" ]]; then
536
-            SUBNET_V6_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create --tenant_id $project_id --ip_version 6 --ipv6-address-mode $IPV6_ADDRESS_MODE --gateway $IPV6_PROVIDER_NETWORK_GATEWAY --name $IPV6_PROVIDER_SUBNET_NAME $NET_ID $IPV6_PROVIDER_FIXED_RANGE | grep 'id' | get_field 2)
537
-            die_if_not_set $LINENO SUBNET_V6_ID "Failure creating SUBNET_V6_ID for $IPV6_PROVIDER_SUBNET_NAME $project_id"
538
-        fi
539
-
540
-        if [[ $Q_AGENT == "openvswitch" ]]; then
541
-            sudo ip link set $OVS_PHYSICAL_BRIDGE up
542
-            sudo ip link set br-int up
543
-            sudo ip link set $PUBLIC_INTERFACE up
544
-        fi
545
-    else
546
-        NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create --tenant-id $project_id "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
547
-        die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PRIVATE_NETWORK_NAME $project_id"
548
-
549
-        if [[ "$IP_VERSION" =~ 4.* ]]; then
550
-            # Create IPv4 private subnet
551
-            SUBNET_ID=$(_neutron_create_private_subnet_v4 $project_id)
552
-        fi
553
-
554
-        if [[ "$IP_VERSION" =~ .*6 ]]; then
555
-            # Create IPv6 private subnet
556
-            IPV6_SUBNET_ID=$(_neutron_create_private_subnet_v6 $project_id)
557
-        fi
558
-    fi
559
-
560
-    AUTO_ALLOCATE_EXT=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" ext-list | grep 'auto-allocated-topology' | get_field 1)
561
-    SUBNETPOOL_EXT=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" ext-list | grep 'subnet_allocation' | get_field 1)
562
-    if [[ "$Q_L3_ENABLED" == "True" ]]; then
563
-        # Create a router, and add the private subnet as one of its interfaces
564
-        if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then
565
-            # create a tenant-owned router.
566
-            ROUTER_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-create --tenant-id $project_id $Q_ROUTER_NAME | grep ' id ' | get_field 2)
567
-            die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $project_id $Q_ROUTER_NAME"
568
-        else
569
-            # Plugin only supports creating a single router, which should be admin owned.
570
-            ROUTER_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
571
-            die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $Q_ROUTER_NAME"
572
-        fi
573
-
574
-        # if the extension is available, then mark the external
575
-        # network as default, and provision default subnetpools
576
-        EXTERNAL_NETWORK_FLAGS="--router:external"
577
-        if [[ -n $AUTO_ALLOCATE_EXT && -n $SUBNETPOOL_EXT ]]; then
578
-            EXTERNAL_NETWORK_FLAGS="$EXTERNAL_NETWORK_FLAGS --is-default"
579
-            if [[ "$IP_VERSION" =~ 4.* ]]; then
580
-                SUBNETPOOL_V4_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V4 --pool-prefix $SUBNETPOOL_PREFIX_V4 --shared --is-default=True | grep ' id ' | get_field 2)
581
-            fi
582
-            if [[ "$IP_VERSION" =~ .*6 ]]; then
583
-                SUBNETPOOL_V6_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V6 --pool-prefix $SUBNETPOOL_PREFIX_V6 --shared --is-default=True | grep ' id ' | get_field 2)
584
-            fi
585
-        fi
586
-        # Create an external network, and a subnet. Configure the external network as router gw
587
-        if [ "$Q_USE_PROVIDERNET_FOR_PUBLIC" = "True" ]; then
588
-            EXT_NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create "$PUBLIC_NETWORK_NAME" -- $EXTERNAL_NETWORK_FLAGS --provider:network_type=flat --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} | grep ' id ' | get_field 2)
589
-        else
590
-            EXT_NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create "$PUBLIC_NETWORK_NAME" -- $EXTERNAL_NETWORK_FLAGS | grep ' id ' | get_field 2)
591
-        fi
592
-        die_if_not_set $LINENO EXT_NET_ID "Failure creating EXT_NET_ID for $PUBLIC_NETWORK_NAME"
593
-
594
-        if [[ "$IP_VERSION" =~ 4.* ]]; then
595
-            # Configure router for IPv4 public access
596
-            _neutron_configure_router_v4
597
-        fi
598
-
599
-        if [[ "$IP_VERSION" =~ .*6 ]]; then
600
-            # Configure router for IPv6 public access
601
-            _neutron_configure_router_v6
602
-        fi
603
-    fi
604
-}
605
-
606
-# init_neutron() - Initialize databases, etc.
607
-function init_neutron {
514
+# init_mutnauq() - Initialize databases, etc.
515
+function init_mutnauq {
608 516
     recreate_database $Q_DB_NAME
609 517
     # Run Neutron db migrations
610 518
     $NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
611 519
 }
612 520
 
613
-# install_neutron() - Collect source and prepare
614
-function install_neutron {
521
+# install_mutnauq() - Collect source and prepare
522
+function install_mutnauq {
615 523
     # Install neutron-lib from git so we make sure we're testing
616 524
     # the latest code.
617 525
     if use_library_from_git "neutron-lib"; then
... ...
@@ -649,15 +463,6 @@ function install_neutron {
649 649
     fi
650 650
 }
651 651
 
652
-# install_neutronclient() - Collect source and prepare
653
-function install_neutronclient {
654
-    if use_library_from_git "python-neutronclient"; then
655
-        git_clone_by_name "python-neutronclient"
656
-        setup_dev_lib "python-neutronclient"
657
-        sudo install -D -m 0644 -o $STACK_USER {${GITDIR["python-neutronclient"]}/tools/,/etc/bash_completion.d/}neutron.bash_completion
658
-    fi
659
-}
660
-
661 652
 # install_neutron_agent_packages() - Collect source and prepare
662 653
 function install_neutron_agent_packages {
663 654
     # radvd doesn't come with the OS. Install it if the l3 service is enabled.
... ...
@@ -704,7 +509,7 @@ function start_neutron_service_and_check {
704 704
 
705 705
 # Control of the l2 agent is separated out to make it easier to test partial
706 706
 # upgrades (everything upgraded except the L2 agent)
707
-function start_neutron_l2_agent {
707
+function start_mutnauq_l2_agent {
708 708
     run_process q-agt "$AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE"
709 709
 
710 710
     if is_provider_network && [[ $Q_AGENT == "openvswitch" ]]; then
... ...
@@ -722,7 +527,7 @@ function start_neutron_l2_agent {
722 722
     fi
723 723
 }
724 724
 
725
-function start_neutron_other_agents {
725
+function start_mutnauq_other_agents {
726 726
     run_process q-dhcp "$AGENT_DHCP_BINARY --config-file $NEUTRON_CONF --config-file=$Q_DHCP_CONF_FILE"
727 727
 
728 728
     if is_service_enabled neutron-vpnaas; then
... ...
@@ -744,15 +549,16 @@ function start_neutron_other_agents {
744 744
 # Start running processes, including screen
745 745
 function start_neutron_agents {
746 746
     # Start up the neutron agents if enabled
747
-    start_neutron_l2_agent
748
-    start_neutron_other_agents
747
+    start_mutnauq_l2_agent
748
+    start_mutnauq_other_agents
749 749
 }
750 750
 
751
-function stop_neutron_l2_agent {
751
+function stop_mutnauq_l2_agent {
752 752
     stop_process q-agt
753 753
 }
754 754
 
755
-function stop_neutron_other {
755
+# stop_mutnauq_other() - Stop running processes (non-screen)
756
+function stop_mutnauq_other {
756 757
     if is_service_enabled q-dhcp; then
757 758
         stop_process q-dhcp
758 759
         pid=$(ps aux | awk '/[d]nsmasq.+interface=(tap|ns-)/ { print $2 }')
... ...
@@ -787,9 +593,9 @@ function stop_neutron_other {
787 787
 }
788 788
 
789 789
 # stop_neutron() - Stop running processes (non-screen)
790
-function stop_neutron {
791
-    stop_neutron_other
792
-    stop_neutron_l2_agent
790
+function stop_mutnauq {
791
+    stop_mutnauq_other
792
+    stop_mutnauq_l2_agent
793 793
 }
794 794
 
795 795
 # _move_neutron_addresses_route() - Move the primary IP to the OVS bridge
... ...
@@ -842,9 +648,9 @@ function _move_neutron_addresses_route {
842 842
     fi
843 843
 }
844 844
 
845
-# cleanup_neutron() - Remove residual data files, anything left over from previous
845
+# cleanup_mutnauq() - Remove residual data files, anything left over from previous
846 846
 # runs that a clean run would need to clean up
847
-function cleanup_neutron {
847
+function cleanup_mutnauq {
848 848
 
849 849
     if [[ -n "$OVS_PHYSICAL_BRIDGE" ]]; then
850 850
         _move_neutron_addresses_route "$OVS_PHYSICAL_BRIDGE" "$PUBLIC_INTERFACE" False True "inet"
... ...
@@ -1031,27 +837,6 @@ function _configure_neutron_dhcp_agent {
1031 1031
     neutron_plugin_configure_dhcp_agent
1032 1032
 }
1033 1033
 
1034
-function _configure_neutron_l3_agent {
1035
-    Q_L3_ENABLED=True
1036
-
1037
-    cp $NEUTRON_DIR/etc/l3_agent.ini.sample $Q_L3_CONF_FILE
1038
-
1039
-    iniset $Q_L3_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
1040
-    iniset $Q_L3_CONF_FILE AGENT root_helper "$Q_RR_COMMAND"
1041
-    if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
1042
-        iniset $Q_L3_CONF_FILE AGENT root_helper_daemon "$Q_RR_DAEMON_COMMAND"
1043
-    fi
1044
-
1045
-    _neutron_setup_interface_driver $Q_L3_CONF_FILE
1046
-
1047
-    neutron_plugin_configure_l3_agent
1048
-
1049
-    _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True False "inet"
1050
-
1051
-    if [[ $(ip -f inet6 a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then
1052
-        _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" False False "inet6"
1053
-    fi
1054
-}
1055 1034
 
1056 1035
 function _configure_neutron_metadata_agent {
1057 1036
     cp $NEUTRON_DIR/etc/metadata_agent.ini.sample $Q_META_CONF_FILE
... ...
@@ -1226,164 +1011,6 @@ function _neutron_setup_interface_driver {
1226 1226
 
1227 1227
     neutron_plugin_setup_interface_driver $1
1228 1228
 }
1229
-
1230
-# Create private IPv4 subnet
1231
-function _neutron_create_private_subnet_v4 {
1232
-    local project_id=$1
1233
-    local subnet_params="--tenant-id $project_id "
1234
-    subnet_params+="--ip_version 4 "
1235
-    subnet_params+="--gateway $NETWORK_GATEWAY "
1236
-    subnet_params+="--name $PRIVATE_SUBNET_NAME "
1237
-    subnet_params+="$NET_ID $FIXED_RANGE"
1238
-    local subnet_id
1239
-    subnet_id=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep ' id ' | get_field 2)
1240
-    die_if_not_set $LINENO subnet_id "Failure creating private IPv4 subnet for $project_id"
1241
-    echo $subnet_id
1242
-}
1243
-
1244
-# Create private IPv6 subnet
1245
-function _neutron_create_private_subnet_v6 {
1246
-    local project_id=$1
1247
-    die_if_not_set $LINENO IPV6_RA_MODE "IPV6 RA Mode not set"
1248
-    die_if_not_set $LINENO IPV6_ADDRESS_MODE "IPV6 Address Mode not set"
1249
-    local ipv6_modes="--ipv6-ra-mode $IPV6_RA_MODE --ipv6-address-mode $IPV6_ADDRESS_MODE"
1250
-    local subnet_params="--tenant-id $project_id "
1251
-    subnet_params+="--ip_version 6 "
1252
-    subnet_params+="--gateway $IPV6_PRIVATE_NETWORK_GATEWAY "
1253
-    subnet_params+="--name $IPV6_PRIVATE_SUBNET_NAME "
1254
-    subnet_params+="$NET_ID $FIXED_RANGE_V6 $ipv6_modes"
1255
-    local ipv6_subnet_id
1256
-    ipv6_subnet_id=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep ' id ' | get_field 2)
1257
-    die_if_not_set $LINENO ipv6_subnet_id "Failure creating private IPv6 subnet for $project_id"
1258
-    echo $ipv6_subnet_id
1259
-}
1260
-
1261
-# Create public IPv4 subnet
1262
-function _neutron_create_public_subnet_v4 {
1263
-    local subnet_params+="--ip_version 4 "
1264
-    subnet_params+="${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} "
1265
-    subnet_params+="--gateway $PUBLIC_NETWORK_GATEWAY "
1266
-    subnet_params+="--name $PUBLIC_SUBNET_NAME "
1267
-    subnet_params+="$EXT_NET_ID $FLOATING_RANGE "
1268
-    subnet_params+="-- --enable_dhcp=False"
1269
-    local id_and_ext_gw_ip
1270
-    id_and_ext_gw_ip=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep -e 'gateway_ip' -e ' id ')
1271
-    die_if_not_set $LINENO id_and_ext_gw_ip "Failure creating public IPv4 subnet"
1272
-    echo $id_and_ext_gw_ip
1273
-}
1274
-
1275
-# Create public IPv6 subnet
1276
-function _neutron_create_public_subnet_v6 {
1277
-    local subnet_params="--ip_version 6 "
1278
-    subnet_params+="--gateway $IPV6_PUBLIC_NETWORK_GATEWAY "
1279
-    subnet_params+="--name $IPV6_PUBLIC_SUBNET_NAME "
1280
-    subnet_params+="$EXT_NET_ID $IPV6_PUBLIC_RANGE "
1281
-    subnet_params+="-- --enable_dhcp=False"
1282
-    local ipv6_id_and_ext_gw_ip
1283
-    ipv6_id_and_ext_gw_ip=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep -e 'gateway_ip' -e ' id ')
1284
-    die_if_not_set $LINENO ipv6_id_and_ext_gw_ip "Failure creating an IPv6 public subnet"
1285
-    echo $ipv6_id_and_ext_gw_ip
1286
-}
1287
-
1288
-# Configure neutron router for IPv4 public access
1289
-function _neutron_configure_router_v4 {
1290
-    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-interface-add $ROUTER_ID $SUBNET_ID
1291
-    # Create a public subnet on the external network
1292
-    local id_and_ext_gw_ip
1293
-    id_and_ext_gw_ip=$(_neutron_create_public_subnet_v4 $EXT_NET_ID)
1294
-    local ext_gw_ip
1295
-    ext_gw_ip=$(echo $id_and_ext_gw_ip  | get_field 2)
1296
-    PUB_SUBNET_ID=$(echo $id_and_ext_gw_ip | get_field 5)
1297
-    # Configure the external network as the default router gateway
1298
-    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-gateway-set $ROUTER_ID $EXT_NET_ID
1299
-
1300
-    # This logic is specific to using the l3-agent for layer 3
1301
-    if is_service_enabled q-l3; then
1302
-        # Configure and enable public bridge
1303
-        local ext_gw_interface="none"
1304
-        if is_neutron_ovs_base_plugin; then
1305
-            ext_gw_interface=$(_neutron_get_ext_gw_interface)
1306
-        elif [[ "$Q_AGENT" = "linuxbridge" ]]; then
1307
-            # Search for the brq device the neutron router and network for $FIXED_RANGE
1308
-            # will be using.
1309
-            # e.x. brq3592e767-da for NET_ID 3592e767-da66-4bcb-9bec-cdb03cd96102
1310
-            ext_gw_interface=brq${EXT_NET_ID:0:11}
1311
-        fi
1312
-        if [[ "$ext_gw_interface" != "none" ]]; then
1313
-            local cidr_len=${FLOATING_RANGE#*/}
1314
-            local testcmd="ip -o link | grep -q $ext_gw_interface"
1315
-            test_with_retry "$testcmd" "$ext_gw_interface creation failed"
1316
-            if [[ $(ip addr show dev $ext_gw_interface | grep -c $ext_gw_ip) == 0 && ( $Q_USE_PROVIDERNET_FOR_PUBLIC == "False" || $Q_USE_PUBLIC_VETH == "True" ) ]]; then
1317
-                sudo ip addr add $ext_gw_ip/$cidr_len dev $ext_gw_interface
1318
-                sudo ip link set $ext_gw_interface up
1319
-            fi
1320
-            ROUTER_GW_IP=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F'ip_address'  '{ print $2 }' | cut -f3 -d\" | tr '\n' ' ')
1321
-            die_if_not_set $LINENO ROUTER_GW_IP "Failure retrieving ROUTER_GW_IP"
1322
-            sudo ip route replace  $FIXED_RANGE via $ROUTER_GW_IP
1323
-        fi
1324
-        _neutron_set_router_id
1325
-    fi
1326
-}
1327
-
1328
-# Configure neutron router for IPv6 public access
1329
-function _neutron_configure_router_v6 {
1330
-    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-interface-add $ROUTER_ID $IPV6_SUBNET_ID
1331
-    # Create a public subnet on the external network
1332
-    local ipv6_id_and_ext_gw_ip
1333
-    ipv6_id_and_ext_gw_ip=$(_neutron_create_public_subnet_v6 $EXT_NET_ID)
1334
-    local ipv6_ext_gw_ip
1335
-    ipv6_ext_gw_ip=$(echo $ipv6_id_and_ext_gw_ip | get_field 2)
1336
-    local ipv6_pub_subnet_id
1337
-    ipv6_pub_subnet_id=$(echo $ipv6_id_and_ext_gw_ip | get_field 5)
1338
-
1339
-    # If the external network has not already been set as the default router
1340
-    # gateway when configuring an IPv4 public subnet, do so now
1341
-    if [[ "$IP_VERSION" == "6" ]]; then
1342
-        neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-gateway-set $ROUTER_ID $EXT_NET_ID
1343
-    fi
1344
-
1345
-    # This logic is specific to using the l3-agent for layer 3
1346
-    if is_service_enabled q-l3; then
1347
-        # Ensure IPv6 forwarding is enabled on the host
1348
-        sudo sysctl -w net.ipv6.conf.all.forwarding=1
1349
-        # Configure and enable public bridge
1350
-        # Override global IPV6_ROUTER_GW_IP with the true value from neutron
1351
-        IPV6_ROUTER_GW_IP=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" port-list -c fixed_ips | grep $ipv6_pub_subnet_id | awk -F'ip_address' '{ print $2 }' | cut -f3 -d\" | tr '\n' ' ')
1352
-        die_if_not_set $LINENO IPV6_ROUTER_GW_IP "Failure retrieving IPV6_ROUTER_GW_IP"
1353
-
1354
-        if is_neutron_ovs_base_plugin; then
1355
-            local ext_gw_interface
1356
-            ext_gw_interface=$(_neutron_get_ext_gw_interface)
1357
-            local ipv6_cidr_len=${IPV6_PUBLIC_RANGE#*/}
1358
-
1359
-            # Configure interface for public bridge
1360
-            sudo ip -6 addr add $ipv6_ext_gw_ip/$ipv6_cidr_len dev $ext_gw_interface
1361
-            sudo ip -6 route replace $FIXED_RANGE_V6 via $IPV6_ROUTER_GW_IP dev $ext_gw_interface
1362
-        fi
1363
-        _neutron_set_router_id
1364
-    fi
1365
-}
1366
-
1367
-# Explicitly set router id in l3 agent configuration
1368
-function _neutron_set_router_id {
1369
-    if [[ "$Q_L3_ROUTER_PER_TENANT" == "False" ]]; then
1370
-        iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID
1371
-    fi
1372
-}
1373
-
1374
-# Get ext_gw_interface depending on value of Q_USE_PUBLIC_VETH
1375
-function _neutron_get_ext_gw_interface {
1376
-    if [[ "$Q_USE_PUBLIC_VETH" == "True" ]]; then
1377
-        echo $Q_PUBLIC_VETH_EX
1378
-    else
1379
-        # Disable in-band as we are going to use local port
1380
-        # to communicate with VMs
1381
-        sudo ovs-vsctl set Bridge $PUBLIC_BRIDGE \
1382
-            other_config:disable-in-band=true
1383
-        echo $PUBLIC_BRIDGE
1384
-    fi
1385
-}
1386
-
1387 1229
 # Functions for Neutron Exercises
1388 1230
 #--------------------------------
1389 1231
 
... ...
@@ -1485,14 +1112,6 @@ function check_neutron_third_party_integration {
1485 1485
     _neutron_third_party_do check
1486 1486
 }
1487 1487
 
1488
-function is_provider_network {
1489
-    if [ "$Q_USE_PROVIDER_NETWORKING" == "True" ] && [ "$Q_L3_ENABLED" == "False" ]; then
1490
-        return 0
1491
-    fi
1492
-    return 1
1493
-}
1494
-
1495
-
1496 1488
 # Restore xtrace
1497 1489
 $_XTRACE_NEUTRON
1498 1490
 
... ...
@@ -43,13 +43,15 @@ function neutron_plugin_configure_debug_command {
43 43
 }
44 44
 
45 45
 function neutron_plugin_configure_dhcp_agent {
46
-    iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
46
+    local conf_file=$1
47
+    iniset $conf_file DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
47 48
 }
48 49
 
49 50
 function neutron_plugin_configure_l3_agent {
51
+    local conf_file=$1
50 52
     sudo brctl addbr $PUBLIC_BRIDGE
51
-    iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge
52
-    iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport
53
+    iniset $conf_file DEFAULT external_network_bridge
54
+    iniset $conf_file DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport
53 55
 }
54 56
 
55 57
 function neutron_plugin_configure_plugin_agent {
... ...
@@ -28,12 +28,14 @@ function neutron_plugin_configure_debug_command {
28 28
 }
29 29
 
30 30
 function neutron_plugin_configure_dhcp_agent {
31
-    iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
31
+    local conf_file=$1
32
+    iniset $conf_file DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
32 33
 }
33 34
 
34 35
 function neutron_plugin_configure_l3_agent {
36
+    local conf_file=$1
35 37
     _neutron_ovs_base_configure_l3_agent
36
-    iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport
38
+    iniset $conf_file DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport
37 39
 }
38 40
 
39 41
 function neutron_plugin_configure_plugin_agent {
40 42
new file mode 100644
... ...
@@ -0,0 +1,366 @@
0
+#!/bin/bash
1
+# Subnet IP version
2
+IP_VERSION=${IP_VERSION:-"4+6"}
3
+# Validate IP_VERSION
4
+if [[ $IP_VERSION != "4" ]] && [[ $IP_VERSION != "6" ]] && [[ $IP_VERSION != "4+6" ]]; then
5
+    die $LINENO "IP_VERSION must be either 4, 6, or 4+6"
6
+fi
7
+# Specify if the initial private and external networks should be created
8
+NEUTRON_CREATE_INITIAL_NETWORKS=${NEUTRON_CREATE_INITIAL_NETWORKS:-True}
9
+
10
+## Provider Network Information
11
+PROVIDER_SUBNET_NAME=${PROVIDER_SUBNET_NAME:-"provider_net"}
12
+IPV6_PROVIDER_SUBNET_NAME=${IPV6_PROVIDER_SUBNET_NAME:-"provider_net_v6"}
13
+IPV6_PROVIDER_FIXED_RANGE=${IPV6_PROVIDER_FIXED_RANGE:-}
14
+IPV6_PROVIDER_NETWORK_GATEWAY=${IPV6_PROVIDER_NETWORK_GATEWAY:-}
15
+
16
+PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex}
17
+
18
+# If Q_USE_PUBLIC_VETH=True, create and use a veth pair instead of
19
+# PUBLIC_BRIDGE.  This is intended to be used with
20
+# Q_USE_PROVIDERNET_FOR_PUBLIC=True.
21
+Q_USE_PUBLIC_VETH=${Q_USE_PUBLIC_VETH:-False}
22
+Q_PUBLIC_VETH_EX=${Q_PUBLIC_VETH_EX:-veth-pub-ex}
23
+Q_PUBLIC_VETH_INT=${Q_PUBLIC_VETH_INT:-veth-pub-int}
24
+
25
+# The next two variables are configured by plugin
26
+# e.g.  _configure_neutron_l3_agent or lib/neutron_plugins/*
27
+#
28
+# The plugin supports L3.
29
+Q_L3_ENABLED=${Q_L3_ENABLED:-True}
30
+# L3 routers exist per tenant
31
+Q_L3_ROUTER_PER_TENANT=${Q_L3_ROUTER_PER_TENANT:-True}
32
+
33
+
34
+# Use flat providernet for public network
35
+#
36
+# If Q_USE_PROVIDERNET_FOR_PUBLIC=True, use a flat provider network
37
+# for external interface of neutron l3-agent.  In that case,
38
+# PUBLIC_PHYSICAL_NETWORK specifies provider:physical_network value
39
+# used for the network.  In case of ofagent, you should add the
40
+# corresponding entry to your OFAGENT_PHYSICAL_INTERFACE_MAPPINGS.
41
+# For openvswitch agent, you should add the corresponding entry to
42
+# your OVS_BRIDGE_MAPPINGS.
43
+#
44
+# eg.  (ofagent)
45
+#    Q_USE_PROVIDERNET_FOR_PUBLIC=True
46
+#    Q_USE_PUBLIC_VETH=True
47
+#    PUBLIC_PHYSICAL_NETWORK=public
48
+#    OFAGENT_PHYSICAL_INTERFACE_MAPPINGS=public:veth-pub-int
49
+#
50
+# eg.  (openvswitch agent)
51
+#    Q_USE_PROVIDERNET_FOR_PUBLIC=True
52
+#    PUBLIC_PHYSICAL_NETWORK=public
53
+#    OVS_BRIDGE_MAPPINGS=public:br-ex
54
+Q_USE_PROVIDERNET_FOR_PUBLIC=${Q_USE_PROVIDERNET_FOR_PUBLIC:-False}
55
+PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK:-public}
56
+
57
+# Generate 40-bit IPv6 Global ID to comply with RFC 4193
58
+IPV6_GLOBAL_ID=`uuidgen | sed s/-//g | cut -c 23- | sed -e "s/\(..\)\(....\)\(....\)/\1:\2:\3/"`
59
+
60
+# IPv6 gateway and subnet defaults, in case they are not customized in localrc
61
+IPV6_RA_MODE=${IPV6_RA_MODE:-slaac}
62
+IPV6_ADDRESS_MODE=${IPV6_ADDRESS_MODE:-slaac}
63
+IPV6_PUBLIC_SUBNET_NAME=${IPV6_PUBLIC_SUBNET_NAME:-ipv6-public-subnet}
64
+IPV6_PRIVATE_SUBNET_NAME=${IPV6_PRIVATE_SUBNET_NAME:-ipv6-private-subnet}
65
+FIXED_RANGE_V6=${FIXED_RANGE_V6:-fd$IPV6_GLOBAL_ID::/64}
66
+IPV6_PRIVATE_NETWORK_GATEWAY=${IPV6_PRIVATE_NETWORK_GATEWAY:-fd$IPV6_GLOBAL_ID::1}
67
+IPV6_PUBLIC_RANGE=${IPV6_PUBLIC_RANGE:-2001:db8::/64}
68
+IPV6_PUBLIC_NETWORK_GATEWAY=${IPV6_PUBLIC_NETWORK_GATEWAY:-2001:db8::2}
69
+IPV6_ROUTER_GW_IP=${IPV6_ROUTER_GW_IP:-2001:db8::1}
70
+
71
+# Gateway and subnet defaults, in case they are not customized in localrc
72
+NETWORK_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1}
73
+PUBLIC_NETWORK_GATEWAY=${PUBLIC_NETWORK_GATEWAY:-172.24.4.1}
74
+PRIVATE_SUBNET_NAME=${PRIVATE_SUBNET_NAME:-"private-subnet"}
75
+PUBLIC_SUBNET_NAME=${PUBLIC_SUBNET_NAME:-"public-subnet"}
76
+
77
+# Subnetpool defaults
78
+SUBNETPOOL_NAME=${SUBNETPOOL_NAME:-"shared-default-subnetpool"}
79
+
80
+SUBNETPOOL_PREFIX_V4=${SUBNETPOOL_PREFIX_V4:-10.0.0.0/8}
81
+SUBNETPOOL_PREFIX_V6=${SUBNETPOOL_PREFIX_V6:-2001:db8:8000::/48}
82
+
83
+SUBNETPOOL_SIZE_V4=${SUBNETPOOL_SIZE_V4:-24}
84
+SUBNETPOOL_SIZE_V6=${SUBNETPOOL_SIZE_V6:-64}
85
+
86
+function _determine_config_l3 {
87
+    local opts="--config-file $NEUTRON_CONF --config-file=$Q_L3_CONF_FILE"
88
+    echo "$opts"
89
+}
90
+
91
+function _configure_neutron_l3_agent {
92
+    local cfg_file
93
+    Q_L3_ENABLED=True
94
+
95
+    cp $NEUTRON_DIR/etc/l3_agent.ini.sample $Q_L3_CONF_FILE
96
+
97
+    iniset $Q_L3_CONF_FILE DEFAULT verbose True
98
+    iniset $Q_L3_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
99
+    iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
100
+    iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
101
+    if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
102
+        iniset $Q_L3_CONF_FILE agent root_helper_daemon "$Q_RR_DAEMON_COMMAND"
103
+    fi
104
+
105
+    _neutron_setup_interface_driver $Q_L3_CONF_FILE
106
+
107
+    neutron_plugin_configure_l3_agent
108
+
109
+    if [[ $(ip -f inet a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then
110
+        _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True "inet"
111
+    fi
112
+
113
+    if [[ $(ip -f inet6 a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then
114
+        _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" False "inet6"
115
+    fi
116
+}
117
+
118
+# Explicitly set router id in l3 agent configuration
119
+function _neutron_set_router_id {
120
+    if [[ "$Q_L3_ROUTER_PER_TENANT" == "False" ]]; then
121
+        iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID
122
+    fi
123
+}
124
+
125
+# Get ext_gw_interface depending on value of Q_USE_PUBLIC_VETH
126
+function _neutron_get_ext_gw_interface {
127
+    if [[ "$Q_USE_PUBLIC_VETH" == "True" ]]; then
128
+        echo $Q_PUBLIC_VETH_EX
129
+    else
130
+        # Disable in-band as we are going to use local port
131
+        # to communicate with VMs
132
+        sudo ovs-vsctl set Bridge $PUBLIC_BRIDGE \
133
+            other_config:disable-in-band=true
134
+        echo $PUBLIC_BRIDGE
135
+    fi
136
+}
137
+
138
+function create_neutron_initial_network {
139
+    local project_id
140
+    project_id=$(openstack project list | grep " demo " | get_field 1)
141
+    die_if_not_set $LINENO project_id "Failure retrieving project_id for demo"
142
+
143
+    # Allow drivers that need to create an initial network to do so here
144
+    if type -p neutron_plugin_create_initial_network_profile > /dev/null; then
145
+        neutron_plugin_create_initial_network_profile $PHYSICAL_NETWORK
146
+    fi
147
+
148
+    if is_provider_network; then
149
+        die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK"
150
+        die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specify the PROVIDER_NETWORK_TYPE"
151
+        NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create $PHYSICAL_NETWORK --tenant_id $project_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)
152
+        die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $project_id"
153
+
154
+        if [[ "$IP_VERSION" =~ 4.* ]]; then
155
+            SUBNET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create --tenant_id $project_id --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --name $PROVIDER_SUBNET_NAME --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
156
+            die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $PROVIDER_SUBNET_NAME $project_id"
157
+        fi
158
+
159
+        if [[ "$IP_VERSION" =~ .*6 ]] && [[ -n "$IPV6_PROVIDER_FIXED_RANGE" ]] && [[ -n "$IPV6_PROVIDER_NETWORK_GATEWAY" ]]; then
160
+            SUBNET_V6_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create --tenant_id $project_id --ip_version 6 --ipv6-address-mode $IPV6_ADDRESS_MODE --gateway $IPV6_PROVIDER_NETWORK_GATEWAY --name $IPV6_PROVIDER_SUBNET_NAME $NET_ID $IPV6_PROVIDER_FIXED_RANGE | grep 'id' | get_field 2)
161
+            die_if_not_set $LINENO SUBNET_V6_ID "Failure creating SUBNET_V6_ID for $IPV6_PROVIDER_SUBNET_NAME $project_id"
162
+        fi
163
+
164
+        if [[ $Q_AGENT == "openvswitch" ]]; then
165
+            sudo ip link set $OVS_PHYSICAL_BRIDGE up
166
+            sudo ip link set br-int up
167
+            sudo ip link set $PUBLIC_INTERFACE up
168
+        fi
169
+    else
170
+        NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create --tenant-id $project_id "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
171
+        die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PRIVATE_NETWORK_NAME $project_id"
172
+
173
+        if [[ "$IP_VERSION" =~ 4.* ]]; then
174
+            # Create IPv4 private subnet
175
+            SUBNET_ID=$(_neutron_create_private_subnet_v4 $project_id)
176
+        fi
177
+
178
+        if [[ "$IP_VERSION" =~ .*6 ]]; then
179
+            # Create IPv6 private subnet
180
+            IPV6_SUBNET_ID=$(_neutron_create_private_subnet_v6 $project_id)
181
+        fi
182
+    fi
183
+
184
+    AUTO_ALLOCATE_EXT=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" ext-list | grep 'auto-allocated-topology' | get_field 1)
185
+    SUBNETPOOL_EXT=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" ext-list | grep 'subnet_allocation' | get_field 1)
186
+    if [[ "$Q_L3_ENABLED" == "True" ]]; then
187
+        # Create a router, and add the private subnet as one of its interfaces
188
+        if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then
189
+            # create a tenant-owned router.
190
+            ROUTER_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-create --tenant-id $project_id $Q_ROUTER_NAME | grep ' id ' | get_field 2)
191
+            die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $project_id $Q_ROUTER_NAME"
192
+        else
193
+            # Plugin only supports creating a single router, which should be admin owned.
194
+            ROUTER_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
195
+            die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $Q_ROUTER_NAME"
196
+        fi
197
+
198
+        # if the extension is available, then mark the external
199
+        # network as default, and provision default subnetpools
200
+        EXTERNAL_NETWORK_FLAGS="--router:external"
201
+        if [[ -n $AUTO_ALLOCATE_EXT && -n $SUBNETPOOL_EXT ]]; then
202
+            EXTERNAL_NETWORK_FLAGS="$EXTERNAL_NETWORK_FLAGS --is-default"
203
+            if [[ "$IP_VERSION" =~ 4.* ]]; then
204
+                SUBNETPOOL_V4_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V4 --pool-prefix $SUBNETPOOL_PREFIX_V4 --shared --is-default=True | grep ' id ' | get_field 2)
205
+            fi
206
+            if [[ "$IP_VERSION" =~ .*6 ]]; then
207
+                SUBNETPOOL_V6_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V6 --pool-prefix $SUBNETPOOL_PREFIX_V6 --shared --is-default=True | grep ' id ' | get_field 2)
208
+            fi
209
+        fi
210
+        # Create an external network, and a subnet. Configure the external network as router gw
211
+        if [ "$Q_USE_PROVIDERNET_FOR_PUBLIC" = "True" ]; then
212
+            EXT_NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create "$PUBLIC_NETWORK_NAME" -- $EXTERNAL_NETWORK_FLAGS --provider:network_type=flat --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} | grep ' id ' | get_field 2)
213
+        else
214
+            EXT_NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create "$PUBLIC_NETWORK_NAME" -- $EXTERNAL_NETWORK_FLAGS | grep ' id ' | get_field 2)
215
+        fi
216
+        die_if_not_set $LINENO EXT_NET_ID "Failure creating EXT_NET_ID for $PUBLIC_NETWORK_NAME"
217
+
218
+        if [[ "$IP_VERSION" =~ 4.* ]]; then
219
+            # Configure router for IPv4 public access
220
+            _neutron_configure_router_v4
221
+        fi
222
+
223
+        if [[ "$IP_VERSION" =~ .*6 ]]; then
224
+            # Configure router for IPv6 public access
225
+            _neutron_configure_router_v6
226
+        fi
227
+    fi
228
+}
229
+
230
+# Create private IPv4 subnet
231
+function _neutron_create_private_subnet_v4 {
232
+    local project_id=$1
233
+    local subnet_params="--tenant-id $project_id "
234
+    subnet_params+="--ip_version 4 "
235
+    subnet_params+="--gateway $NETWORK_GATEWAY "
236
+    subnet_params+="--name $PRIVATE_SUBNET_NAME "
237
+    subnet_params+="$NET_ID $FIXED_RANGE"
238
+    local subnet_id
239
+    subnet_id=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep ' id ' | get_field 2)
240
+    die_if_not_set $LINENO subnet_id "Failure creating private IPv4 subnet for $project_id"
241
+    echo $subnet_id
242
+}
243
+
244
+# Create private IPv6 subnet
245
+function _neutron_create_private_subnet_v6 {
246
+    local project_id=$1
247
+    die_if_not_set $LINENO IPV6_RA_MODE "IPV6 RA Mode not set"
248
+    die_if_not_set $LINENO IPV6_ADDRESS_MODE "IPV6 Address Mode not set"
249
+    local ipv6_modes="--ipv6-ra-mode $IPV6_RA_MODE --ipv6-address-mode $IPV6_ADDRESS_MODE"
250
+    local subnet_params="--tenant-id $project_id "
251
+    subnet_params+="--ip_version 6 "
252
+    subnet_params+="--gateway $IPV6_PRIVATE_NETWORK_GATEWAY "
253
+    subnet_params+="--name $IPV6_PRIVATE_SUBNET_NAME "
254
+    subnet_params+="$NET_ID $FIXED_RANGE_V6 $ipv6_modes"
255
+    local ipv6_subnet_id
256
+    ipv6_subnet_id=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep ' id ' | get_field 2)
257
+    die_if_not_set $LINENO ipv6_subnet_id "Failure creating private IPv6 subnet for $project_id"
258
+    echo $ipv6_subnet_id
259
+}
260
+
261
+# Create public IPv4 subnet
262
+function _neutron_create_public_subnet_v4 {
263
+    local subnet_params+="--ip_version 4 "
264
+    subnet_params+="${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} "
265
+    subnet_params+="--gateway $PUBLIC_NETWORK_GATEWAY "
266
+    subnet_params+="--name $PUBLIC_SUBNET_NAME "
267
+    subnet_params+="$EXT_NET_ID $FLOATING_RANGE "
268
+    subnet_params+="-- --enable_dhcp=False"
269
+    local id_and_ext_gw_ip
270
+    id_and_ext_gw_ip=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep -e 'gateway_ip' -e ' id ')
271
+    die_if_not_set $LINENO id_and_ext_gw_ip "Failure creating public IPv4 subnet"
272
+    echo $id_and_ext_gw_ip
273
+}
274
+
275
+# Create public IPv6 subnet
276
+function _neutron_create_public_subnet_v6 {
277
+    local subnet_params="--ip_version 6 "
278
+    subnet_params+="--gateway $IPV6_PUBLIC_NETWORK_GATEWAY "
279
+    subnet_params+="--name $IPV6_PUBLIC_SUBNET_NAME "
280
+    subnet_params+="$EXT_NET_ID $IPV6_PUBLIC_RANGE "
281
+    subnet_params+="-- --enable_dhcp=False"
282
+    local ipv6_id_and_ext_gw_ip
283
+    ipv6_id_and_ext_gw_ip=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep -e 'gateway_ip' -e ' id ')
284
+    die_if_not_set $LINENO ipv6_id_and_ext_gw_ip "Failure creating an IPv6 public subnet"
285
+    echo $ipv6_id_and_ext_gw_ip
286
+}
287
+
288
+# Configure neutron router for IPv4 public access
289
+function _neutron_configure_router_v4 {
290
+    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-interface-add $ROUTER_ID $SUBNET_ID
291
+    # Create a public subnet on the external network
292
+    local id_and_ext_gw_ip
293
+    id_and_ext_gw_ip=$(_neutron_create_public_subnet_v4 $EXT_NET_ID)
294
+    local ext_gw_ip
295
+    ext_gw_ip=$(echo $id_and_ext_gw_ip  | get_field 2)
296
+    PUB_SUBNET_ID=$(echo $id_and_ext_gw_ip | get_field 5)
297
+    # Configure the external network as the default router gateway
298
+    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-gateway-set $ROUTER_ID $EXT_NET_ID
299
+
300
+    # This logic is specific to using the l3-agent for layer 3
301
+    if is_service_enabled q-l3; then
302
+        # Configure and enable public bridge
303
+        local ext_gw_interface="none"
304
+        if is_neutron_ovs_base_plugin; then
305
+            ext_gw_interface=$(_neutron_get_ext_gw_interface)
306
+        elif [[ "$Q_AGENT" = "linuxbridge" ]]; then
307
+            # Search for the brq device the neutron router and network for $FIXED_RANGE
308
+            # will be using.
309
+            # e.x. brq3592e767-da for NET_ID 3592e767-da66-4bcb-9bec-cdb03cd96102
310
+            ext_gw_interface=brq${EXT_NET_ID:0:11}
311
+        fi
312
+        if [[ "$ext_gw_interface" != "none" ]]; then
313
+            local cidr_len=${FLOATING_RANGE#*/}
314
+            local testcmd="ip -o link | grep -q $ext_gw_interface"
315
+            test_with_retry "$testcmd" "$ext_gw_interface creation failed"
316
+            if [[ $(ip addr show dev $ext_gw_interface | grep -c $ext_gw_ip) == 0 && ( $Q_USE_PROVIDERNET_FOR_PUBLIC == "False" || $Q_USE_PUBLIC_VETH == "True" ) ]]; then
317
+                sudo ip addr add $ext_gw_ip/$cidr_len dev $ext_gw_interface
318
+                sudo ip link set $ext_gw_interface up
319
+            fi
320
+            ROUTER_GW_IP=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F'ip_address'  '{ print $2 }' | cut -f3 -d\" | tr '\n' ' ')
321
+            die_if_not_set $LINENO ROUTER_GW_IP "Failure retrieving ROUTER_GW_IP"
322
+            sudo ip route replace  $FIXED_RANGE via $ROUTER_GW_IP
323
+        fi
324
+        _neutron_set_router_id
325
+    fi
326
+}
327
+
328
+# Configure neutron router for IPv6 public access
329
+function _neutron_configure_router_v6 {
330
+    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-interface-add $ROUTER_ID $IPV6_SUBNET_ID
331
+    # Create a public subnet on the external network
332
+    local ipv6_id_and_ext_gw_ip
333
+    ipv6_id_and_ext_gw_ip=$(_neutron_create_public_subnet_v6 $EXT_NET_ID)
334
+    local ipv6_ext_gw_ip
335
+    ipv6_ext_gw_ip=$(echo $ipv6_id_and_ext_gw_ip | get_field 2)
336
+    local ipv6_pub_subnet_id
337
+    ipv6_pub_subnet_id=$(echo $ipv6_id_and_ext_gw_ip | get_field 5)
338
+
339
+    # If the external network has not already been set as the default router
340
+    # gateway when configuring an IPv4 public subnet, do so now
341
+    if [[ "$IP_VERSION" == "6" ]]; then
342
+        neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-gateway-set $ROUTER_ID $EXT_NET_ID
343
+    fi
344
+
345
+    # This logic is specific to using the l3-agent for layer 3
346
+    if is_service_enabled q-l3; then
347
+        # Ensure IPv6 forwarding is enabled on the host
348
+        sudo sysctl -w net.ipv6.conf.all.forwarding=1
349
+        # Configure and enable public bridge
350
+        # Override global IPV6_ROUTER_GW_IP with the true value from neutron
351
+        IPV6_ROUTER_GW_IP=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" port-list -c fixed_ips | grep $ipv6_pub_subnet_id | awk -F'ip_address' '{ print $2 }' | cut -f3 -d\" | tr '\n' ' ')
352
+        die_if_not_set $LINENO IPV6_ROUTER_GW_IP "Failure retrieving IPV6_ROUTER_GW_IP"
353
+
354
+        if is_neutron_ovs_base_plugin; then
355
+            local ext_gw_interface
356
+            ext_gw_interface=$(_neutron_get_ext_gw_interface)
357
+            local ipv6_cidr_len=${IPV6_PUBLIC_RANGE#*/}
358
+
359
+            # Configure interface for public bridge
360
+            sudo ip -6 addr add $ipv6_ext_gw_ip/$ipv6_cidr_len dev $ext_gw_interface
361
+            sudo ip -6 route replace $FIXED_RANGE_V6 via $IPV6_ROUTER_GW_IP dev $ext_gw_interface
362
+        fi
363
+        _neutron_set_router_id
364
+    fi
365
+}
... ...
@@ -35,8 +35,8 @@ XXXX_DIR=$DEST/XXXX
35 35
 XXX_CONF_DIR=/etc/XXXX
36 36
 
37 37
 
38
-# Entry Points
39
-# ------------
38
+# Functions
39
+# ---------
40 40
 
41 41
 # Test if any XXXX services are enabled
42 42
 # is_XXXX_enabled
... ...
@@ -62,6 +62,11 @@ function configure_XXXX {
62 62
     :
63 63
 }
64 64
 
65
+# create_XXXX_accounts() - Create required service accounts
66
+function create_XXXX_accounts {
67
+    :
68
+}
69
+
65 70
 # init_XXXX() - Initialize databases, etc.
66 71
 function init_XXXX {
67 72
     # clean up from previous (possibly aborted) runs
... ...
@@ -558,6 +558,7 @@ source $TOP_DIR/lib/nova
558 558
 source $TOP_DIR/lib/cinder
559 559
 source $TOP_DIR/lib/swift
560 560
 source $TOP_DIR/lib/heat
561
+source $TOP_DIR/lib/neutron
561 562
 source $TOP_DIR/lib/neutron-legacy
562 563
 source $TOP_DIR/lib/ldap
563 564
 source $TOP_DIR/lib/dstat
... ...
@@ -1074,7 +1075,7 @@ if is_service_enabled neutron; then
1074 1074
 
1075 1075
     configure_neutron
1076 1076
     # Run init_neutron only on the node hosting the Neutron API server
1077
-    if is_service_enabled $DATABASE_BACKENDS && is_service_enabled q-svc; then
1077
+    if is_service_enabled $DATABASE_BACKENDS && is_service_enabled neutron; then
1078 1078
         init_neutron
1079 1079
     fi
1080 1080
 fi
... ...
@@ -1141,7 +1142,7 @@ if is_service_enabled nova; then
1141 1141
 
1142 1142
     # Additional Nova configuration that is dependent on other services
1143 1143
     if is_service_enabled neutron; then
1144
-        create_nova_conf_neutron
1144
+        configure_neutron_nova
1145 1145
     elif is_service_enabled n-net; then
1146 1146
         create_nova_conf_nova_network
1147 1147
     fi
... ...
@@ -1218,7 +1219,11 @@ if is_service_enabled n-api; then
1218 1218
     start_nova_api
1219 1219
 fi
1220 1220
 
1221
-if is_service_enabled q-svc; then
1221
+if is_service_enabled neutron-api; then
1222
+    echo_summary "Starting Neutron"
1223
+    start_neutron_api
1224
+    # check_neutron_third_party_integration
1225
+elif is_service_enabled q-svc; then
1222 1226
     echo_summary "Starting Neutron"
1223 1227
     start_neutron_service_and_check
1224 1228
     check_neutron_third_party_integration
... ...
@@ -1239,7 +1244,7 @@ elif is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-net; then
1239 1239
 fi
1240 1240
 
1241 1241
 if is_service_enabled neutron; then
1242
-    start_neutron_agents
1242
+    start_neutron
1243 1243
 fi
1244 1244
 # Once neutron agents are started setup initial network elements
1245 1245
 if is_service_enabled q-svc && [[ "$NEUTRON_CREATE_INITIAL_NETWORKS" == "True" ]]; then
... ...
@@ -1247,6 +1252,7 @@ if is_service_enabled q-svc && [[ "$NEUTRON_CREATE_INITIAL_NETWORKS" == "True" ]
1247 1247
     create_neutron_initial_network
1248 1248
     setup_neutron_debug
1249 1249
 fi
1250
+
1250 1251
 if is_service_enabled nova; then
1251 1252
     echo_summary "Starting Nova"
1252 1253
     start_nova
... ...
@@ -66,6 +66,7 @@ source $TOP_DIR/lib/nova
66 66
 source $TOP_DIR/lib/cinder
67 67
 source $TOP_DIR/lib/swift
68 68
 source $TOP_DIR/lib/heat
69
+source $TOP_DIR/lib/neutron
69 70
 source $TOP_DIR/lib/neutron-legacy
70 71
 source $TOP_DIR/lib/ldap
71 72
 source $TOP_DIR/lib/dstat