blob: 8396a78ad7e978775d0b6a873d58618922674094 [file] [log] [blame]
Sean Daguee263c822014-12-05 14:25:28 -05001#!/bin/bash
2#
Sean Dagued0931212012-10-04 16:06:44 -04003# lib/tempest
Dean Troyer6d04fd72012-12-21 11:03:37 -06004# Install and configure Tempest
Sean Dagued0931212012-10-04 16:06:44 -04005
6# Dependencies:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +01007#
8# - ``functions`` file
9# - ``lib/nova`` service is running
10# - Global vars that are assumed to be defined:
11# - ``DEST``, ``FILES``
12# - ``ADMIN_PASSWORD``
13# - ``DEFAULT_IMAGE_NAME``
14# - ``S3_SERVICE_PORT``
15# - ``SERVICE_HOST``
16# - ``BASE_SQL_CONN`` ``lib/database`` declares
17# - ``PUBLIC_NETWORK_NAME``
18# - ``Q_USE_NAMESPACE``
19# - ``Q_ROUTER_NAME``
Tomoe Sugiharaafbc6312013-11-14 20:02:47 +000020# - ``Q_L3_ENABLED``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010021# - ``VIRT_DRIVER``
22# - ``LIBVIRT_TYPE``
23# - ``KEYSTONE_SERVICE_PROTOCOL``, ``KEYSTONE_SERVICE_HOST`` from lib/keystone
24#
Attila Fazekas2aa35172012-12-05 20:03:40 +010025# Optional Dependencies:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010026#
27# - ``ALT_*`` (similar vars exists in keystone_data.sh)
28# - ``LIVE_MIGRATION_AVAILABLE``
29# - ``USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION``
30# - ``DEFAULT_INSTANCE_TYPE``
31# - ``DEFAULT_INSTANCE_USER``
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +000032# - ``CINDER_ENABLED_BACKENDS``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010033#
Sean Dagued0931212012-10-04 16:06:44 -040034# ``stack.sh`` calls the entry points in this order:
35#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010036# - install_tempest
37# - configure_tempest
38# - init_tempest
Sean Dagued0931212012-10-04 16:06:44 -040039
40# Save trace setting
41XTRACE=$(set +o | grep xtrace)
42set +o xtrace
43
Dean Troyer6d04fd72012-12-21 11:03:37 -060044
Sean Dagued0931212012-10-04 16:06:44 -040045# Defaults
46# --------
47
Sean Dagued0931212012-10-04 16:06:44 -040048# Set up default directories
Sean Dague91b22902014-11-18 07:13:35 -050049GITDIR["tempest-lib"]=$DEST/tempest-lib
Sean Dague5cb19062014-11-01 01:37:45 +010050
Sean Dagued0931212012-10-04 16:06:44 -040051TEMPEST_DIR=$DEST/tempest
john-griffithdc4dc7f2014-01-22 18:09:32 -070052TEMPEST_CONFIG_DIR=${TEMPEST_CONFIG_DIR:-$TEMPEST_DIR/etc}
53TEMPEST_CONFIG=$TEMPEST_CONFIG_DIR/tempest.conf
Matthew Treinish14ccba02013-07-29 16:15:53 -040054TEMPEST_STATE_PATH=${TEMPEST_STATE_PATH:=$DATA_DIR/tempest}
Attila Fazekas2aa35172012-12-05 20:03:40 +010055
Dean Troyer6d04fd72012-12-21 11:03:37 -060056NOVA_SOURCE_DIR=$DEST/nova
57
Attila Fazekasbae02332013-05-09 09:24:49 +020058BUILD_INTERVAL=1
Arx Cruz1bde9b42014-07-18 11:34:33 -030059
60# This is the timeout that tempest will wait for a VM to change state,
61# spawn, delete, etc.
62# The default is set to 196 seconds.
63BUILD_TIMEOUT=${BUILD_TIMEOUT:-196}
Sean Dagued0931212012-10-04 16:06:44 -040064
Dean Troyer6d04fd72012-12-21 11:03:37 -060065
Attila Fazekas2d4c8da2014-03-19 10:42:01 +010066BOTO_MATERIALS_PATH="$FILES/images/s3-materials/cirros-${CIRROS_VERSION}"
Attila Fazekas58e694e2015-02-04 12:45:50 +010067BOTO_CONF=/etc/boto.cfg
Attila Fazekas1d29d8b2013-01-07 15:51:32 +010068
john-griffithdc4dc7f2014-01-22 18:09:32 -070069# Cinder/Volume variables
70TEMPEST_VOLUME_DRIVER=${TEMPEST_VOLUME_DRIVER:-default}
Eric Harney01456482014-10-14 18:53:53 -040071TEMPEST_DEFAULT_VOLUME_VENDOR="Open Source"
72TEMPEST_VOLUME_VENDOR=${TEMPEST_VOLUME_VENDOR:-$TEMPEST_DEFAULT_VOLUME_VENDOR}
73TEMPEST_DEFAULT_STORAGE_PROTOCOL="iSCSI"
74TEMPEST_STORAGE_PROTOCOL=${TEMPEST_STORAGE_PROTOCOL:-$TEMPEST_DEFAULT_STORAGE_PROTOCOL}
Dean Troyercc6b4432013-04-08 15:38:03 -050075
armando-migliaccio71ef61a2014-02-19 22:19:24 -080076# Neutron/Network variables
Sean Dague53753292014-12-04 19:38:15 -050077IPV6_ENABLED=$(trueorfalse True IPV6_ENABLED)
78IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True IPV6_SUBNET_ATTRIBUTES_ENABLED)
armando-migliaccio71ef61a2014-02-19 22:19:24 -080079
Dean Troyercc6b4432013-04-08 15:38:03 -050080# Functions
81# ---------
Sean Dagued0931212012-10-04 16:06:44 -040082
Salvatore33e8ee22014-10-05 01:36:34 +020083# remove_disabled_extension - removes disabled extensions from the list of extensions
84# to test for a given service
85function remove_disabled_extensions {
86 local extensions_list=$1
87 shift
88 local disabled_exts=$*
89 for ext_to_remove in ${disabled_exts//,/ } ; do
90 extensions_list=${extensions_list/$ext_to_remove","}
91 done
92 echo $extensions_list
93}
94
Sean Dagued0931212012-10-04 16:06:44 -040095# configure_tempest() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +110096function configure_tempest {
Joe Gordon1368b982015-02-04 15:28:18 -080097 # install testr since its used to process tempest logs
98 pip_install `grep -h testrepository $REQUIREMENTS_DIR/global-requirements.txt | cut -d\# -f1`
Attila Fazekas65c08462012-12-07 14:20:51 +010099 local image_lines
100 local images
101 local num_images
102 local image_uuid
103 local image_uuid_alt
Attila Fazekas65c08462012-12-07 14:20:51 +0100104 local password
105 local line
106 local flavors
Clark Boylan3b80bde2013-11-20 17:51:50 -0800107 local available_flavors
Attila Fazekas65c08462012-12-07 14:20:51 +0100108 local flavors_ref
109 local flavor_lines
Maru Newbya5c774e2012-12-10 10:40:01 +0000110 local public_network_id
Maru Newby31c94ab2012-12-19 03:59:20 +0000111 local public_router_id
Maru Newbya5c774e2012-12-10 10:40:01 +0000112 local tenant_networks_reachable
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100113 local boto_instance_type="m1.tiny"
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200114 local ssh_connect_method="fixed"
Attila Fazekas2aa35172012-12-05 20:03:40 +0100115
Dean Troyer6d04fd72012-12-21 11:03:37 -0600116 # Save IFS
Attila Fazekas2aa35172012-12-05 20:03:40 +0100117 ifs=$IFS
118
119 # Glance should already contain images to be used in tempest
120 # testing. Here we simply look for images stored in Glance
121 # and set the appropriate variables for use in the tempest config
122 # We ignore ramdisk and kernel images, look for the default image
Attila Fazekas65c08462012-12-07 14:20:51 +0100123 # ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the
124 # first image returned and set ``image_uuid_alt`` to the second,
Attila Fazekas2aa35172012-12-05 20:03:40 +0100125 # if there is more than one returned...
126 # ... Also ensure we only take active images, so we don't get snapshots in process
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500127 declare -a images
128
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200129 if is_service_enabled glance; then
130 while read -r IMAGE_NAME IMAGE_UUID; do
131 if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
132 image_uuid="$IMAGE_UUID"
133 image_uuid_alt="$IMAGE_UUID"
134 fi
135 images+=($IMAGE_UUID)
136 # TODO(stevemar): update this command to use openstackclient's `openstack image list`
137 # when it supports listing by status.
138 done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500139
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200140 case "${#images[*]}" in
141 0)
142 echo "Found no valid images to use!"
143 exit 1
144 ;;
145 1)
146 if [ -z "$image_uuid" ]; then
147 image_uuid=${images[0]}
148 image_uuid_alt=${images[0]}
149 fi
150 ;;
151 *)
152 if [ -z "$image_uuid" ]; then
153 image_uuid=${images[0]}
154 image_uuid_alt=${images[1]}
155 fi
156 ;;
157 esac
158 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100159
160 # Create tempest.conf from tempest.conf.sample
161 # copy every time, because the image UUIDS are going to change
Ian Wienand5f90fc02014-02-24 15:40:42 +1100162 if [[ ! -d $TEMPEST_CONFIG_DIR ]]; then
163 sudo mkdir -p $TEMPEST_CONFIG_DIR
164 fi
165 sudo chown $STACK_USER $TEMPEST_CONFIG_DIR
166 cp $TEMPEST_DIR/etc/tempest.conf.sample $TEMPEST_CONFIG
167 chmod 644 $TEMPEST_CONFIG
Attila Fazekas2aa35172012-12-05 20:03:40 +0100168
Attila Fazekas65c08462012-12-07 14:20:51 +0100169 password=${ADMIN_PASSWORD:-secrete}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100170
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000171 # See files/keystone_data.sh and stack.sh where admin, demo and alt_demo
172 # user and tenant are set up...
173 ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
174 ADMIN_TENANT_NAME=${ADMIN_TENANT_NAME:-admin}
Andrea Frittoli03523252014-04-08 13:43:56 +0100175 ADMIN_DOMAIN_NAME=${ADMIN_DOMAIN_NAME:-Default}
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000176 TEMPEST_USERNAME=${TEMPEST_USERNAME:-demo}
177 TEMPEST_TENANT_NAME=${TEMPEST_TENANT_NAME:-demo}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100178 ALT_USERNAME=${ALT_USERNAME:-alt_demo}
179 ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
Harshada Mangesh Kakad49126232014-05-23 09:16:52 +0000180 ADMIN_TENANT_ID=$(openstack project list | awk "/ admin / { print \$2 }")
Attila Fazekas2aa35172012-12-05 20:03:40 +0100181
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200182 if is_service_enabled nova; then
183 # If the ``DEFAULT_INSTANCE_TYPE`` not declared, use the new behavior
184 # Tempest creates instane types for himself
185 if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
186 available_flavors=$(nova flavor-list)
187 if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
188 if is_arch "ppc64"; then
189 # qemu needs at least 128MB of memory to boot on ppc64
190 nova flavor-create m1.nano 42 128 0 1
191 else
192 nova flavor-create m1.nano 42 64 0 1
193 fi
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200194 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200195 flavor_ref=42
196 boto_instance_type=m1.nano
197 if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
198 if is_arch "ppc64"; then
199 nova flavor-create m1.micro 84 256 0 1
200 else
201 nova flavor-create m1.micro 84 128 0 1
202 fi
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200203 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200204 flavor_ref_alt=84
205 else
206 # Check Nova for existing flavors and, if set, look for the
207 # ``DEFAULT_INSTANCE_TYPE`` and use that.
208 boto_instance_type=$DEFAULT_INSTANCE_TYPE
209 flavor_lines=`nova flavor-list`
210 IFS=$'\r\n'
211 flavors=""
212 for line in $flavor_lines; do
213 f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
214 flavors="$flavors $f"
215 done
Attila Fazekas2aa35172012-12-05 20:03:40 +0100216
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200217 for line in $flavor_lines; do
218 flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
219 done
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100220
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200221 IFS=" "
222 flavors=($flavors)
223 num_flavors=${#flavors[*]}
224 echo "Found $num_flavors flavors"
225 if [[ $num_flavors -eq 0 ]]; then
226 echo "Found no valid flavors to use!"
227 exit 1
Adalberto Medeiros63a71a22013-06-06 08:46:04 -0400228 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200229 flavor_ref=${flavors[0]}
230 flavor_ref_alt=$flavor_ref
231
232 # ensure flavor_ref and flavor_ref_alt have different values
233 # some resize instance in tempest tests depends on this.
234 for f in ${flavors[@]:1}; do
235 if [[ $f -ne $flavor_ref ]]; then
236 flavor_ref_alt=$f
237 break
238 fi
239 done
240 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100241 fi
242
Maru Newbya5c774e2012-12-10 10:40:01 +0000243 if [ "$Q_USE_NAMESPACE" != "False" ]; then
244 tenant_networks_reachable=false
Attila Fazekasf9e77392013-12-03 06:17:16 +0100245 if ! is_service_enabled n-net; then
246 ssh_connect_method="floating"
247 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000248 else
249 tenant_networks_reachable=true
250 fi
251
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200252 ssh_connect_method=${TEMPEST_SSH_CONNECT_METHOD:-$ssh_connect_method}
253
Tomoe Sugiharaafbc6312013-11-14 20:02:47 +0000254 if [ "$Q_L3_ENABLED" = "True" ]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400255 public_network_id=$(neutron net-list | grep $PUBLIC_NETWORK_NAME | \
Maru Newbya5c774e2012-12-10 10:40:01 +0000256 awk '{print $2}')
Maru Newby31c94ab2012-12-19 03:59:20 +0000257 if [ "$Q_USE_NAMESPACE" == "False" ]; then
258 # If namespaces are disabled, devstack will create a single
259 # public router that tempest should be configured to use.
Mark McClainb05c8762013-07-06 23:29:39 -0400260 public_router_id=$(neutron router-list | awk "/ $Q_ROUTER_NAME / \
Sean Dague101b4242013-10-22 08:47:11 -0400261 { print \$2 }")
Maru Newby31c94ab2012-12-19 03:59:20 +0000262 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000263 fi
264
Masayuki Igawa5a252d92014-11-21 21:55:09 +0900265 iniset $TEMPEST_CONFIG DEFAULT use_syslog $SYSLOG
Matthew Treinish859cc682013-07-26 15:22:44 -0400266 # Oslo
john-griffithdc4dc7f2014-01-22 18:09:32 -0700267 iniset $TEMPEST_CONFIG DEFAULT lock_path $TEMPEST_STATE_PATH
Matthew Treinish14ccba02013-07-29 16:15:53 -0400268 mkdir -p $TEMPEST_STATE_PATH
john-griffithdc4dc7f2014-01-22 18:09:32 -0700269 iniset $TEMPEST_CONFIG DEFAULT use_stderr False
270 iniset $TEMPEST_CONFIG DEFAULT log_file tempest.log
271 iniset $TEMPEST_CONFIG DEFAULT debug True
Matthew Treinish859cc682013-07-26 15:22:44 -0400272
Attila Fazekas2aa35172012-12-05 20:03:40 +0100273 # Timeouts
john-griffithdc4dc7f2014-01-22 18:09:32 -0700274 iniset $TEMPEST_CONFIG compute build_timeout $BUILD_TIMEOUT
275 iniset $TEMPEST_CONFIG volume build_timeout $BUILD_TIMEOUT
276 iniset $TEMPEST_CONFIG boto build_timeout $BUILD_TIMEOUT
john-griffithdc4dc7f2014-01-22 18:09:32 -0700277 iniset $TEMPEST_CONFIG boto http_socket_timeout 5
Attila Fazekas2aa35172012-12-05 20:03:40 +0100278
Attila Fazekas97d3d202013-01-19 19:20:49 +0100279 # Identity
john-griffithdc4dc7f2014-01-22 18:09:32 -0700280 iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v2.0/"
Steve Martinellib74e01c2014-12-18 01:35:35 -0500281 iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_URI_V3"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000282 iniset $TEMPEST_CONFIG identity username $TEMPEST_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700283 iniset $TEMPEST_CONFIG identity password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000284 iniset $TEMPEST_CONFIG identity tenant_name $TEMPEST_TENANT_NAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700285 iniset $TEMPEST_CONFIG identity alt_username $ALT_USERNAME
286 iniset $TEMPEST_CONFIG identity alt_password "$password"
287 iniset $TEMPEST_CONFIG identity alt_tenant_name $ALT_TENANT_NAME
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000288 iniset $TEMPEST_CONFIG identity admin_username $ADMIN_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700289 iniset $TEMPEST_CONFIG identity admin_password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000290 iniset $TEMPEST_CONFIG identity admin_tenant_name $ADMIN_TENANT_NAME
Harshada Mangesh Kakad49126232014-05-23 09:16:52 +0000291 iniset $TEMPEST_CONFIG identity admin_tenant_id $ADMIN_TENANT_ID
Andrea Frittoli03523252014-04-08 13:43:56 +0100292 iniset $TEMPEST_CONFIG identity admin_domain_name $ADMIN_DOMAIN_NAME
Andrea Frittoli07f1d0e2014-03-06 23:23:01 +0000293 iniset $TEMPEST_CONFIG identity auth_version ${TEMPEST_AUTH_VERSION:-v2}
Rob Crittendene1d013f2015-02-10 14:15:35 -0500294 if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then
295 iniset $TEMPEST_CONFIG identity ca_certificates_file $SSL_BUNDLE_FILE
296 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100297
Sean Daguec3771452013-06-13 14:23:37 -0400298 # Image
299 # for the gate we want to be able to override this variable so we aren't
300 # doing an HTTP fetch over the wide internet for this test
301 if [[ ! -z "$TEMPEST_HTTP_IMAGE" ]]; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700302 iniset $TEMPEST_CONFIG image http_image $TEMPEST_HTTP_IMAGE
Sean Daguec3771452013-06-13 14:23:37 -0400303 fi
304
Andrea Frittoli122a16f2014-08-14 08:18:40 +0100305 # Auth
306 iniset $TEMPEST_CONFIG auth allow_tenant_isolation ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
307
Attila Fazekas97d3d202013-01-19 19:20:49 +0100308 # Compute
john-griffithdc4dc7f2014-01-22 18:09:32 -0700309 iniset $TEMPEST_CONFIG compute ssh_user ${DEFAULT_INSTANCE_USER:-cirros} # DEPRECATED
310 iniset $TEMPEST_CONFIG compute network_for_ssh $PRIVATE_NETWORK_NAME
311 iniset $TEMPEST_CONFIG compute ip_version_for_ssh 4
312 iniset $TEMPEST_CONFIG compute ssh_timeout $BUILD_TIMEOUT
313 iniset $TEMPEST_CONFIG compute image_ref $image_uuid
314 iniset $TEMPEST_CONFIG compute image_ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
315 iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid_alt
Kirill Shileev608f8842014-10-03 22:48:58 +0400316 iniset $TEMPEST_CONFIG compute image_alt_ssh_user ${ALT_INSTANCE_USER:-cirros}
john-griffithdc4dc7f2014-01-22 18:09:32 -0700317 iniset $TEMPEST_CONFIG compute flavor_ref $flavor_ref
318 iniset $TEMPEST_CONFIG compute flavor_ref_alt $flavor_ref_alt
john-griffithdc4dc7f2014-01-22 18:09:32 -0700319 iniset $TEMPEST_CONFIG compute ssh_connect_method $ssh_connect_method
Attila Fazekas97d3d202013-01-19 19:20:49 +0100320
Sean Daguede19bf92014-03-20 16:54:58 -0400321 # Compute Features
Salvatore33e8ee22014-10-05 01:36:34 +0200322 # Run verify_tempest_config -ur to retrieve enabled extensions on API endpoints
323 # NOTE(mtreinish): This must be done after auth settings are added to the tempest config
324 local tmp_cfg_file=$(mktemp)
Joe Gordon1368b982015-02-04 15:28:18 -0800325 cd $TEMPEST_DIR
326 tox -evenv -- verify-tempest-config -uro $tmp_cfg_file
Salvatore33e8ee22014-10-05 01:36:34 +0200327
328 local compute_api_extensions=${COMPUTE_API_EXTENSIONS:-"all"}
329 if [[ ! -z "$DISABLE_COMPUTE_API_EXTENSIONS" ]]; then
330 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
331 compute_api_extensions=${COMPUTE_API_EXTENSIONS:-$(iniget $tmp_cfg_file compute-feature-enabled api_extensions | tr -d " ")}
332 # Remove disabled extensions
333 compute_api_extensions=$(remove_disabled_extensions $compute_api_extensions $DISABLE_COMPUTE_API_EXTENSIONS)
334 fi
335
Sean Daguede19bf92014-03-20 16:54:58 -0400336 iniset $TEMPEST_CONFIG compute-feature-enabled resize True
Matthew Treinish270f93e2014-03-20 21:18:42 +0000337 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
338 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
339 iniset $TEMPEST_CONFIG compute-feature-enabled block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
Salvatore33e8ee22014-10-05 01:36:34 +0200340 iniset $TEMPEST_CONFIG compute-feature-enabled api_extensions $compute_api_extensions
Sean Daguede19bf92014-03-20 16:54:58 -0400341
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200342 # Compute admin
Sean Daguee530ba32014-03-07 05:58:18 -0500343 iniset $TEMPEST_CONFIG "compute-admin" username $ADMIN_USERNAME
344 iniset $TEMPEST_CONFIG "compute-admin" password "$password"
345 iniset $TEMPEST_CONFIG "compute-admin" tenant_name $ADMIN_TENANT_NAME
Attila Fazekas2aa35172012-12-05 20:03:40 +0100346
armando-migliaccio71ef61a2014-02-19 22:19:24 -0800347 # Network
john-griffithdc4dc7f2014-01-22 18:09:32 -0700348 iniset $TEMPEST_CONFIG network api_version 2.0
349 iniset $TEMPEST_CONFIG network tenant_networks_reachable "$tenant_networks_reachable"
350 iniset $TEMPEST_CONFIG network public_network_id "$public_network_id"
351 iniset $TEMPEST_CONFIG network public_router_id "$public_router_id"
352 iniset $TEMPEST_CONFIG network default_network "$FIXED_RANGE"
Matthew Treinishccf60f72014-03-03 22:48:31 -0500353 iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED"
Sean M. Collinsbb2908b2014-05-15 10:24:31 -0400354 iniset $TEMPEST_CONFIG network-feature-enabled ipv6_subnet_attributes "$IPV6_SUBNET_ATTRIBUTES_ENABLED"
Salvatore33e8ee22014-10-05 01:36:34 +0200355
356 local network_api_extensions=${NETWORK_API_EXTENSIONS:-"all"}
357 if [[ ! -z "$DISABLE_NETWORK_API_EXTENSIONS" ]]; then
358 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
359 network_api_extensions=${NETWORK_API_EXTENSIONS:-$(iniget $tmp_cfg_file network-feature-enabled api_extensions | tr -d " ")}
360 # Remove disabled extensions
361 network_api_extensions=$(remove_disabled_extensions $network_api_extensions $DISABLE_NETWORK_API_EXTENSIONS)
362 fi
363 iniset $TEMPEST_CONFIG network-feature-enabled api_extensions $network_api_extensions
Attila Fazekas2aa35172012-12-05 20:03:40 +0100364
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200365 # boto
Andrey Pavlov0ea8b722015-02-06 22:37:53 +0300366 iniset $TEMPEST_CONFIG boto ec2_url "$EC2_SERVICE_PROTOCOL://$SERVICE_HOST:8773/"
john-griffithdc4dc7f2014-01-22 18:09:32 -0700367 iniset $TEMPEST_CONFIG boto s3_url "http://$SERVICE_HOST:${S3_SERVICE_PORT:-3333}"
368 iniset $TEMPEST_CONFIG boto s3_materials_path "$BOTO_MATERIALS_PATH"
Adalberto Medeiros53971532014-07-10 16:55:49 -0300369 iniset $TEMPEST_CONFIG boto ari_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initrd.manifest.xml
370 iniset $TEMPEST_CONFIG boto ami_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-blank.img.manifest.xml
371 iniset $TEMPEST_CONFIG boto aki_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-vmlinuz.manifest.xml
john-griffithdc4dc7f2014-01-22 18:09:32 -0700372 iniset $TEMPEST_CONFIG boto instance_type "$boto_instance_type"
373 iniset $TEMPEST_CONFIG boto http_socket_timeout 30
374 iniset $TEMPEST_CONFIG boto ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100375
Sean Dague669c4fc2014-04-03 11:28:01 -0400376 # Orchestration Tests
377 if is_service_enabled heat; then
378 if [[ ! -z "$HEAT_CFN_IMAGE_URL" ]]; then
Alessandro Pilottif3e75bf2014-12-15 20:02:08 +0200379 iniset $TEMPEST_CONFIG orchestration image_ref $(basename "${HEAT_CFN_IMAGE_URL%.*}")
Sean Dague669c4fc2014-04-03 11:28:01 -0400380 fi
Attila Fazekas51557a52014-06-13 16:09:37 +0200381 # build a specialized heat flavor
Sean Dague669c4fc2014-04-03 11:28:01 -0400382 available_flavors=$(nova flavor-list)
383 if [[ ! ( $available_flavors =~ 'm1.heat' ) ]]; then
Attila Fazekas51557a52014-06-13 16:09:37 +0200384 nova flavor-create m1.heat 451 512 0 1
Sean Dague669c4fc2014-04-03 11:28:01 -0400385 fi
386 iniset $TEMPEST_CONFIG orchestration instance_type "m1.heat"
387 iniset $TEMPEST_CONFIG orchestration build_timeout 900
Steve Bakerd5cccad2013-07-19 10:34:24 +1200388 fi
389
William Marshall24d866e2013-07-02 12:26:31 -0500390 # Scenario
Adalberto Medeiros53971532014-07-10 16:55:49 -0300391 iniset $TEMPEST_CONFIG scenario img_dir "$FILES/images/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec"
392 iniset $TEMPEST_CONFIG scenario ami_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-blank.img"
393 iniset $TEMPEST_CONFIG scenario ari_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initrd"
394 iniset $TEMPEST_CONFIG scenario aki_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-vmlinuz"
William Marshall24d866e2013-07-02 12:26:31 -0500395
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400396 # Large Ops Number
john-griffithdc4dc7f2014-01-22 18:09:32 -0700397 iniset $TEMPEST_CONFIG scenario large_ops_number ${TEMPEST_LARGE_OPS_NUMBER:-0}
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400398
Vadim Rovachev2541d612014-05-29 18:48:10 +0400399 # Telemetry
400 # Ceilometer API optimization happened in juno that allows to run more tests in tempest.
401 # Once Tempest retires support for icehouse this flag can be removed.
402 iniset $TEMPEST_CONFIG telemetry too_slow_to_test "False"
403
Salvatore Orlando3046bc62014-08-21 12:11:10 -0700404 # Object storage
Salvatore33e8ee22014-10-05 01:36:34 +0200405 local object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
406 if [[ ! -z "$DISABLE_OBJECT_STORAGE_API_EXTENSIONS" ]]; then
407 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
408 object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-$(iniget $tmp_cfg_file object-storage-feature-enabled discoverable_apis | tr -d " ")}
409 # Remove disabled extensions
410 object_storage_api_extensions=$(remove_disabled_extensions $object_storage_api_extensions $DISABLE_STORAGE_API_EXTENSIONS)
411 fi
412 iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis $object_storage_api_extensions
Salvatore Orlando3046bc62014-08-21 12:11:10 -0700413
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200414 # Volume
Salvatore33e8ee22014-10-05 01:36:34 +0200415 local volume_api_extensions=${VOLUME_API_EXTENSIONS:-"all"}
416 if [[ ! -z "$DISABLE_VOLUME_API_EXTENSIONS" ]]; then
417 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
418 volume_api_extensions=${VOLUME_API_EXTENSIONS:-$(iniget $tmp_cfg_file volume-feature-enabled api_extensions | tr -d " ")}
419 # Remove disabled extensions
420 volume_api_extensions=$(remove_disabled_extensions $volume_api_extensions $DISABLE_VOLUME_API_EXTENSIONS)
421 fi
422 iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions $volume_api_extensions
423
Giulio Fidente3d60f4d2014-02-20 16:43:49 +0100424 if ! is_service_enabled c-bak; then
425 iniset $TEMPEST_CONFIG volume-feature-enabled backup False
Giulio Fidente3632ab12013-09-10 02:51:26 +0200426 fi
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000427
428 # Using CINDER_ENABLED_BACKENDS
429 if [[ -n "$CINDER_ENABLED_BACKENDS" ]] && [[ $CINDER_ENABLED_BACKENDS =~ .*,.* ]]; then
Matthew Treinishdb1c3842014-02-04 20:58:00 +0000430 iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000431 local i=1
432 local be
433 for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
434 local be_name=${be##*:}
435 iniset $TEMPEST_CONFIG volume "backend${i}_name" "$be_name"
436 i=$(( i + 1 ))
437 done
john-griffithdc4dc7f2014-01-22 18:09:32 -0700438 fi
439
Eric Harney01456482014-10-14 18:53:53 -0400440 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
Patrick East1c0628f2014-10-22 16:22:47 -0700441 "$TEMPEST_VOLUME_VENDOR" != "$TEMPEST_DEFAULT_VOLUME_VENDOR" ]; then
Ed Balduf2f23d752014-07-29 14:42:27 -0600442 iniset $TEMPEST_CONFIG volume vendor_name "$TEMPEST_VOLUME_VENDOR"
Eric Harney01456482014-10-14 18:53:53 -0400443 fi
444 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
JordanP82a7d932014-12-04 14:09:16 +0100445 "$TEMPEST_STORAGE_PROTOCOL" != "$TEMPEST_DEFAULT_STORAGE_PROTOCOL" ]; then
446 iniset $TEMPEST_CONFIG volume storage_protocol "$TEMPEST_STORAGE_PROTOCOL"
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200447 fi
448
Julie Pichonfea70f82013-07-29 11:22:08 +0100449 # Dashboard
john-griffithdc4dc7f2014-01-22 18:09:32 -0700450 iniset $TEMPEST_CONFIG dashboard dashboard_url "http://$SERVICE_HOST/"
451 iniset $TEMPEST_CONFIG dashboard login_url "http://$SERVICE_HOST/auth/login/"
Julie Pichonfea70f82013-07-29 11:22:08 +0100452
Ian Wienand7fa19022013-06-25 14:11:48 +1000453 # cli
john-griffithdc4dc7f2014-01-22 18:09:32 -0700454 iniset $TEMPEST_CONFIG cli cli_dir $NOVA_BIN_DIR
Ian Wienand7fa19022013-06-25 14:11:48 +1000455
Adam Gandelman43bd6672014-04-03 11:13:13 -0700456 # Baremetal
457 if [ "$VIRT_DRIVER" = "ironic" ] ; then
458 iniset $TEMPEST_CONFIG baremetal driver_enabled True
Adam Gandelmanfdfe7a02014-07-24 10:06:18 -0400459 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
460 iniset $TEMPEST_CONFIG compute-feature-enabled console_output False
461 iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False
462 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration False
463 iniset $TEMPEST_CONFIG compute-feature-enabled pause False
464 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
465 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
466 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
467 iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
David Shrewsburycf21b712014-08-13 07:03:58 -0400468 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
Adam Gandelman43bd6672014-04-03 11:13:13 -0700469 fi
470
Nels Nelson7b47c472015-01-05 16:36:42 -0600471 # Libvirt-LXC
472 if [ "$VIRT_DRIVER" = "libvirt" ] && [ "$LIBVIRT_TYPE" = "lxc" ]; then
473 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
474 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
475 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
476 fi
477
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400478 # service_available
Dean Troyer4237f592014-01-29 16:22:11 -0600479 for service in ${TEMPEST_SERVICES//,/ }; do
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400480 if is_service_enabled $service ; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700481 iniset $TEMPEST_CONFIG service_available $service "True"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400482 else
john-griffithdc4dc7f2014-01-22 18:09:32 -0700483 iniset $TEMPEST_CONFIG service_available $service "False"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400484 fi
485 done
486
Rob Crittendene1d013f2015-02-10 14:15:35 -0500487 if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then
Rob Crittenden90c20202014-11-17 01:16:22 -0500488 # Use the BOTO_CONFIG environment variable to point to this file
489 iniset $BOTO_CONF Boto ca_certificates_file $SSL_BUNDLE_FILE
490 sudo chown $STACK_USER $BOTO_CONF
491 fi
492
Attila Fazekas2aa35172012-12-05 20:03:40 +0100493 # Restore IFS
494 IFS=$ifs
Sean Dagued0931212012-10-04 16:06:44 -0400495}
496
Dean Troyer42a59c22014-03-03 14:31:29 -0600497# create_tempest_accounts() - Set up common required tempest accounts
498
499# Project User Roles
500# ------------------------------------------------------------------
501# alt_demo alt_demo Member
502
503# Migrated from keystone_data.sh
504function create_tempest_accounts {
505 if is_service_enabled tempest; then
506 # Tempest has some tests that validate various authorization checks
507 # between two regular users in separate tenants
Bartosz Górski0abde392014-02-28 14:15:19 +0100508 get_or_create_project alt_demo
Jamie Lennox18f39bf2015-01-28 13:38:32 +1000509 get_or_create_user alt_demo "$ADMIN_PASSWORD" "alt_demo@example.com"
Jamie Lennox9b215db2015-02-10 18:19:57 +1100510 get_or_add_user_project_role Member alt_demo alt_demo
Dean Troyer42a59c22014-03-03 14:31:29 -0600511 fi
512}
513
Matthew Treinish34723862014-09-08 14:01:21 -0400514# install_tempest_lib() - Collect source, prepare, and install tempest-lib
515function install_tempest_lib {
Sean Dague91b22902014-11-18 07:13:35 -0500516 if use_library_from_git "tempest-lib"; then
517 git_clone_by_name "tempest-lib"
Sean Dague86b65dd2014-11-20 17:23:04 -0500518 setup_dev_lib "tempest-lib"
Sean Dague5cb19062014-11-01 01:37:45 +0100519 fi
Matthew Treinish34723862014-09-08 14:01:21 -0400520}
521
Sean Dagued0931212012-10-04 16:06:44 -0400522# install_tempest() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100523function install_tempest {
Matthew Treinish34723862014-09-08 14:01:21 -0400524 install_tempest_lib
Sean Dagued0931212012-10-04 16:06:44 -0400525 git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
Clark Boylan33dc8692014-08-19 22:37:10 -0700526 pip_install tox
Sean Dagued0931212012-10-04 16:06:44 -0400527}
528
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100529# init_tempest() - Initialize ec2 images
Ian Wienandaee18c72014-02-21 15:35:08 +1100530function init_tempest {
Adalberto Medeiros53971532014-07-10 16:55:49 -0300531 local base_image_name=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}
532 # /opt/stack/devstack/files/images/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec
Attila Fazekas3c529222013-01-21 06:50:33 +0100533 local image_dir="$FILES/images/${base_image_name}-uec"
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100534 local kernel="$image_dir/${base_image_name}-vmlinuz"
535 local ramdisk="$image_dir/${base_image_name}-initrd"
536 local disk_image="$image_dir/${base_image_name}-blank.img"
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200537 if is_service_enabled nova; then
538 # if the cirros uec downloaded and the system is uec capable
539 if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a "$VIRT_DRIVER" != "openvz" \
540 -a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then
541 echo "Prepare aki/ari/ami Images"
542 mkdir -p $BOTO_MATERIALS_PATH
543 ( #new namespace
544 # tenant:demo ; user: demo
545 source $TOP_DIR/accrc/demo/demo
546 euca-bundle-image -r ${CIRROS_ARCH} -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH"
547 euca-bundle-image -r ${CIRROS_ARCH} -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH"
548 euca-bundle-image -r ${CIRROS_ARCH} -i "$disk_image" -d "$BOTO_MATERIALS_PATH"
549 ) 2>&1 </dev/null | cat
550 else
551 echo "Boto materials are not prepared"
552 fi
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100553 fi
554}
555
Sean Dagued0931212012-10-04 16:06:44 -0400556# Restore xtrace
557$XTRACE
Sean Dague584d90e2013-03-29 14:34:53 -0400558
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100559# Tell emacs to use shell-script-mode
560## Local variables:
561## mode: shell-script
562## End: