blob: b9d9e80fc29c62ec8f08505514d388d30d53aa22 [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``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010018# - ``Q_ROUTER_NAME``
Tomoe Sugiharaafbc6312013-11-14 20:02:47 +000019# - ``Q_L3_ENABLED``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010020# - ``VIRT_DRIVER``
21# - ``LIBVIRT_TYPE``
22# - ``KEYSTONE_SERVICE_PROTOCOL``, ``KEYSTONE_SERVICE_HOST`` from lib/keystone
23#
Attila Fazekas2aa35172012-12-05 20:03:40 +010024# Optional Dependencies:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010025#
Einst Crazyf54f60a2015-10-30 23:00:57 +080026# - ``ALT_*``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010027# - ``LIVE_MIGRATION_AVAILABLE``
28# - ``USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION``
29# - ``DEFAULT_INSTANCE_TYPE``
30# - ``DEFAULT_INSTANCE_USER``
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +000031# - ``CINDER_ENABLED_BACKENDS``
Matt Riedemann89ee5852015-07-09 13:25:04 -070032# - ``NOVA_ALLOW_DUPLICATE_NETWORKS``
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
Ian Wienand523f4882015-10-13 11:03:03 +110041_XTRACE_TEMPEST=$(set +o | grep xtrace)
Sean Dagued0931212012-10-04 16:06:44 -040042set +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
Joe Gordonc9b245b2015-02-10 14:32:39 -080065# This must be False on stable branches, as master tempest
66# deps do not match stable branch deps. Set this to True to
Dean Troyerdc97cb72015-03-28 08:20:50 -050067# have tempest installed in DevStack by default.
Matthew Treinishcb3cece2015-03-16 10:37:51 -040068INSTALL_TEMPEST=${INSTALL_TEMPEST:-"True"}
Joe Gordonc9b245b2015-02-10 14:32:39 -080069
Attila Fazekas2d4c8da2014-03-19 10:42:01 +010070BOTO_MATERIALS_PATH="$FILES/images/s3-materials/cirros-${CIRROS_VERSION}"
Attila Fazekas58e694e2015-02-04 12:45:50 +010071BOTO_CONF=/etc/boto.cfg
Attila Fazekas1d29d8b2013-01-07 15:51:32 +010072
john-griffithdc4dc7f2014-01-22 18:09:32 -070073# Cinder/Volume variables
74TEMPEST_VOLUME_DRIVER=${TEMPEST_VOLUME_DRIVER:-default}
Eric Harney01456482014-10-14 18:53:53 -040075TEMPEST_DEFAULT_VOLUME_VENDOR="Open Source"
76TEMPEST_VOLUME_VENDOR=${TEMPEST_VOLUME_VENDOR:-$TEMPEST_DEFAULT_VOLUME_VENDOR}
77TEMPEST_DEFAULT_STORAGE_PROTOCOL="iSCSI"
78TEMPEST_STORAGE_PROTOCOL=${TEMPEST_STORAGE_PROTOCOL:-$TEMPEST_DEFAULT_STORAGE_PROTOCOL}
Dean Troyercc6b4432013-04-08 15:38:03 -050079
armando-migliaccio71ef61a2014-02-19 22:19:24 -080080# Neutron/Network variables
Sean Dague53753292014-12-04 19:38:15 -050081IPV6_ENABLED=$(trueorfalse True IPV6_ENABLED)
82IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True IPV6_SUBNET_ATTRIBUTES_ENABLED)
armando-migliaccio71ef61a2014-02-19 22:19:24 -080083
Matthew Treinishdf8f43b2015-08-09 20:30:39 -040084# Do we want to make a configuration where Tempest has admin on
85# the cloud. We don't always want to so that we can ensure Tempest
86# would work on a public cloud.
87TEMPEST_HAS_ADMIN=$(trueorfalse True TEMPEST_HAS_ADMIN)
88
89# Credential provider configuration option variables
90TEMPEST_ALLOW_TENANT_ISOLATION=${TEMPEST_ALLOW_TENANT_ISOLATION:-$TEMPEST_HAS_ADMIN}
Matthew Treinish403fbb12015-08-24 21:17:37 -040091TEMPEST_USE_TEST_ACCOUNTS=$(trueorfalse False TEMPEST_USE_TEST_ACCOUNTS)
Matthew Treinishdf8f43b2015-08-09 20:30:39 -040092
93# The number of workers tempest is expected to be run with. This is used for
94# generating a accounts.yaml for running with test-accounts. This is also the
95# same variable that devstack-gate uses to specify the number of workers that
96# it will run tempest with
97TEMPEST_CONCURRENCY=${TEMPEST_CONCURRENCY:-$(nproc)}
98
Dean Troyerdc97cb72015-03-28 08:20:50 -050099
Dean Troyercc6b4432013-04-08 15:38:03 -0500100# Functions
101# ---------
Sean Dagued0931212012-10-04 16:06:44 -0400102
Salvatore33e8ee22014-10-05 01:36:34 +0200103# remove_disabled_extension - removes disabled extensions from the list of extensions
104# to test for a given service
105function remove_disabled_extensions {
106 local extensions_list=$1
107 shift
108 local disabled_exts=$*
fumihiko kakuma8606c982015-04-13 09:55:06 +0900109 remove_disabled_services "$extensions_list" "$disabled_exts"
Salvatore33e8ee22014-10-05 01:36:34 +0200110}
111
Sean Dagued0931212012-10-04 16:06:44 -0400112# configure_tempest() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +1100113function configure_tempest {
Joe Gordonc9b245b2015-02-10 14:32:39 -0800114 if [[ "$INSTALL_TEMPEST" == "True" ]]; then
115 setup_develop $TEMPEST_DIR
116 else
117 # install testr since its used to process tempest logs
Sean Dague60996b12015-04-08 09:06:49 -0400118 pip_install_gr testrepository
Joe Gordonc9b245b2015-02-10 14:32:39 -0800119 fi
Joe Gordond5ac7852015-02-06 19:29:23 -0800120
Attila Fazekas65c08462012-12-07 14:20:51 +0100121 local image_lines
122 local images
123 local num_images
124 local image_uuid
125 local image_uuid_alt
Attila Fazekas65c08462012-12-07 14:20:51 +0100126 local password
127 local line
128 local flavors
Clark Boylan3b80bde2013-11-20 17:51:50 -0800129 local available_flavors
Attila Fazekas65c08462012-12-07 14:20:51 +0100130 local flavors_ref
131 local flavor_lines
Maru Newbya5c774e2012-12-10 10:40:01 +0000132 local public_network_id
Maru Newby31c94ab2012-12-19 03:59:20 +0000133 local public_router_id
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100134 local boto_instance_type="m1.tiny"
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200135 local ssh_connect_method="fixed"
Attila Fazekas2aa35172012-12-05 20:03:40 +0100136
Dean Troyer6d04fd72012-12-21 11:03:37 -0600137 # Save IFS
Attila Fazekas2aa35172012-12-05 20:03:40 +0100138 ifs=$IFS
139
140 # Glance should already contain images to be used in tempest
141 # testing. Here we simply look for images stored in Glance
142 # and set the appropriate variables for use in the tempest config
143 # We ignore ramdisk and kernel images, look for the default image
Attila Fazekas65c08462012-12-07 14:20:51 +0100144 # ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the
145 # first image returned and set ``image_uuid_alt`` to the second,
Attila Fazekas2aa35172012-12-05 20:03:40 +0100146 # if there is more than one returned...
147 # ... Also ensure we only take active images, so we don't get snapshots in process
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500148 declare -a images
149
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200150 if is_service_enabled glance; then
151 while read -r IMAGE_NAME IMAGE_UUID; do
152 if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
153 image_uuid="$IMAGE_UUID"
154 image_uuid_alt="$IMAGE_UUID"
155 fi
156 images+=($IMAGE_UUID)
Swapnil Kulkarnia747cd22015-05-13 09:26:15 +0000157 done < <(openstack image list --property status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500158
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200159 case "${#images[*]}" in
160 0)
161 echo "Found no valid images to use!"
162 exit 1
163 ;;
164 1)
165 if [ -z "$image_uuid" ]; then
166 image_uuid=${images[0]}
167 image_uuid_alt=${images[0]}
168 fi
169 ;;
170 *)
171 if [ -z "$image_uuid" ]; then
172 image_uuid=${images[0]}
173 image_uuid_alt=${images[1]}
174 fi
175 ;;
176 esac
177 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100178
Matthew Treinish93c10572015-07-31 10:38:50 -0400179 # (Re)create ``tempest.conf``
180 # Create every time because the image UUIDS are going to change
Dean Troyer8421c2b2015-03-16 13:52:19 -0500181 sudo install -d -o $STACK_USER $TEMPEST_CONFIG_DIR
Matthew Treinish93c10572015-07-31 10:38:50 -0400182 rm -f $TEMPEST_CONFIG
Attila Fazekas2aa35172012-12-05 20:03:40 +0100183
Attila Fazekas65c08462012-12-07 14:20:51 +0100184 password=${ADMIN_PASSWORD:-secrete}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100185
Dean Troyerdc97cb72015-03-28 08:20:50 -0500186 # See ``lib/keystone`` where these users and tenants are set up
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000187 ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
188 ADMIN_TENANT_NAME=${ADMIN_TENANT_NAME:-admin}
Andrea Frittoli03523252014-04-08 13:43:56 +0100189 ADMIN_DOMAIN_NAME=${ADMIN_DOMAIN_NAME:-Default}
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000190 TEMPEST_USERNAME=${TEMPEST_USERNAME:-demo}
191 TEMPEST_TENANT_NAME=${TEMPEST_TENANT_NAME:-demo}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100192 ALT_USERNAME=${ALT_USERNAME:-alt_demo}
193 ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
Harshada Mangesh Kakad49126232014-05-23 09:16:52 +0000194 ADMIN_TENANT_ID=$(openstack project list | awk "/ admin / { print \$2 }")
Attila Fazekas2aa35172012-12-05 20:03:40 +0100195
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200196 if is_service_enabled nova; then
Dean Troyerdc97cb72015-03-28 08:20:50 -0500197 # If ``DEFAULT_INSTANCE_TYPE`` is not declared, use the new behavior
198 # Tempest creates its own instance types
Rafael Folco0b4c83a2015-11-26 10:08:36 -0600199 available_flavors=$(nova flavor-list)
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200200 if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200201 if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
Rafael Folcof0131e12015-09-23 12:55:02 -0500202 nova flavor-create m1.nano 42 64 0 1
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200203 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200204 flavor_ref=42
205 boto_instance_type=m1.nano
206 if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
Rafael Folcof0131e12015-09-23 12:55:02 -0500207 nova flavor-create m1.micro 84 128 0 1
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200208 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200209 flavor_ref_alt=84
210 else
Dean Troyerdc97cb72015-03-28 08:20:50 -0500211 # Check Nova for existing flavors, if ``DEFAULT_INSTANCE_TYPE`` is set use it.
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200212 boto_instance_type=$DEFAULT_INSTANCE_TYPE
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200213 IFS=$'\r\n'
214 flavors=""
Rafael Folco0b4c83a2015-11-26 10:08:36 -0600215 for line in $available_flavors; do
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200216 f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
217 flavors="$flavors $f"
218 done
Attila Fazekas2aa35172012-12-05 20:03:40 +0100219
Rafael Folco0b4c83a2015-11-26 10:08:36 -0600220 for line in $available_flavors; do
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200221 flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
222 done
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100223
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200224 IFS=" "
225 flavors=($flavors)
226 num_flavors=${#flavors[*]}
227 echo "Found $num_flavors flavors"
228 if [[ $num_flavors -eq 0 ]]; then
229 echo "Found no valid flavors to use!"
230 exit 1
Adalberto Medeiros63a71a22013-06-06 08:46:04 -0400231 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200232 flavor_ref=${flavors[0]}
233 flavor_ref_alt=$flavor_ref
234
Dean Troyerdc97cb72015-03-28 08:20:50 -0500235 # Ensure ``flavor_ref`` and ``flavor_ref_alt`` have different values.
236 # Some resize instance in tempest tests depends on this.
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200237 for f in ${flavors[@]:1}; do
238 if [[ $f -ne $flavor_ref ]]; then
239 flavor_ref_alt=$f
240 break
241 fi
242 done
243 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100244 fi
245
Cedric Brandilyb814b532015-10-22 22:25:45 +0200246 if ! is_service_enabled n-net; then
247 ssh_connect_method="floating"
Maru Newbya5c774e2012-12-10 10:40:01 +0000248 fi
249
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200250 ssh_connect_method=${TEMPEST_SSH_CONNECT_METHOD:-$ssh_connect_method}
251
Tomoe Sugiharaafbc6312013-11-14 20:02:47 +0000252 if [ "$Q_L3_ENABLED" = "True" ]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400253 public_network_id=$(neutron net-list | grep $PUBLIC_NETWORK_NAME | \
Maru Newbya5c774e2012-12-10 10:40:01 +0000254 awk '{print $2}')
255 fi
256
Jamie Lennoxb17ad752015-05-29 06:04:47 +0000257 EC2_URL=$(get_endpoint_url ec2 public || true)
Andrey Pavlov40e652a2015-04-02 22:39:59 +0300258 if [[ -z $EC2_URL ]]; then
259 EC2_URL="$EC2_SERVICE_PROTOCOL://$SERVICE_HOST:8773/"
260 fi
Jamie Lennoxb17ad752015-05-29 06:04:47 +0000261 S3_URL=$(get_endpoint_url s3 public || true)
Andrey Pavlov40e652a2015-04-02 22:39:59 +0300262 if [[ -z $S3_URL ]]; then
263 S3_URL="http://$SERVICE_HOST:${S3_SERVICE_PORT:-3333}"
264 fi
265
Masayuki Igawa5a252d92014-11-21 21:55:09 +0900266 iniset $TEMPEST_CONFIG DEFAULT use_syslog $SYSLOG
Dean Troyerdc97cb72015-03-28 08:20:50 -0500267
Matthew Treinish859cc682013-07-26 15:22:44 -0400268 # Oslo
Joe Gordon23d6d502015-03-06 15:24:22 -0800269 iniset $TEMPEST_CONFIG oslo_concurrency lock_path $TEMPEST_STATE_PATH
Matthew Treinish14ccba02013-07-29 16:15:53 -0400270 mkdir -p $TEMPEST_STATE_PATH
john-griffithdc4dc7f2014-01-22 18:09:32 -0700271 iniset $TEMPEST_CONFIG DEFAULT use_stderr False
272 iniset $TEMPEST_CONFIG DEFAULT log_file tempest.log
273 iniset $TEMPEST_CONFIG DEFAULT debug True
Matthew Treinish859cc682013-07-26 15:22:44 -0400274
Attila Fazekas2aa35172012-12-05 20:03:40 +0100275 # Timeouts
john-griffithdc4dc7f2014-01-22 18:09:32 -0700276 iniset $TEMPEST_CONFIG compute build_timeout $BUILD_TIMEOUT
277 iniset $TEMPEST_CONFIG volume build_timeout $BUILD_TIMEOUT
278 iniset $TEMPEST_CONFIG boto build_timeout $BUILD_TIMEOUT
john-griffithdc4dc7f2014-01-22 18:09:32 -0700279 iniset $TEMPEST_CONFIG boto http_socket_timeout 5
Attila Fazekas2aa35172012-12-05 20:03:40 +0100280
Attila Fazekas97d3d202013-01-19 19:20:49 +0100281 # Identity
john-griffithdc4dc7f2014-01-22 18:09:32 -0700282 iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v2.0/"
Steve Martinellib74e01c2014-12-18 01:35:35 -0500283 iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_URI_V3"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000284 iniset $TEMPEST_CONFIG identity username $TEMPEST_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700285 iniset $TEMPEST_CONFIG identity password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000286 iniset $TEMPEST_CONFIG identity tenant_name $TEMPEST_TENANT_NAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700287 iniset $TEMPEST_CONFIG identity alt_username $ALT_USERNAME
288 iniset $TEMPEST_CONFIG identity alt_password "$password"
289 iniset $TEMPEST_CONFIG identity alt_tenant_name $ALT_TENANT_NAME
Matthew Treinish7ced1502015-03-23 15:51:54 -0400290 if [[ "$TEMPEST_HAS_ADMIN" == "True" ]]; then
291 iniset $TEMPEST_CONFIG identity admin_username $ADMIN_USERNAME
292 iniset $TEMPEST_CONFIG identity admin_password "$password"
293 iniset $TEMPEST_CONFIG identity admin_tenant_name $ADMIN_TENANT_NAME
294 iniset $TEMPEST_CONFIG identity admin_tenant_id $ADMIN_TENANT_ID
295 iniset $TEMPEST_CONFIG identity admin_domain_name $ADMIN_DOMAIN_NAME
296 fi
Samuel de Medeiros Queiroz3fd71d62015-05-03 14:54:45 -0300297 if [ "$ENABLE_IDENTITY_V2" == "False" ]; then
298 # Only Identity v3 is available; then skip Identity API v2 tests
Jamie Lennox75c1dfe2015-08-13 10:40:57 +1000299 iniset $TEMPEST_CONFIG identity-feature-enabled api_v2 False
Samuel de Medeiros Queiroz3fd71d62015-05-03 14:54:45 -0300300 # In addition, use v3 auth tokens for running all Tempest tests
301 iniset $TEMPEST_CONFIG identity auth_version v3
302 else
303 iniset $TEMPEST_CONFIG identity auth_version ${TEMPEST_AUTH_VERSION:-v2}
304 fi
305
Rob Crittendene1d013f2015-02-10 14:15:35 -0500306 if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then
307 iniset $TEMPEST_CONFIG identity ca_certificates_file $SSL_BUNDLE_FILE
308 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100309
Sean Daguec3771452013-06-13 14:23:37 -0400310 # Image
Dean Troyerdc97cb72015-03-28 08:20:50 -0500311 # We want to be able to override this variable in the gate to avoid
312 # doing an external HTTP fetch for this test.
Sean Daguec3771452013-06-13 14:23:37 -0400313 if [[ ! -z "$TEMPEST_HTTP_IMAGE" ]]; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700314 iniset $TEMPEST_CONFIG image http_image $TEMPEST_HTTP_IMAGE
Sean Daguec3771452013-06-13 14:23:37 -0400315 fi
316
David Kranzf100e1c2015-06-01 10:29:59 -0400317 # Image Features
318 iniset $TEMPEST_CONFIG image-feature-enabled deactivate_image True
319
Attila Fazekas97d3d202013-01-19 19:20:49 +0100320 # Compute
john-griffithdc4dc7f2014-01-22 18:09:32 -0700321 iniset $TEMPEST_CONFIG compute ssh_user ${DEFAULT_INSTANCE_USER:-cirros} # DEPRECATED
322 iniset $TEMPEST_CONFIG compute network_for_ssh $PRIVATE_NETWORK_NAME
323 iniset $TEMPEST_CONFIG compute ip_version_for_ssh 4
324 iniset $TEMPEST_CONFIG compute ssh_timeout $BUILD_TIMEOUT
325 iniset $TEMPEST_CONFIG compute image_ref $image_uuid
326 iniset $TEMPEST_CONFIG compute image_ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
327 iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid_alt
Kirill Shileev608f8842014-10-03 22:48:58 +0400328 iniset $TEMPEST_CONFIG compute image_alt_ssh_user ${ALT_INSTANCE_USER:-cirros}
john-griffithdc4dc7f2014-01-22 18:09:32 -0700329 iniset $TEMPEST_CONFIG compute flavor_ref $flavor_ref
330 iniset $TEMPEST_CONFIG compute flavor_ref_alt $flavor_ref_alt
john-griffithdc4dc7f2014-01-22 18:09:32 -0700331 iniset $TEMPEST_CONFIG compute ssh_connect_method $ssh_connect_method
Matthew Treinish4b684ae2015-05-15 12:38:09 -0400332 if [[ ! $(is_service_enabled n-cell) && ! $(is_service_enabled neutron) ]]; then
melanie wittf5b550e2015-04-10 22:20:07 +0000333 iniset $TEMPEST_CONFIG compute fixed_network_name $PRIVATE_NETWORK_NAME
334 fi
Attila Fazekas97d3d202013-01-19 19:20:49 +0100335
Sean Dague8349aff2015-09-01 12:45:28 -0400336 # Set the service catalog entry for Tempest to run on. Typically
337 # used to try different compute API version targets. The tempest
338 # default if 'compute', which is typically valid, so only set this
339 # if you want to change it.
340 if [[ -n "$TEMPEST_COMPUTE_TYPE" ]]; then
341 iniset $TEMPEST_CONFIG compute catalog_type $TEMPEST_COMPUTE_TYPE
342 fi
343
Sean Daguede19bf92014-03-20 16:54:58 -0400344 # Compute Features
Dean Troyerdc97cb72015-03-28 08:20:50 -0500345 # Run ``verify_tempest_config -ur`` to retrieve enabled extensions on API endpoints
Salvatore33e8ee22014-10-05 01:36:34 +0200346 # NOTE(mtreinish): This must be done after auth settings are added to the tempest config
Ian Wienandada886d2015-10-07 14:06:26 +1100347 local tmp_cfg_file
348 tmp_cfg_file=$(mktemp)
Joe Gordon1368b982015-02-04 15:28:18 -0800349 cd $TEMPEST_DIR
Pavlo Shchelokovskyy199c6042015-03-18 10:48:47 +0000350 tox -revenv -- verify-tempest-config -uro $tmp_cfg_file
Salvatore33e8ee22014-10-05 01:36:34 +0200351
352 local compute_api_extensions=${COMPUTE_API_EXTENSIONS:-"all"}
353 if [[ ! -z "$DISABLE_COMPUTE_API_EXTENSIONS" ]]; then
354 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
355 compute_api_extensions=${COMPUTE_API_EXTENSIONS:-$(iniget $tmp_cfg_file compute-feature-enabled api_extensions | tr -d " ")}
356 # Remove disabled extensions
357 compute_api_extensions=$(remove_disabled_extensions $compute_api_extensions $DISABLE_COMPUTE_API_EXTENSIONS)
358 fi
359
ghanshyam642b07b2015-11-19 10:01:14 +0900360 # Set the microversion range for compute tests.
361 # This is used to run the Nova microversions tests.
362 # Setting [None, latest] range of microversion which allow Tempest to run all microversions tests.
363 # NOTE- To avoid microversion tests failure on stable branch, we need to change "tempest_compute_max_microversion"
364 # for stable branch on each release which should be changed from "latest" to max supported version of that release.
365 local tempest_compute_min_microversion=${TEMPEST_COMPUTE_MIN_MICROVERSION:-None}
366 local tempest_compute_max_microversion=${TEMPEST_COMPUTE_MAX_MICROVERSION:-"latest"}
367 # Reset microversions to None where v2.0 is running which does not support microversion.
368 # Both "None" means no microversion testing.
369 if [[ "$TEMPEST_COMPUTE_TYPE" == "compute_legacy" ]]; then
370 tempest_compute_min_microversion=None
371 tempest_compute_max_microversion=None
372 fi
373 if [ "$tempest_compute_min_microversion" == "None" ]; then
374 inicomment $TEMPEST_CONFIG compute-feature-enabled min_microversion
375 else
376 iniset $TEMPEST_CONFIG compute-feature-enabled min_microversion $tempest_compute_min_microversion
377 fi
378 if [ "$tempest_compute_max_microversion" == "None" ]; then
379 inicomment $TEMPEST_CONFIG compute-feature-enabled max_microversion
380 else
381 iniset $TEMPEST_CONFIG compute-feature-enabled max_microversion $tempest_compute_max_microversion
382 fi
383
Sean Daguede19bf92014-03-20 16:54:58 -0400384 iniset $TEMPEST_CONFIG compute-feature-enabled resize True
Matthew Treinish270f93e2014-03-20 21:18:42 +0000385 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
386 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
387 iniset $TEMPEST_CONFIG compute-feature-enabled block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
Salvatore33e8ee22014-10-05 01:36:34 +0200388 iniset $TEMPEST_CONFIG compute-feature-enabled api_extensions $compute_api_extensions
Matt Riedemann58065f22015-03-14 06:13:26 -0700389 # TODO(mriedem): Remove the preserve_ports flag when Juno is end of life.
390 iniset $TEMPEST_CONFIG compute-feature-enabled preserve_ports True
Matthew Gilliard1b5a4982015-04-10 08:42:22 +0100391 # TODO(gilliard): Remove the live_migrate_paused_instances flag when Juno is end of life.
392 iniset $TEMPEST_CONFIG compute-feature-enabled live_migrate_paused_instances True
Matt Riedemanne57a3322015-06-20 14:48:00 -0700393 iniset $TEMPEST_CONFIG compute-feature-enabled attach_encrypted_volume ${ATTACH_ENCRYPTED_VOLUME_AVAILABLE:-True}
Matt Riedemann89ee5852015-07-09 13:25:04 -0700394 # TODO(mriedem): Remove this when kilo-eol happens since the
395 # neutron.allow_duplicate_networks option was removed from nova in Liberty
396 # and is now the default behavior.
397 iniset $TEMPEST_CONFIG compute-feature-enabled allow_duplicate_networks ${NOVA_ALLOW_DUPLICATE_NETWORKS:-True}
Chuck Carmack09b431d2015-09-02 14:27:58 +0000398 if is_service_enabled n-cell; then
399 # Cells doesn't support shelving/unshelving
400 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
Matt Riedemannc94403d2015-10-15 12:51:13 -0700401 # Cells doesn't support hot-plugging virtual interfaces.
402 iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False
Matt Riedemann6cd616a2015-11-06 10:26:14 -0800403
404 if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
405 # Cells supports resize but does not currently work with devstack
406 # because of the custom flavors created for Tempest runs which are
407 # not in the cells database.
408 # TODO(mriedem): work on adding a nova-manage command to sync
409 # flavors into the cells database.
410 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
411 fi
Chuck Carmack09b431d2015-09-02 14:27:58 +0000412 fi
Sean Daguede19bf92014-03-20 16:54:58 -0400413
Marian Horbanea21eb42015-08-18 06:57:18 -0400414 # Network
john-griffithdc4dc7f2014-01-22 18:09:32 -0700415 iniset $TEMPEST_CONFIG network api_version 2.0
Cedric Brandilyb814b532015-10-22 22:25:45 +0200416 iniset $TEMPEST_CONFIG network tenant_networks_reachable false
john-griffithdc4dc7f2014-01-22 18:09:32 -0700417 iniset $TEMPEST_CONFIG network public_network_id "$public_network_id"
418 iniset $TEMPEST_CONFIG network public_router_id "$public_router_id"
419 iniset $TEMPEST_CONFIG network default_network "$FIXED_RANGE"
Matthew Treinishccf60f72014-03-03 22:48:31 -0500420 iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED"
Sean M. Collinsbb2908b2014-05-15 10:24:31 -0400421 iniset $TEMPEST_CONFIG network-feature-enabled ipv6_subnet_attributes "$IPV6_SUBNET_ATTRIBUTES_ENABLED"
Salvatore33e8ee22014-10-05 01:36:34 +0200422
423 local network_api_extensions=${NETWORK_API_EXTENSIONS:-"all"}
424 if [[ ! -z "$DISABLE_NETWORK_API_EXTENSIONS" ]]; then
425 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
426 network_api_extensions=${NETWORK_API_EXTENSIONS:-$(iniget $tmp_cfg_file network-feature-enabled api_extensions | tr -d " ")}
427 # Remove disabled extensions
428 network_api_extensions=$(remove_disabled_extensions $network_api_extensions $DISABLE_NETWORK_API_EXTENSIONS)
429 fi
430 iniset $TEMPEST_CONFIG network-feature-enabled api_extensions $network_api_extensions
Attila Fazekas2aa35172012-12-05 20:03:40 +0100431
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200432 # boto
Andrey Pavlov40e652a2015-04-02 22:39:59 +0300433 iniset $TEMPEST_CONFIG boto ec2_url "$EC2_URL"
434 iniset $TEMPEST_CONFIG boto s3_url "$S3_URL"
john-griffithdc4dc7f2014-01-22 18:09:32 -0700435 iniset $TEMPEST_CONFIG boto s3_materials_path "$BOTO_MATERIALS_PATH"
Adalberto Medeiros53971532014-07-10 16:55:49 -0300436 iniset $TEMPEST_CONFIG boto ari_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initrd.manifest.xml
437 iniset $TEMPEST_CONFIG boto ami_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-blank.img.manifest.xml
438 iniset $TEMPEST_CONFIG boto aki_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-vmlinuz.manifest.xml
john-griffithdc4dc7f2014-01-22 18:09:32 -0700439 iniset $TEMPEST_CONFIG boto instance_type "$boto_instance_type"
440 iniset $TEMPEST_CONFIG boto http_socket_timeout 30
Attila Fazekas2aa35172012-12-05 20:03:40 +0100441
Sean Dague669c4fc2014-04-03 11:28:01 -0400442 # Orchestration Tests
443 if is_service_enabled heat; then
444 if [[ ! -z "$HEAT_CFN_IMAGE_URL" ]]; then
Alessandro Pilottif3e75bf2014-12-15 20:02:08 +0200445 iniset $TEMPEST_CONFIG orchestration image_ref $(basename "${HEAT_CFN_IMAGE_URL%.*}")
Sean Dague669c4fc2014-04-03 11:28:01 -0400446 fi
Attila Fazekas51557a52014-06-13 16:09:37 +0200447 # build a specialized heat flavor
Sean Dague669c4fc2014-04-03 11:28:01 -0400448 available_flavors=$(nova flavor-list)
449 if [[ ! ( $available_flavors =~ 'm1.heat' ) ]]; then
Attila Fazekas51557a52014-06-13 16:09:37 +0200450 nova flavor-create m1.heat 451 512 0 1
Sean Dague669c4fc2014-04-03 11:28:01 -0400451 fi
452 iniset $TEMPEST_CONFIG orchestration instance_type "m1.heat"
453 iniset $TEMPEST_CONFIG orchestration build_timeout 900
Matthew Treinish886cbb22015-03-18 22:03:01 -0400454 iniset $TEMPEST_CONFIG orchestration stack_owner_role "_member_"
Steve Bakerd5cccad2013-07-19 10:34:24 +1200455 fi
456
William Marshall24d866e2013-07-02 12:26:31 -0500457 # Scenario
Matthew Treinishd2cb2342015-04-02 11:08:24 -0400458 SCENARIO_IMAGE_DIR=${SCENARIO_IMAGE_DIR:-$FILES/images/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec}
459 iniset $TEMPEST_CONFIG scenario img_dir $SCENARIO_IMAGE_DIR
Adalberto Medeiros53971532014-07-10 16:55:49 -0300460 iniset $TEMPEST_CONFIG scenario ami_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-blank.img"
461 iniset $TEMPEST_CONFIG scenario ari_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initrd"
462 iniset $TEMPEST_CONFIG scenario aki_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-vmlinuz"
Matthew Treinishd2cb2342015-04-02 11:08:24 -0400463 iniset $TEMPEST_CONFIG scenario img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.img"
William Marshall24d866e2013-07-02 12:26:31 -0500464
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400465 # Large Ops Number
john-griffithdc4dc7f2014-01-22 18:09:32 -0700466 iniset $TEMPEST_CONFIG scenario large_ops_number ${TEMPEST_LARGE_OPS_NUMBER:-0}
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400467
Vadim Rovachev2541d612014-05-29 18:48:10 +0400468 # Telemetry
gordon chung71e4e6f2015-03-16 16:33:01 -0400469 iniset $TEMPEST_CONFIG telemetry-feature-enabled events "True"
Vadim Rovachev2541d612014-05-29 18:48:10 +0400470
Dean Troyerdc97cb72015-03-28 08:20:50 -0500471 # Object Store
Salvatore33e8ee22014-10-05 01:36:34 +0200472 local object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
473 if [[ ! -z "$DISABLE_OBJECT_STORAGE_API_EXTENSIONS" ]]; then
474 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
475 object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-$(iniget $tmp_cfg_file object-storage-feature-enabled discoverable_apis | tr -d " ")}
476 # Remove disabled extensions
477 object_storage_api_extensions=$(remove_disabled_extensions $object_storage_api_extensions $DISABLE_STORAGE_API_EXTENSIONS)
478 fi
479 iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis $object_storage_api_extensions
Salvatore Orlando3046bc62014-08-21 12:11:10 -0700480
lanoux994db612015-08-03 13:48:12 +0000481 # Validation
482 iniset $TEMPEST_CONFIG validation run_validation ${TEMPEST_RUN_VALIDATION:-False}
483
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200484 # Volume
David Kranzd1d66672015-06-11 13:09:37 -0400485 # TODO(dkranz): Remove the bootable flag when Juno is end of life.
486 iniset $TEMPEST_CONFIG volume-feature-enabled bootable True
Jordan Pittiere8c70e22015-08-13 18:10:00 +0200487 # TODO(jordanP): Remove the extend_with_snapshot flag when Juno is end of life.
488 iniset $TEMPEST_CONFIG volume-feature-enabled extend_with_snapshot True
obutenkoa366b972015-10-20 19:07:04 +0300489 # TODO(obutenko): Remove the incremental_backup_force flag when Kilo and Juno is end of life.
490 iniset $TEMPEST_CONFIG volume-feature-enabled incremental_backup_force True
David Kranzd1d66672015-06-11 13:09:37 -0400491
Salvatore33e8ee22014-10-05 01:36:34 +0200492 local volume_api_extensions=${VOLUME_API_EXTENSIONS:-"all"}
493 if [[ ! -z "$DISABLE_VOLUME_API_EXTENSIONS" ]]; then
494 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
495 volume_api_extensions=${VOLUME_API_EXTENSIONS:-$(iniget $tmp_cfg_file volume-feature-enabled api_extensions | tr -d " ")}
Marian Horbanea21eb42015-08-18 06:57:18 -0400496 # Remove disabled extensions
Salvatore33e8ee22014-10-05 01:36:34 +0200497 volume_api_extensions=$(remove_disabled_extensions $volume_api_extensions $DISABLE_VOLUME_API_EXTENSIONS)
498 fi
499 iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions $volume_api_extensions
500
Giulio Fidente3d60f4d2014-02-20 16:43:49 +0100501 if ! is_service_enabled c-bak; then
502 iniset $TEMPEST_CONFIG volume-feature-enabled backup False
Giulio Fidente3632ab12013-09-10 02:51:26 +0200503 fi
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000504
Dean Troyerdc97cb72015-03-28 08:20:50 -0500505 # Using ``CINDER_ENABLED_BACKENDS``
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000506 if [[ -n "$CINDER_ENABLED_BACKENDS" ]] && [[ $CINDER_ENABLED_BACKENDS =~ .*,.* ]]; then
Matthew Treinishdb1c3842014-02-04 20:58:00 +0000507 iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000508 local i=1
509 local be
510 for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
511 local be_name=${be##*:}
512 iniset $TEMPEST_CONFIG volume "backend${i}_name" "$be_name"
513 i=$(( i + 1 ))
514 done
john-griffithdc4dc7f2014-01-22 18:09:32 -0700515 fi
516
Eric Harney01456482014-10-14 18:53:53 -0400517 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
Patrick East1c0628f2014-10-22 16:22:47 -0700518 "$TEMPEST_VOLUME_VENDOR" != "$TEMPEST_DEFAULT_VOLUME_VENDOR" ]; then
Ed Balduf2f23d752014-07-29 14:42:27 -0600519 iniset $TEMPEST_CONFIG volume vendor_name "$TEMPEST_VOLUME_VENDOR"
Eric Harney01456482014-10-14 18:53:53 -0400520 fi
521 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
JordanP82a7d932014-12-04 14:09:16 +0100522 "$TEMPEST_STORAGE_PROTOCOL" != "$TEMPEST_DEFAULT_STORAGE_PROTOCOL" ]; then
523 iniset $TEMPEST_CONFIG volume storage_protocol "$TEMPEST_STORAGE_PROTOCOL"
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200524 fi
525
Julie Pichonfea70f82013-07-29 11:22:08 +0100526 # Dashboard
john-griffithdc4dc7f2014-01-22 18:09:32 -0700527 iniset $TEMPEST_CONFIG dashboard dashboard_url "http://$SERVICE_HOST/"
528 iniset $TEMPEST_CONFIG dashboard login_url "http://$SERVICE_HOST/auth/login/"
Julie Pichonfea70f82013-07-29 11:22:08 +0100529
Dean Troyerdc97cb72015-03-28 08:20:50 -0500530 # CLI
john-griffithdc4dc7f2014-01-22 18:09:32 -0700531 iniset $TEMPEST_CONFIG cli cli_dir $NOVA_BIN_DIR
Ian Wienand7fa19022013-06-25 14:11:48 +1000532
Adam Gandelman43bd6672014-04-03 11:13:13 -0700533 # Baremetal
534 if [ "$VIRT_DRIVER" = "ironic" ] ; then
535 iniset $TEMPEST_CONFIG baremetal driver_enabled True
Mike Turek00b5f4a2015-12-15 18:16:35 +0000536 iniset $TEMPEST_CONFIG baremetal deploy_timeout $BUILD_TIMEOUT
Vladyslav Drok41309002015-04-29 13:36:52 +0300537 iniset $TEMPEST_CONFIG baremetal deploy_img_dir $FILES
538 iniset $TEMPEST_CONFIG baremetal node_uuid $IRONIC_NODE_UUID
Adam Gandelmanfdfe7a02014-07-24 10:06:18 -0400539 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
540 iniset $TEMPEST_CONFIG compute-feature-enabled console_output False
541 iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False
542 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration False
543 iniset $TEMPEST_CONFIG compute-feature-enabled pause False
544 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
545 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
546 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
547 iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
David Shrewsburycf21b712014-08-13 07:03:58 -0400548 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
Adam Gandelman43bd6672014-04-03 11:13:13 -0700549 fi
550
Nels Nelson7b47c472015-01-05 16:36:42 -0600551 # Libvirt-LXC
552 if [ "$VIRT_DRIVER" = "libvirt" ] && [ "$LIBVIRT_TYPE" = "lxc" ]; then
553 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
554 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
Matt Riedemanncf94edc2015-10-28 09:50:01 -0700555 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
556 iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
Nels Nelson7b47c472015-01-05 16:36:42 -0600557 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
558 fi
559
Dean Troyerdc97cb72015-03-28 08:20:50 -0500560 # ``service_available``
Sean Dague346edcc2015-08-26 09:38:37 -0400561 #
562 # this tempest service list needs to be all the services that
563 # tempest supports, otherwise we can have an erroneous set of
564 # defaults (something defaulting true in Tempest, but not listed here).
Flavio Percoco624ab1e2015-04-30 08:54:15 +0200565 TEMPEST_SERVICES="key,glance,nova,neutron,cinder,swift,heat,ceilometer,horizon,sahara,ironic,trove"
Dean Troyer4237f592014-01-29 16:22:11 -0600566 for service in ${TEMPEST_SERVICES//,/ }; do
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400567 if is_service_enabled $service ; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700568 iniset $TEMPEST_CONFIG service_available $service "True"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400569 else
john-griffithdc4dc7f2014-01-22 18:09:32 -0700570 iniset $TEMPEST_CONFIG service_available $service "False"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400571 fi
572 done
573
Matt Riedemanncf94edc2015-10-28 09:50:01 -0700574 if [ "$VIRT_DRIVER" = "libvirt" ] && [ "$LIBVIRT_TYPE" = "lxc" ]; then
575 # libvirt-lxc does not support boot from volume or attaching volumes
576 # so basically anything with cinder is out of the question.
577 iniset $TEMPEST_CONFIG service_available cinder "False"
578 fi
579
Rob Crittendene1d013f2015-02-10 14:15:35 -0500580 if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then
Dean Troyerdc97cb72015-03-28 08:20:50 -0500581 # Use the ``BOTO_CONFIG`` environment variable to point to this file
Ian Wienand9c0b9f32015-07-22 06:08:09 +1000582 iniset -sudo $BOTO_CONF Boto ca_certificates_file $SSL_BUNDLE_FILE
Rob Crittenden90c20202014-11-17 01:16:22 -0500583 sudo chown $STACK_USER $BOTO_CONF
584 fi
585
Matthew Treinishdf8f43b2015-08-09 20:30:39 -0400586 # Auth
587 iniset $TEMPEST_CONFIG auth tempest_roles "Member"
588 if [[ $TEMPEST_USE_TEST_ACCOUNTS == "True" ]]; then
589 if [[ $TEMPEST_HAS_ADMIN == "True" ]]; then
590 tempest-account-generator -c $TEMPEST_CONFIG --os-username $ADMIN_USERNAME --os-password $ADMIN_PASSWORD --os-tenant-name $ADMIN_TENANT_NAME -r $TEMPEST_CONCURRENCY --with-admin etc/accounts.yaml
Matthew Treinishb274dbd2015-08-25 10:01:39 -0400591 else
Matthew Treinishdf8f43b2015-08-09 20:30:39 -0400592 tempest-account-generator -c $TEMPEST_CONFIG --os-username $ADMIN_USERNAME --os-password $ADMIN_PASSWORD --os-tenant-name $ADMIN_TENANT_NAME -r $TEMPEST_CONCURRENCY etc/accounts.yaml
593 fi
594 iniset $TEMPEST_CONFIG auth allow_tenant_isolation False
595 iniset $TEMPEST_CONFIG auth test_accounts_file "etc/accounts.yaml"
Matthew Treinishc148b132015-10-22 10:05:00 -0400596 elif [[ $TEMPEST_HAS_ADMIN == "False" ]]; then
597 iniset $TEMPEST_CONFIG auth allow_tenant_isolation ${TEMPEST_ALLOW_TENANT_ISOLATION:-False}
598
Matthew Treinishdf8f43b2015-08-09 20:30:39 -0400599 else
600 iniset $TEMPEST_CONFIG auth allow_tenant_isolation ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
601 fi
Matthew Treinishc148b132015-10-22 10:05:00 -0400602
Attila Fazekas2aa35172012-12-05 20:03:40 +0100603 # Restore IFS
604 IFS=$ifs
Sean Dagued0931212012-10-04 16:06:44 -0400605}
606
Dean Troyer42a59c22014-03-03 14:31:29 -0600607# create_tempest_accounts() - Set up common required tempest accounts
608
609# Project User Roles
610# ------------------------------------------------------------------
611# alt_demo alt_demo Member
612
Dean Troyer42a59c22014-03-03 14:31:29 -0600613function create_tempest_accounts {
614 if is_service_enabled tempest; then
615 # Tempest has some tests that validate various authorization checks
616 # between two regular users in separate tenants
Jamie Lennoxb632c9e2015-05-28 23:36:15 +0000617 get_or_create_project alt_demo default
Jamie Lennox9d7e7762015-05-29 01:08:53 +0000618 get_or_create_user alt_demo "$ADMIN_PASSWORD" "default" "alt_demo@example.com"
Jamie Lennox9b215db2015-02-10 18:19:57 +1100619 get_or_add_user_project_role Member alt_demo alt_demo
Dean Troyer42a59c22014-03-03 14:31:29 -0600620 fi
621}
622
Dean Troyerdc97cb72015-03-28 08:20:50 -0500623# install_tempest_lib() - Collect source, prepare, and install ``tempest-lib``
Matthew Treinish34723862014-09-08 14:01:21 -0400624function install_tempest_lib {
Sean Dague91b22902014-11-18 07:13:35 -0500625 if use_library_from_git "tempest-lib"; then
626 git_clone_by_name "tempest-lib"
Sean Dague86b65dd2014-11-20 17:23:04 -0500627 setup_dev_lib "tempest-lib"
Dean Troyerdc97cb72015-03-28 08:20:50 -0500628 # NOTE(mtreinish) For testing ``tempest-lib`` from git with Tempest we need to
629 # put the git version of ``tempest-lib`` in the Tempest job's tox venv
Matthew Treinish83e166b2015-02-18 19:01:20 -0500630 export PIP_VIRTUAL_ENV=${PROJECT_VENV["tempest"]}
631 setup_dev_lib "tempest-lib"
632 unset PIP_VIRTUAL_ENV
Sean Dague5cb19062014-11-01 01:37:45 +0100633 fi
Matthew Treinish34723862014-09-08 14:01:21 -0400634}
635
Sean Dagued0931212012-10-04 16:06:44 -0400636# install_tempest() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100637function install_tempest {
Sean Dagued0931212012-10-04 16:06:44 -0400638 git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
Clark Boylan33dc8692014-08-19 22:37:10 -0700639 pip_install tox
Matthew Treinish83e166b2015-02-18 19:01:20 -0500640 pushd $TEMPEST_DIR
641 tox --notest -efull
642 PROJECT_VENV["tempest"]=${TEMPEST_DIR}/.tox/full
643 install_tempest_lib
644 popd
Sean Dagued0931212012-10-04 16:06:44 -0400645}
646
Dean Troyerdc97cb72015-03-28 08:20:50 -0500647# init_tempest() - Initialize EC2 images
Ian Wienandaee18c72014-02-21 15:35:08 +1100648function init_tempest {
Adalberto Medeiros53971532014-07-10 16:55:49 -0300649 local base_image_name=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}
650 # /opt/stack/devstack/files/images/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec
Attila Fazekas3c529222013-01-21 06:50:33 +0100651 local image_dir="$FILES/images/${base_image_name}-uec"
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100652 local kernel="$image_dir/${base_image_name}-vmlinuz"
653 local ramdisk="$image_dir/${base_image_name}-initrd"
654 local disk_image="$image_dir/${base_image_name}-blank.img"
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200655 if is_service_enabled nova; then
Dean Troyerdc97cb72015-03-28 08:20:50 -0500656 # If the CirrOS uec downloaded and the system is UEC capable
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200657 if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a "$VIRT_DRIVER" != "openvz" \
658 -a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then
659 echo "Prepare aki/ari/ami Images"
660 mkdir -p $BOTO_MATERIALS_PATH
661 ( #new namespace
Andrey Pavlov7cc39072015-03-30 20:49:22 +0300662 # euca2ools should be installed to call euca-* commands
663 is_package_installed euca2ools || install_package euca2ools
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200664 # tenant:demo ; user: demo
665 source $TOP_DIR/accrc/demo/demo
666 euca-bundle-image -r ${CIRROS_ARCH} -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH"
667 euca-bundle-image -r ${CIRROS_ARCH} -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH"
668 euca-bundle-image -r ${CIRROS_ARCH} -i "$disk_image" -d "$BOTO_MATERIALS_PATH"
669 ) 2>&1 </dev/null | cat
670 else
671 echo "Boto materials are not prepared"
672 fi
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100673 fi
674}
675
Sean Dagued0931212012-10-04 16:06:44 -0400676# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +1100677$_XTRACE_TEMPEST
Sean Dague584d90e2013-03-29 14:34:53 -0400678
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100679# Tell emacs to use shell-script-mode
680## Local variables:
681## mode: shell-script
682## End: