Browse code

Merge "Remove devstack exercises"

Zuul authored on 2018/08/27 23:35:53
Showing 15 changed files
... ...
@@ -49,10 +49,6 @@ level.
49 49
 ``doc`` - Contains the Sphinx source for the documentation.
50 50
 A complete doc build can be run with ``tox -edocs``.
51 51
 
52
-``exercises`` - Contains the test scripts used to sanity-check and
53
-demonstrate some OpenStack functions. These scripts know how to exit
54
-early or skip services that are not enabled.
55
-
56 52
 ``extras.d`` - Contains the dispatch scripts called by the hooks in
57 53
 ``stack.sh``, ``unstack.sh`` and ``clean.sh``. See :doc:`the plugins
58 54
 docs <plugins>` for more information.
... ...
@@ -182,88 +178,6 @@ The complete docs build is also handled with <code>tox -edocs</code> per the
182 182
 OpenStack project standard.
183 183
 
184 184
 
185
-Exercises
186
-
187
-The scripts in the exercises directory are meant to 1) perform basic operational
188
-checks on certain aspects of OpenStack; and b) document the use of the
189
-OpenStack command-line clients.
190
-
191
-In addition to the guidelines above, exercise scripts MUST follow the structure
192
-outlined here.  ``swift.sh`` is perhaps the clearest example of these guidelines.
193
-These scripts are executed serially by ``exercise.sh`` in testing situations.
194
-
195
-* Begin and end with a banner that stands out in a sea of script logs to aid
196
-  in debugging failures, particularly in automated testing situations.  If the
197
-  end banner is not displayed, the script ended prematurely and can be assumed
198
-  to have failed.
199
-
200
-  ::
201
-
202
-    echo "**************************************************"
203
-    echo "Begin DevStack Exercise: $0"
204
-    echo "**************************************************"
205
-    ...
206
-    set +o xtrace
207
-    echo "**************************************************"
208
-    echo "End DevStack Exercise: $0"
209
-    echo "**************************************************"
210
-
211
-* The scripts will generally have the shell ``xtrace`` attribute set to display
212
-  the actual commands being executed, and the ``errexit`` attribute set to exit
213
-  the script on non-zero exit codes::
214
-
215
-    # This script exits on an error so that errors don't compound and you see
216
-    # only the first error that occurred.
217
-    set -o errexit
218
-
219
-    # Print the commands being run so that we can see the command that triggers
220
-    # an error.  It is also useful for following as the install occurs.
221
-    set -o xtrace
222
-
223
-* Settings and configuration are stored in ``exerciserc``, which must be
224
-  sourced after ``openrc`` or ``stackrc``::
225
-
226
-    # Import exercise configuration
227
-    source $TOP_DIR/exerciserc
228
-
229
-* There are a couple of helper functions in the common ``functions`` sub-script
230
-  that will check for non-zero exit codes and unset environment variables and
231
-  print a message and exit the script.  These should be called after most client
232
-  commands that are not otherwise checked to short-circuit long timeouts
233
-  (instance boot failure, for example)::
234
-
235
-    swift post $CONTAINER
236
-    die_if_error "Failure creating container $CONTAINER"
237
-
238
-    FLOATING_IP=`euca-allocate-address | cut -f2`
239
-    die_if_not_set FLOATING_IP "Failure allocating floating IP"
240
-
241
-* If you want an exercise to be skipped when for example a service wasn't
242
-  enabled for the exercise to be run, you can exit your exercise with the
243
-  special exitcode 55 and it will be detected as skipped.
244
-
245
-* The exercise scripts should only use the various OpenStack client binaries to
246
-  interact with OpenStack.  This specifically excludes any ``*-manage`` tools
247
-  as those assume direct access to configuration and databases, as well as direct
248
-  database access from the exercise itself.
249
-
250
-* If specific configuration needs to be present for the exercise to complete,
251
-  it should be staged in ``stack.sh``, or called from ``stack.sh``.
252
-
253
-* The ``OS_*`` environment variables should be the only ones used for all
254
-  authentication to OpenStack clients as documented in the CLIAuth_ wiki page.
255
-
256
-.. _CLIAuth: https://wiki.openstack.org/CLIAuth
257
-
258
-* The exercise MUST clean up after itself if successful.  If it is not successful,
259
-  it is assumed that state will be left behind; this allows a chance for developers
260
-  to look around and attempt to debug the problem.  The exercise SHOULD clean up
261
-  or graciously handle possible artifacts left over from previous runs if executed
262
-  again.  It is acceptable to require a reboot or even a re-install of DevStack
263
-  to restore a clean test environment.
264
-
265
-
266 185
 Bash Style Guidelines
267 186
 ~~~~~~~~~~~~~~~~~~~~~
268 187
 DevStack defines a bash set of best practices for maintaining large
... ...
@@ -665,8 +665,7 @@ following to your ``localrc`` section:
665 665
     enable_service n-cell
666 666
 
667 667
 Be aware that there are some features currently missing in cells, one
668
-notable one being security groups.  The exercises have been patched to
669
-disable functionality not supported by cells.
668
+notable one being security groups.
670 669
 
671 670
 Cinder
672 671
 ~~~~~~
... ...
@@ -729,44 +728,6 @@ use the v3 API. It is possible to setup keystone without v2 API, by doing:
729 729
 
730 730
     ENABLE_IDENTITY_V2=False
731 731
 
732
-Exercises
733
-~~~~~~~~~
734
-
735
-``exerciserc`` is used to configure settings for the exercise scripts.
736
-The values shown below are the default values. These can all be
737
-overridden by setting them in the ``localrc`` section.
738
-
739
-* Max time to wait while vm goes from build to active state
740
-
741
-    ::
742
-
743
-        ACTIVE_TIMEOUT==30
744
-
745
-* Max time to wait for proper IP association and dis-association.
746
-
747
-    ::
748
-
749
-        ASSOCIATE_TIMEOUT=15
750
-
751
-* Max time till the vm is bootable
752
-
753
-    ::
754
-
755
-        BOOT_TIMEOUT=30
756
-
757
-* Max time from run instance command until it is running
758
-
759
-    ::
760
-
761
-        RUNNING_TIMEOUT=$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))
762
-
763
-* Max time to wait for a vm to terminate
764
-
765
-    ::
766
-
767
-        TERMINATE_TIMEOUT=30
768
-
769
-
770 732
 .. _arch-configuration:
771 733
 
772 734
 Architectures
... ...
@@ -127,7 +127,3 @@ computers on the local network. In this example that would be
127 127
 http://192.168.1.201/ for the dashboard (aka Horizon). Launch VMs and if
128 128
 you give them floating IPs and security group access those VMs will be
129 129
 accessible from other machines on your network.
130
-
131
-Some examples of using the OpenStack command-line clients ``nova`` and
132
-``glance`` are in the shakedown scripts in ``devstack/exercises``.
133
-``exercise.sh`` will run all of those scripts and report on the results.
... ...
@@ -75,11 +75,3 @@ Node Configurations
75 75
 
76 76
 -  single node
77 77
 -  multi-node configurations as are tested by the gate
78
-
79
-Exercises
80
-
81
-The DevStack exercise scripts are no longer used as integration and gate
82
-testing as that job has transitioned to Tempest. They are still
83
-maintained as a demonstrations of using OpenStack from the command line
84
-and for quick operational testing.
85 78
deleted file mode 100755
... ...
@@ -1,74 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-# **exercise.sh**
4
-
5
-# Keep track of the current DevStack directory.
6
-TOP_DIR=$(cd $(dirname "$0") && pwd)
7
-
8
-# Import common functions
9
-source $TOP_DIR/functions
10
-
11
-# Load local configuration
12
-source $TOP_DIR/stackrc
13
-
14
-# Run everything in the exercises/ directory that isn't explicitly disabled
15
-
16
-# comma separated list of script basenames to skip
17
-# to refrain from exercising foo.sh use ``SKIP_EXERCISES=foo``
18
-SKIP_EXERCISES=${SKIP_EXERCISES:-""}
19
-
20
-# comma separated list of script basenames to run
21
-# to run only foo.sh use ``RUN_EXERCISES=foo``
22
-basenames=${RUN_EXERCISES:-""}
23
-
24
-EXERCISE_DIR=$TOP_DIR/exercises
25
-
26
-if [[ -z "${basenames}" ]]; then
27
-    # Locate the scripts we should run
28
-    basenames=$(for b in `ls $EXERCISE_DIR/*.sh`; do basename $b .sh; done)
29
-else
30
-    # If ``RUN_EXERCISES`` was specified, ignore ``SKIP_EXERCISES``.
31
-    SKIP_EXERCISES=
32
-fi
33
-
34
-# Track the state of each script
35
-passes=""
36
-failures=""
37
-skips=""
38
-
39
-# Loop over each possible script (by basename)
40
-for script in $basenames; do
41
-    if [[ ,$SKIP_EXERCISES, =~ ,$script, ]]; then
42
-        skips="$skips $script"
43
-    else
44
-        echo "====================================================================="
45
-        echo Running $script
46
-        echo "====================================================================="
47
-        $EXERCISE_DIR/$script.sh
48
-        exitcode=$?
49
-        if [[ $exitcode == 55 ]]; then
50
-            skips="$skips $script"
51
-        elif [[ $exitcode -ne 0 ]]; then
52
-            failures="$failures $script"
53
-        else
54
-            passes="$passes $script"
55
-        fi
56
-    fi
57
-done
58
-
59
-# Output status of exercise run
60
-echo "====================================================================="
61
-for script in $skips; do
62
-    echo SKIP $script
63
-done
64
-for script in $passes; do
65
-    echo PASS $script
66
-done
67
-for script in $failures; do
68
-    echo FAILED $script
69
-done
70
-echo "====================================================================="
71
-
72
-if [[ -n "$failures" ]]; then
73
-    exit 1
74
-fi
75 1
deleted file mode 100644
... ...
@@ -1,26 +0,0 @@
1
-#!/usr/bin/env bash
2
-#
3
-# source exerciserc
4
-#
5
-# Configure the DevStack exercise scripts
6
-# For best results, source this _after_ stackrc/localrc as it will set
7
-# values only if they are not already set.
8
-
9
-# Max time to wait while vm goes from build to active state
10
-export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30}
11
-
12
-# Max time to wait for proper IP association and dis-association.
13
-export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
14
-
15
-# Max time till the vm is bootable
16
-export BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
17
-
18
-# Max time from run instance command until it is running
19
-export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))}
20
-
21
-# Max time to wait for a vm to terminate
22
-export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30}
23
-
24
-# The size of the volume we want to boot from; some storage back-ends
25
-# do not allow a disk resize, so it's important that this can be tuned
26
-export DEFAULT_VOLUME_SIZE=${DEFAULT_VOLUME_SIZE:-1}
27 1
deleted file mode 100755
... ...
@@ -1,150 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-# **aggregates.sh**
4
-
5
-# This script demonstrates how to use host aggregates:
6
-#
7
-# *  Create an Aggregate
8
-# *  Updating Aggregate details
9
-# *  Testing Aggregate metadata
10
-# *  Testing Aggregate delete
11
-# *  Testing General Aggregates (https://blueprints.launchpad.net/nova/+spec/general-host-aggregates)
12
-# *  Testing add/remove hosts (with one host)
13
-
14
-echo "**************************************************"
15
-echo "Begin DevStack Exercise: $0"
16
-echo "**************************************************"
17
-
18
-# This script exits on an error so that errors don't compound and you see
19
-# only the first error that occurred.
20
-set -o errexit
21
-
22
-# Print the commands being run so that we can see the command that triggers
23
-# an error.  It is also useful for following as the install occurs.
24
-set -o xtrace
25
-
26
-
27
-# Settings
28
-# ========
29
-
30
-# Keep track of the current directory
31
-EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
32
-TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
33
-
34
-# Test as the admin user
35
-# note this imports stackrc/functions, etc
36
-. $TOP_DIR/openrc admin admin
37
-
38
-# Import exercise configuration
39
-source $TOP_DIR/exerciserc
40
-
41
-# If nova api is not enabled we exit with exitcode 55 so that
42
-# the exercise is skipped
43
-is_service_enabled n-api || exit 55
44
-
45
-# Cells does not support aggregates.
46
-is_service_enabled n-cell && exit 55
47
-
48
-# Create an aggregate
49
-# ===================
50
-
51
-AGGREGATE_NAME=test_aggregate_$RANDOM
52
-AGGREGATE2_NAME=test_aggregate_$RANDOM
53
-AGGREGATE_A_ZONE=nova
54
-
55
-function exit_if_aggregate_present {
56
-    aggregate_name=$1
57
-
58
-    if [ $(nova aggregate-list | grep -c " $aggregate_name ") == 0 ]; then
59
-        echo "SUCCESS $aggregate_name not present"
60
-    else
61
-        die $LINENO "found aggregate: $aggregate_name"
62
-        exit -1
63
-    fi
64
-}
65
-
66
-exit_if_aggregate_present $AGGREGATE_NAME
67
-
68
-AGGREGATE_ID=$(nova aggregate-create $AGGREGATE_NAME $AGGREGATE_A_ZONE | grep " $AGGREGATE_NAME " | get_field 1)
69
-die_if_not_set $LINENO AGGREGATE_ID "Failure creating AGGREGATE_ID for $AGGREGATE_NAME $AGGREGATE_A_ZONE"
70
-
71
-AGGREGATE2_ID=$(nova aggregate-create $AGGREGATE2_NAME $AGGREGATE_A_ZONE | grep " $AGGREGATE2_NAME " | get_field 1)
72
-die_if_not_set $LINENO AGGREGATE2_ID "Fail creating AGGREGATE2_ID for $AGGREGATE2_NAME $AGGREGATE_A_ZONE"
73
-
74
-# check aggregate created
75
-nova aggregate-list | grep -q " $AGGREGATE_NAME " || die $LINENO "Aggregate $AGGREGATE_NAME not created"
76
-
77
-
78
-# Ensure creating a duplicate fails
79
-# =================================
80
-
81
-if nova aggregate-create $AGGREGATE_NAME $AGGREGATE_A_ZONE; then
82
-    die $LINENO "could create duplicate aggregate"
83
-fi
84
-
85
-
86
-# Test aggregate-update (and aggregate-details)
87
-# =============================================
88
-AGGREGATE_NEW_NAME=test_aggregate_$RANDOM
89
-
90
-nova aggregate-update $AGGREGATE_ID $AGGREGATE_NEW_NAME
91
-nova aggregate-details $AGGREGATE_ID | grep $AGGREGATE_NEW_NAME
92
-nova aggregate-details $AGGREGATE_ID | grep $AGGREGATE_A_ZONE
93
-
94
-nova aggregate-update $AGGREGATE_ID $AGGREGATE_NAME $AGGREGATE_A_ZONE
95
-nova aggregate-details $AGGREGATE_ID | grep $AGGREGATE_NAME
96
-nova aggregate-details $AGGREGATE_ID | grep $AGGREGATE_A_ZONE
97
-
98
-
99
-# Test aggregate-set-metadata
100
-# ===========================
101
-META_DATA_1_KEY=asdf
102
-META_DATA_2_KEY=foo
103
-META_DATA_3_KEY=bar
104
-
105
-#ensure no additional metadata is set
106
-nova aggregate-details $AGGREGATE_ID | egrep "\|[{u ]*'availability_zone.+$AGGREGATE_A_ZONE'[ }]*\|"
107
-
108
-nova aggregate-set-metadata $AGGREGATE_ID ${META_DATA_1_KEY}=123
109
-nova aggregate-details $AGGREGATE_ID | grep $META_DATA_1_KEY
110
-nova aggregate-details $AGGREGATE_ID | grep 123
111
-
112
-nova aggregate-set-metadata $AGGREGATE_ID ${META_DATA_2_KEY}=456
113
-nova aggregate-details $AGGREGATE_ID | grep $META_DATA_1_KEY
114
-nova aggregate-details $AGGREGATE_ID | grep $META_DATA_2_KEY
115
-
116
-nova aggregate-set-metadata $AGGREGATE_ID $META_DATA_2_KEY ${META_DATA_3_KEY}=789
117
-nova aggregate-details $AGGREGATE_ID | grep $META_DATA_1_KEY
118
-nova aggregate-details $AGGREGATE_ID | grep $META_DATA_3_KEY
119
-
120
-nova aggregate-details $AGGREGATE_ID | grep $META_DATA_2_KEY && die $LINENO "ERROR metadata was not cleared"
121
-
122
-nova aggregate-set-metadata $AGGREGATE_ID $META_DATA_3_KEY $META_DATA_1_KEY
123
-nova aggregate-details $AGGREGATE_ID | egrep "\|[{u ]*'availability_zone.+$AGGREGATE_A_ZONE'[ }]*\|"
124
-
125
-
126
-# Test aggregate-add/remove-host
127
-# ==============================
128
-if [ "$VIRT_DRIVER" == "xenserver" ]; then
129
-    echo "TODO(johngarbutt) add tests for add/remove host from pool aggregate"
130
-fi
131
-FIRST_HOST=$(nova host-list | grep compute | get_field 1 | head -1)
132
-# Make sure can add two aggregates to same host
133
-nova aggregate-add-host $AGGREGATE_ID $FIRST_HOST
134
-nova aggregate-add-host $AGGREGATE2_ID $FIRST_HOST
135
-if nova aggregate-add-host $AGGREGATE2_ID $FIRST_HOST; then
136
-    die $LINENO "could add duplicate host to single aggregate"
137
-fi
138
-nova aggregate-remove-host $AGGREGATE2_ID $FIRST_HOST
139
-nova aggregate-remove-host $AGGREGATE_ID $FIRST_HOST
140
-
141
-# Test aggregate-delete
142
-# =====================
143
-nova aggregate-delete $AGGREGATE_ID
144
-nova aggregate-delete $AGGREGATE2_ID
145
-exit_if_aggregate_present $AGGREGATE_NAME
146
-
147
-set +o xtrace
148
-echo "**************************************************"
149
-echo "End DevStack Exercise: $0"
150
-echo "**************************************************"
151 1
deleted file mode 100755
... ...
@@ -1,224 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-# **boot_from_volume.sh**
4
-
5
-# This script demonstrates how to boot from a volume.  It does the following:
6
-#
7
-# *  Create a bootable volume
8
-# *  Boot a volume-backed instance
9
-
10
-echo "*********************************************************************"
11
-echo "Begin DevStack Exercise: $0"
12
-echo "*********************************************************************"
13
-
14
-# This script exits on an error so that errors don't compound and you see
15
-# only the first error that occurred.
16
-set -o errexit
17
-
18
-# Print the commands being run so that we can see the command that triggers
19
-# an error.  It is also useful for following as the install occurs.
20
-set -o xtrace
21
-
22
-
23
-# Settings
24
-# ========
25
-
26
-# Keep track of the current directory
27
-EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
28
-TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
29
-
30
-# Import common functions
31
-source $TOP_DIR/functions
32
-
33
-# Import project functions
34
-source $TOP_DIR/lib/cinder
35
-source $TOP_DIR/lib/neutron
36
-source $TOP_DIR/lib/neutron-legacy
37
-
38
-# Import configuration
39
-source $TOP_DIR/openrc
40
-
41
-# Import exercise configuration
42
-source $TOP_DIR/exerciserc
43
-
44
-# If cinder is not enabled we exit with exitcode 55 so that
45
-# the exercise is skipped
46
-is_service_enabled cinder || exit 55
47
-
48
-# Ironic does not support boot from volume.
49
-[ "$VIRT_DRIVER" == "ironic" ] && exit 55
50
-
51
-# Instance type to create
52
-DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}
53
-
54
-# Boot this image, use first AMI image if unset
55
-DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ami}
56
-
57
-# Security group name
58
-SECGROUP=${SECGROUP:-boot_secgroup}
59
-
60
-# Instance and volume names
61
-VM_NAME=${VM_NAME:-ex-bfv-inst}
62
-VOL_NAME=${VOL_NAME:-ex-vol-bfv}
63
-
64
-
65
-# Launching a server
66
-# ==================
67
-
68
-# List servers for project:
69
-nova list
70
-
71
-# Images
72
-# ------
73
-
74
-# List the images available
75
-openstack image list
76
-
77
-# Grab the id of the image to launch
78
-IMAGE=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
79
-die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME"
80
-
81
-# Security Groups
82
-# ---------------
83
-
84
-# List security groups
85
-nova secgroup-list
86
-
87
-if is_service_enabled n-cell; then
88
-    # Cells does not support security groups, so force the use of "default"
89
-    SECGROUP="default"
90
-    echo "Using the default security group because of Cells."
91
-else
92
-    # Create a secgroup
93
-    if ! nova secgroup-list | grep -q $SECGROUP; then
94
-        nova secgroup-create $SECGROUP "$SECGROUP description"
95
-        if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $SECGROUP; do sleep 1; done"; then
96
-            echo "Security group not created"
97
-            exit 1
98
-        fi
99
-    fi
100
-fi
101
-
102
-# Configure Security Group Rules
103
-if ! nova secgroup-list-rules $SECGROUP | grep -q icmp; then
104
-    nova secgroup-add-rule $SECGROUP icmp -1 -1 0.0.0.0/0
105
-fi
106
-if ! nova secgroup-list-rules $SECGROUP | grep -q " tcp .* 22 "; then
107
-    nova secgroup-add-rule $SECGROUP tcp 22 22 0.0.0.0/0
108
-fi
109
-
110
-# List secgroup rules
111
-nova secgroup-list-rules $SECGROUP
112
-
113
-# Set up instance
114
-# ---------------
115
-
116
-# List flavors
117
-nova flavor-list
118
-
119
-# Select a flavor
120
-INSTANCE_TYPE=$(nova flavor-list | grep $DEFAULT_INSTANCE_TYPE | get_field 1)
121
-if [[ -z "$INSTANCE_TYPE" ]]; then
122
-    # grab the first flavor in the list to launch if default doesn't exist
123
-    INSTANCE_TYPE=$(nova flavor-list | head -n 4 | tail -n 1 | get_field 1)
124
-fi
125
-
126
-# Clean-up from previous runs
127
-nova delete $VM_NAME || true
128
-if ! timeout $ACTIVE_TIMEOUT sh -c "while nova show $VM_NAME; do sleep 1; done"; then
129
-    echo "server didn't terminate!"
130
-    exit 1
131
-fi
132
-
133
-# Setup Keypair
134
-KEY_NAME=test_key
135
-KEY_FILE=key.pem
136
-nova keypair-delete $KEY_NAME || true
137
-nova keypair-add $KEY_NAME > $KEY_FILE
138
-chmod 600 $KEY_FILE
139
-
140
-# Set up volume
141
-# -------------
142
-
143
-# Delete any old volume
144
-cinder delete $VOL_NAME || true
145
-if ! timeout $ACTIVE_TIMEOUT sh -c "while cinder list | grep $VOL_NAME; do sleep 1; done"; then
146
-    echo "Volume $VOL_NAME not deleted"
147
-    exit 1
148
-fi
149
-
150
-# Create the bootable volume
151
-start_time=$(date +%s)
152
-cinder create --image-id $IMAGE --display-name=$VOL_NAME --display-description "test bootable volume: $VOL_NAME" $DEFAULT_VOLUME_SIZE || \
153
-    die $LINENO "Failure creating volume $VOL_NAME"
154
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep available; do sleep 1; done"; then
155
-    echo "Volume $VOL_NAME not created"
156
-    exit 1
157
-fi
158
-end_time=$(date +%s)
159
-echo "Completed cinder create in $((end_time - start_time)) seconds"
160
-
161
-# Get volume ID
162
-VOL_ID=$(cinder list | grep $VOL_NAME  | get_field 1)
163
-die_if_not_set $LINENO VOL_ID "Failure retrieving volume ID for $VOL_NAME"
164
-
165
-# Boot instance
166
-# -------------
167
-
168
-# Boot using the --block-device-mapping param. The format of mapping is:
169
-# <dev_name>=<id>:<type>:<size(GB)>:<delete_on_terminate>
170
-# Leaving the middle two fields blank appears to do-the-right-thing
171
-VM_UUID=$(nova boot --flavor $INSTANCE_TYPE --image $IMAGE --block-device-mapping vda=$VOL_ID --security-groups=$SECGROUP --key-name $KEY_NAME $VM_NAME | grep ' id ' | get_field 2)
172
-die_if_not_set $LINENO VM_UUID "Failure launching $VM_NAME"
173
-
174
-# Check that the status is active within ACTIVE_TIMEOUT seconds
175
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $VM_UUID | grep status | grep -q ACTIVE; do sleep 1; done"; then
176
-    echo "server didn't become active!"
177
-    exit 1
178
-fi
179
-
180
-# Get the instance IP
181
-IP=$(get_instance_ip $VM_UUID $PRIVATE_NETWORK_NAME)
182
-
183
-die_if_not_set $LINENO IP "Failure retrieving IP address"
184
-
185
-# Private IPs can be pinged in single node deployments
186
-ping_check $IP $BOOT_TIMEOUT "$PRIVATE_NETWORK_NAME"
187
-
188
-# Clean up
189
-# --------
190
-
191
-# Delete volume backed instance
192
-nova delete $VM_UUID || die $LINENO "Failure deleting instance $VM_NAME"
193
-if ! timeout $TERMINATE_TIMEOUT sh -c "while nova list | grep -q $VM_UUID; do sleep 1; done"; then
194
-    echo "Server $VM_NAME not deleted"
195
-    exit 1
196
-fi
197
-
198
-# Wait for volume to be released
199
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep available; do sleep 1; done"; then
200
-    echo "Volume $VOL_NAME not released"
201
-    exit 1
202
-fi
203
-
204
-# Delete volume
205
-start_time=$(date +%s)
206
-cinder delete $VOL_ID || die $LINENO "Failure deleting volume $VOLUME_NAME"
207
-if ! timeout $ACTIVE_TIMEOUT sh -c "while cinder list | grep $VOL_NAME; do sleep 1; done"; then
208
-    echo "Volume $VOL_NAME not deleted"
209
-    exit 1
210
-fi
211
-end_time=$(date +%s)
212
-echo "Completed cinder delete in $((end_time - start_time)) seconds"
213
-
214
-if [[ $SECGROUP = "default" ]] ; then
215
-    echo "Skipping deleting default security group"
216
-else
217
-    # Delete secgroup
218
-    nova secgroup-delete $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
219
-fi
220
-
221
-set +o xtrace
222
-echo "*********************************************************************"
223
-echo "SUCCESS: End DevStack Exercise: $0"
224
-echo "*********************************************************************"
225 1
deleted file mode 100755
... ...
@@ -1,174 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-# **client-args.sh**
4
-
5
-# Test OpenStack client authentication arguments handling
6
-
7
-echo "*********************************************************************"
8
-echo "Begin DevStack Exercise: $0"
9
-echo "*********************************************************************"
10
-
11
-# This script exits on an error so that errors don't compound and you see
12
-# only the first error that occurred.
13
-set -o errexit
14
-
15
-# Print the commands being run so that we can see the command that triggers
16
-# an error.  It is also useful for following as the install occurs.
17
-set -o xtrace
18
-
19
-
20
-# Settings
21
-# ========
22
-
23
-# Keep track of the current directory
24
-EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
25
-TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
26
-
27
-# Import common functions
28
-source $TOP_DIR/functions
29
-
30
-# Import configuration
31
-source $TOP_DIR/openrc
32
-
33
-# Import exercise configuration
34
-source $TOP_DIR/exerciserc
35
-
36
-# Unset all of the known NOVA_* vars
37
-unset NOVA_API_KEY
38
-unset NOVA_ENDPOINT_NAME
39
-unset NOVA_PASSWORD
40
-unset NOVA_PROJECT_ID
41
-unset NOVA_REGION_NAME
42
-unset NOVA_URL
43
-unset NOVA_USERNAME
44
-
45
-# Save the known variables for later
46
-export x_PROJECT_NAME=$OS_PROJECT_NAME
47
-export x_USERNAME=$OS_USERNAME
48
-export x_PASSWORD=$OS_PASSWORD
49
-export x_AUTH_URL=$OS_AUTH_URL
50
-
51
-# Unset the usual variables to force argument processing
52
-unset OS_PROJECT_NAME
53
-unset OS_USERNAME
54
-unset OS_PASSWORD
55
-unset OS_AUTH_URL
56
-
57
-# Common authentication args
58
-PROJECT_ARG="--os-project-name=$x_PROJECT_NAME"
59
-ARGS="--os-username=$x_USERNAME --os-password=$x_PASSWORD --os-auth-url=$x_AUTH_URL"
60
-
61
-# Set global return
62
-RETURN=0
63
-
64
-# Keystone client
65
-# ---------------
66
-if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
67
-    if [[ "$SKIP_EXERCISES" =~ "key" ]]; then
68
-        STATUS_KEYSTONE="Skipped"
69
-    else
70
-        echo -e "\nTest Keystone"
71
-        if openstack $PROJECT_ARG $ARGS catalog show identity; then
72
-            STATUS_KEYSTONE="Succeeded"
73
-        else
74
-            STATUS_KEYSTONE="Failed"
75
-            RETURN=1
76
-        fi
77
-    fi
78
-fi
79
-
80
-# Nova client
81
-# -----------
82
-
83
-if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
84
-    if [[ "$SKIP_EXERCISES" =~ "n-api" ]]; then
85
-        STATUS_NOVA="Skipped"
86
-    else
87
-        # Test OSAPI
88
-        echo -e "\nTest Nova"
89
-        if nova $PROJECT_ARG $ARGS flavor-list; then
90
-            STATUS_NOVA="Succeeded"
91
-        else
92
-            STATUS_NOVA="Failed"
93
-            RETURN=1
94
-        fi
95
-    fi
96
-fi
97
-
98
-# Cinder client
99
-# -------------
100
-
101
-if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then
102
-    if [[ "$SKIP_EXERCISES" =~ "c-api" ]]; then
103
-        STATUS_CINDER="Skipped"
104
-    else
105
-        echo -e "\nTest Cinder"
106
-        if cinder $PROJECT_ARG $ARGS list; then
107
-            STATUS_CINDER="Succeeded"
108
-        else
109
-            STATUS_CINDER="Failed"
110
-            RETURN=1
111
-        fi
112
-    fi
113
-fi
114
-
115
-# Glance client
116
-# -------------
117
-
118
-if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
119
-    if [[ "$SKIP_EXERCISES" =~ "g-api" ]]; then
120
-        STATUS_GLANCE="Skipped"
121
-    else
122
-        echo -e "\nTest Glance"
123
-        if openstack $PROJECT_ARG $ARGS image list; then
124
-            STATUS_GLANCE="Succeeded"
125
-        else
126
-            STATUS_GLANCE="Failed"
127
-            RETURN=1
128
-        fi
129
-    fi
130
-fi
131
-
132
-# Swift client
133
-# ------------
134
-
135
-if [[ "$ENABLED_SERVICES" =~ "swift" || "$ENABLED_SERVICES" =~ "s-proxy" ]]; then
136
-    if [[ "$SKIP_EXERCISES" =~ "swift" ]]; then
137
-        STATUS_SWIFT="Skipped"
138
-    else
139
-        echo -e "\nTest Swift"
140
-        if swift $PROJECT_ARG $ARGS stat; then
141
-            STATUS_SWIFT="Succeeded"
142
-        else
143
-            STATUS_SWIFT="Failed"
144
-            RETURN=1
145
-        fi
146
-    fi
147
-fi
148
-
149
-set +o xtrace
150
-
151
-
152
-# Results
153
-# =======
154
-
155
-function report {
156
-    if [[ -n "$2" ]]; then
157
-        echo "$1: $2"
158
-    fi
159
-}
160
-
161
-echo -e "\n"
162
-report "Keystone" $STATUS_KEYSTONE
163
-report "Nova" $STATUS_NOVA
164
-report "Cinder" $STATUS_CINDER
165
-report "Glance" $STATUS_GLANCE
166
-report "Swift" $STATUS_SWIFT
167
-
168
-if (( $RETURN == 0 )); then
169
-    echo "*********************************************************************"
170
-    echo "SUCCESS: End DevStack Exercise: $0"
171
-    echo "*********************************************************************"
172
-fi
173
-
174
-exit $RETURN
175 1
deleted file mode 100755
... ...
@@ -1,171 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-# **client-env.sh**
4
-
5
-# Test OpenStack client environment variable handling
6
-
7
-echo "*********************************************************************"
8
-echo "Begin DevStack Exercise: $0"
9
-echo "*********************************************************************"
10
-
11
-# This script exits on an error so that errors don't compound and you see
12
-# only the first error that occurred.
13
-set -o errexit
14
-
15
-# Print the commands being run so that we can see the command that triggers
16
-# an error.  It is also useful for following as the install occurs.
17
-set -o xtrace
18
-
19
-
20
-# Settings
21
-# ========
22
-
23
-# Keep track of the current directory
24
-EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
25
-TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
26
-
27
-# Import common functions
28
-source $TOP_DIR/functions
29
-
30
-# Import configuration
31
-source $TOP_DIR/openrc admin
32
-
33
-# Import exercise configuration
34
-source $TOP_DIR/exerciserc
35
-
36
-# Unset all of the known NOVA_* vars
37
-unset NOVA_API_KEY
38
-unset NOVA_ENDPOINT_NAME
39
-unset NOVA_PASSWORD
40
-unset NOVA_PROJECT_ID
41
-unset NOVA_REGION_NAME
42
-unset NOVA_URL
43
-unset NOVA_USERNAME
44
-
45
-for i in OS_TENANT_NAME OS_USERNAME OS_PASSWORD OS_AUTH_URL; do
46
-    is_set $i
47
-    if [[ $? -ne 0 ]]; then
48
-        echo "$i expected to be set"
49
-        ABORT=1
50
-    fi
51
-done
52
-if [[ -n "$ABORT" ]]; then
53
-    exit 1
54
-fi
55
-
56
-# Set global return
57
-RETURN=0
58
-
59
-# Keystone client
60
-# ---------------
61
-if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
62
-    if [[ "$SKIP_EXERCISES" =~ "key" ]]; then
63
-        STATUS_KEYSTONE="Skipped"
64
-    else
65
-        echo -e "\nTest Keystone"
66
-        if openstack endpoint show identity; then
67
-            STATUS_KEYSTONE="Succeeded"
68
-        else
69
-            STATUS_KEYSTONE="Failed"
70
-            RETURN=1
71
-        fi
72
-    fi
73
-fi
74
-
75
-# Nova client
76
-# -----------
77
-
78
-if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
79
-    if [[ "$SKIP_EXERCISES" =~ "n-api" ]]; then
80
-        STATUS_NOVA="Skipped"
81
-    else
82
-        # Test OSAPI
83
-        echo -e "\nTest Nova"
84
-        if nova flavor-list; then
85
-            STATUS_NOVA="Succeeded"
86
-        else
87
-            STATUS_NOVA="Failed"
88
-            RETURN=1
89
-        fi
90
-
91
-    fi
92
-fi
93
-
94
-# Cinder client
95
-# -------------
96
-
97
-if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then
98
-    if [[ "$SKIP_EXERCISES" =~ "c-api" ]]; then
99
-        STATUS_CINDER="Skipped"
100
-    else
101
-        echo -e "\nTest Cinder"
102
-        if cinder list; then
103
-            STATUS_CINDER="Succeeded"
104
-        else
105
-            STATUS_CINDER="Failed"
106
-            RETURN=1
107
-        fi
108
-    fi
109
-fi
110
-
111
-# Glance client
112
-# -------------
113
-
114
-if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
115
-    if [[ "$SKIP_EXERCISES" =~ "g-api" ]]; then
116
-        STATUS_GLANCE="Skipped"
117
-    else
118
-        echo -e "\nTest Glance"
119
-        if openstack image list; then
120
-            STATUS_GLANCE="Succeeded"
121
-        else
122
-            STATUS_GLANCE="Failed"
123
-            RETURN=1
124
-        fi
125
-    fi
126
-fi
127
-
128
-# Swift client
129
-# ------------
130
-
131
-
132
-if [[ "$ENABLED_SERVICES" =~ "swift" || "$ENABLED_SERVICES" =~ "s-proxy" ]]; then
133
-    if [[ "$SKIP_EXERCISES" =~ "swift" ]]; then
134
-        STATUS_SWIFT="Skipped"
135
-    else
136
-        echo -e "\nTest Swift"
137
-        if swift stat; then
138
-            STATUS_SWIFT="Succeeded"
139
-        else
140
-            STATUS_SWIFT="Failed"
141
-            RETURN=1
142
-        fi
143
-    fi
144
-fi
145
-
146
-set +o xtrace
147
-
148
-
149
-# Results
150
-# =======
151
-
152
-function report {
153
-    if [[ -n "$2" ]]; then
154
-        echo "$1: $2"
155
-    fi
156
-}
157
-
158
-echo -e "\n"
159
-report "Keystone" $STATUS_KEYSTONE
160
-report "Nova" $STATUS_NOVA
161
-report "Cinder" $STATUS_CINDER
162
-report "Glance" $STATUS_GLANCE
163
-report "Swift" $STATUS_SWIFT
164
-
165
-if (( $RETURN == 0 )); then
166
-    echo "*********************************************************************"
167
-    echo "SUCCESS: End DevStack Exercise: $0"
168
-    echo "*********************************************************************"
169
-fi
170
-
171
-exit $RETURN
172 1
deleted file mode 100755
... ...
@@ -1,216 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-# **floating_ips.sh** - using the cloud can be fun
4
-
5
-# Test instance connectivity with the ``nova`` command from ``python-novaclient``
6
-
7
-echo "*********************************************************************"
8
-echo "Begin DevStack Exercise: $0"
9
-echo "*********************************************************************"
10
-
11
-# This script exits on an error so that errors don't compound and you see
12
-# only the first error that occurred.
13
-set -o errexit
14
-
15
-# Print the commands being run so that we can see the command that triggers
16
-# an error.  It is also useful for following as the install occurs.
17
-set -o xtrace
18
-
19
-
20
-# Settings
21
-# ========
22
-
23
-# Keep track of the current directory
24
-EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
25
-TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
26
-
27
-# Import common functions
28
-source $TOP_DIR/functions
29
-
30
-# Import configuration
31
-source $TOP_DIR/openrc
32
-
33
-# Import project functions
34
-source $TOP_DIR/lib/neutron
35
-source $TOP_DIR/lib/neutron-legacy
36
-
37
-# Import exercise configuration
38
-source $TOP_DIR/exerciserc
39
-
40
-# If nova api is not enabled we exit with exitcode 55 so that
41
-# the exercise is skipped
42
-is_service_enabled n-api || exit 55
43
-
44
-# Instance type to create
45
-DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}
46
-
47
-# Boot this image, use first AMI image if unset
48
-DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ami}
49
-
50
-# Security group name
51
-SECGROUP=${SECGROUP:-test_secgroup}
52
-
53
-# Default floating IP pool name
54
-DEFAULT_FLOATING_POOL=${DEFAULT_FLOATING_POOL:-public}
55
-
56
-# Additional floating IP pool and range
57
-TEST_FLOATING_POOL=${TEST_FLOATING_POOL:-test}
58
-
59
-# Instance name
60
-VM_NAME="ex-float"
61
-
62
-# Cells does not support floating ips API calls
63
-is_service_enabled n-cell && exit 55
64
-
65
-# Launching a server
66
-# ==================
67
-
68
-# List servers for tenant:
69
-nova list
70
-
71
-# Images
72
-# ------
73
-
74
-# List the images available
75
-openstack image list
76
-
77
-# Grab the id of the image to launch
78
-IMAGE=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
79
-die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME"
80
-
81
-# Security Groups
82
-# ---------------
83
-
84
-# List security groups
85
-nova secgroup-list
86
-
87
-# Create a secgroup
88
-if ! nova secgroup-list | grep -q $SECGROUP; then
89
-    nova secgroup-create $SECGROUP "$SECGROUP description"
90
-    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $SECGROUP; do sleep 1; done"; then
91
-        die $LINENO "Security group not created"
92
-    fi
93
-fi
94
-
95
-# Configure Security Group Rules
96
-if ! nova secgroup-list-rules $SECGROUP | grep -q icmp; then
97
-    nova secgroup-add-rule $SECGROUP icmp -1 -1 0.0.0.0/0
98
-fi
99
-if ! nova secgroup-list-rules $SECGROUP | grep -q " tcp .* 22 "; then
100
-    nova secgroup-add-rule $SECGROUP tcp 22 22 0.0.0.0/0
101
-fi
102
-
103
-# List secgroup rules
104
-nova secgroup-list-rules $SECGROUP
105
-
106
-# Set up instance
107
-# ---------------
108
-
109
-# List flavors
110
-nova flavor-list
111
-
112
-# Select a flavor
113
-INSTANCE_TYPE=$(nova flavor-list | grep $DEFAULT_INSTANCE_TYPE | get_field 1)
114
-if [[ -z "$INSTANCE_TYPE" ]]; then
115
-    # grab the first flavor in the list to launch if default doesn't exist
116
-    INSTANCE_TYPE=$(nova flavor-list | head -n 4 | tail -n 1 | get_field 1)
117
-    die_if_not_set $LINENO INSTANCE_TYPE "Failure retrieving INSTANCE_TYPE"
118
-fi
119
-
120
-# Clean-up from previous runs
121
-nova delete $VM_NAME || true
122
-if ! timeout $ACTIVE_TIMEOUT sh -c "while nova show $VM_NAME; do sleep 1; done"; then
123
-    die $LINENO "server didn't terminate!"
124
-    exit 1
125
-fi
126
-
127
-# Boot instance
128
-# -------------
129
-
130
-VM_UUID=$(nova boot --flavor $INSTANCE_TYPE --image $IMAGE --security-groups=$SECGROUP $VM_NAME | grep ' id ' | get_field 2)
131
-die_if_not_set $LINENO VM_UUID "Failure launching $VM_NAME"
132
-
133
-# Check that the status is active within ACTIVE_TIMEOUT seconds
134
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $VM_UUID | grep status | grep -q ACTIVE; do sleep 1; done"; then
135
-    die $LINENO "server didn't become active!"
136
-fi
137
-
138
-# Get the instance IP
139
-IP=$(get_instance_ip $VM_UUID $PRIVATE_NETWORK_NAME)
140
-die_if_not_set $LINENO IP "Failure retrieving IP address"
141
-
142
-# Private IPs can be pinged in single node deployments
143
-ping_check $IP $BOOT_TIMEOUT "$PRIVATE_NETWORK_NAME"
144
-
145
-# Floating IPs
146
-# ------------
147
-
148
-# Allocate a floating IP from the default pool
149
-FLOATING_IP=$(nova floating-ip-create | grep $DEFAULT_FLOATING_POOL | get_field 1)
150
-die_if_not_set $LINENO FLOATING_IP "Failure creating floating IP from pool $DEFAULT_FLOATING_POOL"
151
-
152
-# List floating addresses
153
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova floating-ip-list | grep -q $FLOATING_IP; do sleep 1; done"; then
154
-    die $LINENO "Floating IP not allocated"
155
-fi
156
-
157
-# Add floating IP to our server
158
-nova add-floating-ip $VM_UUID $FLOATING_IP || \
159
-    die $LINENO "Failure adding floating IP $FLOATING_IP to $VM_NAME"
160
-
161
-# Test we can ping our floating IP within ASSOCIATE_TIMEOUT seconds
162
-ping_check $FLOATING_IP $ASSOCIATE_TIMEOUT "$PUBLIC_NETWORK_NAME"
163
-
164
-if ! is_service_enabled neutron; then
165
-    # Allocate an IP from second floating pool
166
-    TEST_FLOATING_IP=$(nova floating-ip-create $TEST_FLOATING_POOL | grep $TEST_FLOATING_POOL | get_field 1)
167
-    die_if_not_set $LINENO TEST_FLOATING_IP "Failure creating floating IP in $TEST_FLOATING_POOL"
168
-
169
-    # list floating addresses
170
-    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova floating-ip-list | grep $TEST_FLOATING_POOL | grep -q $TEST_FLOATING_IP; do sleep 1; done"; then
171
-        die $LINENO "Floating IP not allocated"
172
-    fi
173
-fi
174
-
175
-# Dis-allow icmp traffic (ping)
176
-nova secgroup-delete-rule $SECGROUP icmp -1 -1 0.0.0.0/0 || \
177
-    die $LINENO "Failure deleting security group rule from $SECGROUP"
178
-
179
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while nova secgroup-list-rules $SECGROUP | grep -q icmp; do sleep 1; done"; then
180
-    die $LINENO "Security group rule not deleted from $SECGROUP"
181
-fi
182
-
183
-# FIXME (anthony): make xs support security groups
184
-if [ "$VIRT_DRIVER" != "ironic" -a "$VIRT_DRIVER" != "xenserver" -a "$VIRT_DRIVER" != "openvz" ]; then
185
-    # Test we can aren't able to ping our floating ip within ASSOCIATE_TIMEOUT seconds
186
-    ping_check $FLOATING_IP $ASSOCIATE_TIMEOUT "$PUBLIC_NETWORK_NAME" Fail
187
-fi
188
-
189
-# Clean up
190
-# --------
191
-
192
-if ! is_service_enabled neutron; then
193
-    # Delete second floating IP
194
-    nova floating-ip-delete $TEST_FLOATING_IP || \
195
-        die $LINENO "Failure deleting floating IP $TEST_FLOATING_IP"
196
-fi
197
-
198
-# Delete the floating ip
199
-nova floating-ip-delete $FLOATING_IP || \
200
-    die $LINENO "Failure deleting floating IP $FLOATING_IP"
201
-
202
-# Delete instance
203
-nova delete $VM_UUID || die $LINENO "Failure deleting instance $VM_NAME"
204
-# Wait for termination
205
-if ! timeout $TERMINATE_TIMEOUT sh -c "while nova list | grep -q $VM_UUID; do sleep 1; done"; then
206
-    die $LINENO "Server $VM_NAME not deleted"
207
-fi
208
-
209
-# Delete secgroup
210
-nova secgroup-delete $SECGROUP || \
211
-    die $LINENO "Failure deleting security group $SECGROUP"
212
-
213
-set +o xtrace
214
-echo "*********************************************************************"
215
-echo "SUCCESS: End DevStack Exercise: $0"
216
-echo "*********************************************************************"
217 1
deleted file mode 100755
... ...
@@ -1,466 +0,0 @@
1
-#!/usr/bin/env bash
2
-#
3
-# Copyright 2012, Cisco Systems
4
-# Copyright 2012, VMware, Inc.
5
-# Copyright 2012, NTT MCL, Inc.
6
-#
7
-# Please direct any questions to dedutta@cisco.com, dwendlandt@vmware.com, nachi@nttmcl.com
8
-#
9
-# **neutron-adv-test.sh**
10
-
11
-# Perform integration testing of Nova and other components with Neutron.
12
-
13
-echo "*********************************************************************"
14
-echo "Begin DevStack Exercise: $0"
15
-echo "*********************************************************************"
16
-
17
-# This script exits on an error so that errors don't compound and you see
18
-# only the first error that occurred.
19
-
20
-set -o errtrace
21
-
22
-# Print the commands being run so that we can see the command that triggers
23
-# an error.  It is also useful for following as the install occurs.
24
-set -o xtrace
25
-
26
-# Environment
27
-# -----------
28
-
29
-# Keep track of the current directory
30
-EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
31
-TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
32
-
33
-# Import common functions
34
-source $TOP_DIR/functions
35
-
36
-# Import configuration
37
-source $TOP_DIR/openrc
38
-
39
-# Import neutron functions
40
-source $TOP_DIR/lib/neutron
41
-source $TOP_DIR/lib/neutron-legacy
42
-
43
-# If neutron is not enabled we exit with exitcode 55, which means exercise is skipped.
44
-neutron_plugin_check_adv_test_requirements || exit 55
45
-
46
-# Import exercise configuration
47
-source $TOP_DIR/exerciserc
48
-
49
-# Neutron Settings
50
-# ----------------
51
-
52
-PROJECTS="DEMO1"
53
-# TODO (nati)_Test public network
54
-#PROJECTS="DEMO1,DEMO2"
55
-
56
-PUBLIC_NAME="admin"
57
-DEMO1_NAME="demo1"
58
-DEMO2_NAME="demo2"
59
-
60
-PUBLIC_NUM_NET=1
61
-DEMO1_NUM_NET=1
62
-DEMO2_NUM_NET=2
63
-
64
-PUBLIC_NET1_CIDR="200.0.0.0/24"
65
-DEMO1_NET1_CIDR="10.10.0.0/24"
66
-DEMO2_NET1_CIDR="10.20.0.0/24"
67
-DEMO2_NET2_CIDR="10.20.1.0/24"
68
-
69
-PUBLIC_NET1_GATEWAY="200.0.0.1"
70
-DEMO1_NET1_GATEWAY="10.10.0.1"
71
-DEMO2_NET1_GATEWAY="10.20.0.1"
72
-DEMO2_NET2_GATEWAY="10.20.1.1"
73
-
74
-PUBLIC_NUM_VM=1
75
-DEMO1_NUM_VM=1
76
-DEMO2_NUM_VM=2
77
-
78
-PUBLIC_VM1_NET='admin-net1'
79
-DEMO1_VM1_NET='demo1-net1'
80
-# Multinic settings. But this is fail without nic setting in OS image
81
-DEMO2_VM1_NET='demo2-net1'
82
-DEMO2_VM2_NET='demo2-net2'
83
-
84
-PUBLIC_NUM_ROUTER=1
85
-DEMO1_NUM_ROUTER=1
86
-DEMO2_NUM_ROUTER=1
87
-
88
-PUBLIC_ROUTER1_NET="admin-net1"
89
-DEMO1_ROUTER1_NET="demo1-net1"
90
-DEMO2_ROUTER1_NET="demo2-net1"
91
-
92
-# Various functions
93
-# -----------------
94
-
95
-function foreach_project {
96
-    COMMAND=$1
97
-    for PROJECT in ${PROJECTS//,/ };do
98
-        eval ${COMMAND//%PROJECT%/$PROJECT}
99
-    done
100
-}
101
-
102
-function foreach_project_resource {
103
-    COMMAND=$1
104
-    RESOURCE=$2
105
-    for PROJECT in ${PROJECTS//,/ };do
106
-        eval 'NUM=$'"${PROJECT}_NUM_$RESOURCE"
107
-        for i in `seq $NUM`;do
108
-            local COMMAND_LOCAL=${COMMAND//%PROJECT%/$PROJECT}
109
-            COMMAND_LOCAL=${COMMAND_LOCAL//%NUM%/$i}
110
-            eval $COMMAND_LOCAL
111
-        done
112
-    done
113
-}
114
-
115
-function foreach_project_vm {
116
-    COMMAND=$1
117
-    foreach_project_resource "$COMMAND" 'VM'
118
-}
119
-
120
-function foreach_project_net {
121
-    COMMAND=$1
122
-    foreach_project_resource "$COMMAND" 'NET'
123
-}
124
-
125
-function get_image_id {
126
-    local IMAGE_ID
127
-    IMAGE_ID=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
128
-    die_if_not_set $LINENO IMAGE_ID "Failure retrieving IMAGE_ID"
129
-    echo "$IMAGE_ID"
130
-}
131
-
132
-function get_project_id {
133
-    local PROJECT_NAME=$1
134
-    local PROJECT_ID
135
-    PROJECT_ID=`openstack project list | grep " $PROJECT_NAME " | head -n 1 | get_field 1`
136
-    die_if_not_set $LINENO PROJECT_ID "Failure retrieving PROJECT_ID for $PROJECT_NAME"
137
-    echo "$PROJECT_ID"
138
-}
139
-
140
-function get_user_id {
141
-    local USER_NAME=$1
142
-    local USER_ID
143
-    USER_ID=`openstack user list | grep $USER_NAME | awk '{print $2}'`
144
-    die_if_not_set $LINENO USER_ID "Failure retrieving USER_ID for $USER_NAME"
145
-    echo "$USER_ID"
146
-}
147
-
148
-function get_role_id {
149
-    local ROLE_NAME=$1
150
-    local ROLE_ID
151
-    ROLE_ID=`openstack role assignment list | grep $ROLE_NAME | awk '{print $2}'`
152
-    die_if_not_set $LINENO ROLE_ID "Failure retrieving ROLE_ID for $ROLE_NAME"
153
-    echo "$ROLE_ID"
154
-}
155
-
156
-function get_network_id {
157
-    local NETWORK_NAME="$1"
158
-    local NETWORK_ID
159
-    NETWORK_ID=`openstack network show -f value -c id $NETWORK_NAME`
160
-    echo $NETWORK_ID
161
-}
162
-
163
-function get_flavor_id {
164
-    local INSTANCE_TYPE=$1
165
-    local FLAVOR_ID
166
-    FLAVOR_ID=`nova flavor-list | grep $INSTANCE_TYPE | awk '{print $2}'`
167
-    die_if_not_set $LINENO FLAVOR_ID "Failure retrieving FLAVOR_ID for $INSTANCE_TYPE"
168
-    echo "$FLAVOR_ID"
169
-}
170
-
171
-function confirm_server_active {
172
-    local VM_UUID=$1
173
-    if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $VM_UUID | grep status | grep -q ACTIVE; do sleep 1; done"; then
174
-        echo "server '$VM_UUID' did not become active!"
175
-        false
176
-    fi
177
-}
178
-
179
-function neutron_debug_admin {
180
-    local os_username=$OS_USERNAME
181
-    local os_project_id=$OS_PROJECT_ID
182
-    source $TOP_DIR/openrc admin admin
183
-    neutron-debug $@
184
-    source $TOP_DIR/openrc $os_username $os_project_id
185
-}
186
-
187
-function add_project {