blob: be24da6b61a638e31b9c5dbad24c6218599614da [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``
Matt Riedemann89ee5852015-07-09 13:25:04 -070033# - ``NOVA_ALLOW_DUPLICATE_NETWORKS``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010034#
Sean Dagued0931212012-10-04 16:06:44 -040035# ``stack.sh`` calls the entry points in this order:
36#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010037# - install_tempest
38# - configure_tempest
39# - init_tempest
Sean Dagued0931212012-10-04 16:06:44 -040040
41# Save trace setting
42XTRACE=$(set +o | grep xtrace)
43set +o xtrace
44
Dean Troyer6d04fd72012-12-21 11:03:37 -060045
Sean Dagued0931212012-10-04 16:06:44 -040046# Defaults
47# --------
48
Sean Dagued0931212012-10-04 16:06:44 -040049# Set up default directories
Sean Dague91b22902014-11-18 07:13:35 -050050GITDIR["tempest-lib"]=$DEST/tempest-lib
Sean Dague5cb19062014-11-01 01:37:45 +010051
Sean Dagued0931212012-10-04 16:06:44 -040052TEMPEST_DIR=$DEST/tempest
john-griffithdc4dc7f2014-01-22 18:09:32 -070053TEMPEST_CONFIG_DIR=${TEMPEST_CONFIG_DIR:-$TEMPEST_DIR/etc}
54TEMPEST_CONFIG=$TEMPEST_CONFIG_DIR/tempest.conf
Matthew Treinish14ccba02013-07-29 16:15:53 -040055TEMPEST_STATE_PATH=${TEMPEST_STATE_PATH:=$DATA_DIR/tempest}
Attila Fazekas2aa35172012-12-05 20:03:40 +010056
Dean Troyer6d04fd72012-12-21 11:03:37 -060057NOVA_SOURCE_DIR=$DEST/nova
58
Attila Fazekasbae02332013-05-09 09:24:49 +020059BUILD_INTERVAL=1
Arx Cruz1bde9b42014-07-18 11:34:33 -030060
61# This is the timeout that tempest will wait for a VM to change state,
62# spawn, delete, etc.
63# The default is set to 196 seconds.
64BUILD_TIMEOUT=${BUILD_TIMEOUT:-196}
Sean Dagued0931212012-10-04 16:06:44 -040065
Joe Gordonc9b245b2015-02-10 14:32:39 -080066# This must be False on stable branches, as master tempest
67# deps do not match stable branch deps. Set this to True to
Dean Troyerdc97cb72015-03-28 08:20:50 -050068# have tempest installed in DevStack by default.
Matthew Treinishcb3cece2015-03-16 10:37:51 -040069INSTALL_TEMPEST=${INSTALL_TEMPEST:-"True"}
Joe Gordonc9b245b2015-02-10 14:32:39 -080070
Attila Fazekas2d4c8da2014-03-19 10:42:01 +010071BOTO_MATERIALS_PATH="$FILES/images/s3-materials/cirros-${CIRROS_VERSION}"
Attila Fazekas58e694e2015-02-04 12:45:50 +010072BOTO_CONF=/etc/boto.cfg
Attila Fazekas1d29d8b2013-01-07 15:51:32 +010073
john-griffithdc4dc7f2014-01-22 18:09:32 -070074# Cinder/Volume variables
75TEMPEST_VOLUME_DRIVER=${TEMPEST_VOLUME_DRIVER:-default}
Eric Harney01456482014-10-14 18:53:53 -040076TEMPEST_DEFAULT_VOLUME_VENDOR="Open Source"
77TEMPEST_VOLUME_VENDOR=${TEMPEST_VOLUME_VENDOR:-$TEMPEST_DEFAULT_VOLUME_VENDOR}
78TEMPEST_DEFAULT_STORAGE_PROTOCOL="iSCSI"
79TEMPEST_STORAGE_PROTOCOL=${TEMPEST_STORAGE_PROTOCOL:-$TEMPEST_DEFAULT_STORAGE_PROTOCOL}
Dean Troyercc6b4432013-04-08 15:38:03 -050080
armando-migliaccio71ef61a2014-02-19 22:19:24 -080081# Neutron/Network variables
Sean Dague53753292014-12-04 19:38:15 -050082IPV6_ENABLED=$(trueorfalse True IPV6_ENABLED)
83IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True IPV6_SUBNET_ATTRIBUTES_ENABLED)
armando-migliaccio71ef61a2014-02-19 22:19:24 -080084
Matthew Treinishdf8f43b2015-08-09 20:30:39 -040085# Do we want to make a configuration where Tempest has admin on
86# the cloud. We don't always want to so that we can ensure Tempest
87# would work on a public cloud.
88TEMPEST_HAS_ADMIN=$(trueorfalse True TEMPEST_HAS_ADMIN)
89
90# Credential provider configuration option variables
91TEMPEST_ALLOW_TENANT_ISOLATION=${TEMPEST_ALLOW_TENANT_ISOLATION:-$TEMPEST_HAS_ADMIN}
Matthew Treinish403fbb12015-08-24 21:17:37 -040092TEMPEST_USE_TEST_ACCOUNTS=$(trueorfalse False TEMPEST_USE_TEST_ACCOUNTS)
Matthew Treinishdf8f43b2015-08-09 20:30:39 -040093
94# The number of workers tempest is expected to be run with. This is used for
95# generating a accounts.yaml for running with test-accounts. This is also the
96# same variable that devstack-gate uses to specify the number of workers that
97# it will run tempest with
98TEMPEST_CONCURRENCY=${TEMPEST_CONCURRENCY:-$(nproc)}
99
Dean Troyerdc97cb72015-03-28 08:20:50 -0500100
Dean Troyercc6b4432013-04-08 15:38:03 -0500101# Functions
102# ---------
Sean Dagued0931212012-10-04 16:06:44 -0400103
Salvatore33e8ee22014-10-05 01:36:34 +0200104# remove_disabled_extension - removes disabled extensions from the list of extensions
105# to test for a given service
106function remove_disabled_extensions {
107 local extensions_list=$1
108 shift
109 local disabled_exts=$*
fumihiko kakuma8606c982015-04-13 09:55:06 +0900110 remove_disabled_services "$extensions_list" "$disabled_exts"
Salvatore33e8ee22014-10-05 01:36:34 +0200111}
112
Sean Dagued0931212012-10-04 16:06:44 -0400113# configure_tempest() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +1100114function configure_tempest {
Joe Gordonc9b245b2015-02-10 14:32:39 -0800115 if [[ "$INSTALL_TEMPEST" == "True" ]]; then
116 setup_develop $TEMPEST_DIR
117 else
118 # install testr since its used to process tempest logs
Sean Dague60996b12015-04-08 09:06:49 -0400119 pip_install_gr testrepository
Joe Gordonc9b245b2015-02-10 14:32:39 -0800120 fi
Joe Gordond5ac7852015-02-06 19:29:23 -0800121
Joe Gordon1fa82aa2015-05-12 20:04:49 -0700122 # Used during configuration so make sure we have the correct
123 # version installed
124 pip_install_gr python-openstackclient
125
Attila Fazekas65c08462012-12-07 14:20:51 +0100126 local image_lines
127 local images
128 local num_images
129 local image_uuid
130 local image_uuid_alt
Attila Fazekas65c08462012-12-07 14:20:51 +0100131 local password
132 local line
133 local flavors
Clark Boylan3b80bde2013-11-20 17:51:50 -0800134 local available_flavors
Attila Fazekas65c08462012-12-07 14:20:51 +0100135 local flavors_ref
136 local flavor_lines
Maru Newbya5c774e2012-12-10 10:40:01 +0000137 local public_network_id
Maru Newby31c94ab2012-12-19 03:59:20 +0000138 local public_router_id
Maru Newbya5c774e2012-12-10 10:40:01 +0000139 local tenant_networks_reachable
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100140 local boto_instance_type="m1.tiny"
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200141 local ssh_connect_method="fixed"
Attila Fazekas2aa35172012-12-05 20:03:40 +0100142
Dean Troyer6d04fd72012-12-21 11:03:37 -0600143 # Save IFS
Attila Fazekas2aa35172012-12-05 20:03:40 +0100144 ifs=$IFS
145
146 # Glance should already contain images to be used in tempest
147 # testing. Here we simply look for images stored in Glance
148 # and set the appropriate variables for use in the tempest config
149 # We ignore ramdisk and kernel images, look for the default image
Attila Fazekas65c08462012-12-07 14:20:51 +0100150 # ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the
151 # first image returned and set ``image_uuid_alt`` to the second,
Attila Fazekas2aa35172012-12-05 20:03:40 +0100152 # if there is more than one returned...
153 # ... Also ensure we only take active images, so we don't get snapshots in process
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500154 declare -a images
155
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200156 if is_service_enabled glance; then
157 while read -r IMAGE_NAME IMAGE_UUID; do
158 if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
159 image_uuid="$IMAGE_UUID"
160 image_uuid_alt="$IMAGE_UUID"
161 fi
162 images+=($IMAGE_UUID)
Swapnil Kulkarnia747cd22015-05-13 09:26:15 +0000163 done < <(openstack image list --property status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500164
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200165 case "${#images[*]}" in
166 0)
167 echo "Found no valid images to use!"
168 exit 1
169 ;;
170 1)
171 if [ -z "$image_uuid" ]; then
172 image_uuid=${images[0]}
173 image_uuid_alt=${images[0]}
174 fi
175 ;;
176 *)
177 if [ -z "$image_uuid" ]; then
178 image_uuid=${images[0]}
179 image_uuid_alt=${images[1]}
180 fi
181 ;;
182 esac
183 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100184
Matthew Treinish93c10572015-07-31 10:38:50 -0400185 # (Re)create ``tempest.conf``
186 # Create every time because the image UUIDS are going to change
Dean Troyer8421c2b2015-03-16 13:52:19 -0500187 sudo install -d -o $STACK_USER $TEMPEST_CONFIG_DIR
Matthew Treinish93c10572015-07-31 10:38:50 -0400188 rm -f $TEMPEST_CONFIG
Attila Fazekas2aa35172012-12-05 20:03:40 +0100189
Attila Fazekas65c08462012-12-07 14:20:51 +0100190 password=${ADMIN_PASSWORD:-secrete}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100191
Dean Troyerdc97cb72015-03-28 08:20:50 -0500192 # See ``lib/keystone`` where these users and tenants are set up
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000193 ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
194 ADMIN_TENANT_NAME=${ADMIN_TENANT_NAME:-admin}
Andrea Frittoli03523252014-04-08 13:43:56 +0100195 ADMIN_DOMAIN_NAME=${ADMIN_DOMAIN_NAME:-Default}
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000196 TEMPEST_USERNAME=${TEMPEST_USERNAME:-demo}
197 TEMPEST_TENANT_NAME=${TEMPEST_TENANT_NAME:-demo}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100198 ALT_USERNAME=${ALT_USERNAME:-alt_demo}
199 ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
Harshada Mangesh Kakad49126232014-05-23 09:16:52 +0000200 ADMIN_TENANT_ID=$(openstack project list | awk "/ admin / { print \$2 }")
Attila Fazekas2aa35172012-12-05 20:03:40 +0100201
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200202 if is_service_enabled nova; then
Dean Troyerdc97cb72015-03-28 08:20:50 -0500203 # If ``DEFAULT_INSTANCE_TYPE`` is not declared, use the new behavior
204 # Tempest creates its own instance types
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200205 if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
206 available_flavors=$(nova flavor-list)
207 if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
208 if is_arch "ppc64"; then
Dean Troyerdc97cb72015-03-28 08:20:50 -0500209 # Qemu needs at least 128MB of memory to boot on ppc64
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200210 nova flavor-create m1.nano 42 128 0 1
211 else
212 nova flavor-create m1.nano 42 64 0 1
213 fi
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200214 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200215 flavor_ref=42
216 boto_instance_type=m1.nano
217 if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
218 if is_arch "ppc64"; then
219 nova flavor-create m1.micro 84 256 0 1
220 else
221 nova flavor-create m1.micro 84 128 0 1
222 fi
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200223 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200224 flavor_ref_alt=84
225 else
Dean Troyerdc97cb72015-03-28 08:20:50 -0500226 # Check Nova for existing flavors, if ``DEFAULT_INSTANCE_TYPE`` is set use it.
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200227 boto_instance_type=$DEFAULT_INSTANCE_TYPE
228 flavor_lines=`nova flavor-list`
229 IFS=$'\r\n'
230 flavors=""
231 for line in $flavor_lines; do
232 f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
233 flavors="$flavors $f"
234 done
Attila Fazekas2aa35172012-12-05 20:03:40 +0100235
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200236 for line in $flavor_lines; do
237 flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
238 done
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100239
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200240 IFS=" "
241 flavors=($flavors)
242 num_flavors=${#flavors[*]}
243 echo "Found $num_flavors flavors"
244 if [[ $num_flavors -eq 0 ]]; then
245 echo "Found no valid flavors to use!"
246 exit 1
Adalberto Medeiros63a71a22013-06-06 08:46:04 -0400247 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200248 flavor_ref=${flavors[0]}
249 flavor_ref_alt=$flavor_ref
250
Dean Troyerdc97cb72015-03-28 08:20:50 -0500251 # Ensure ``flavor_ref`` and ``flavor_ref_alt`` have different values.
252 # Some resize instance in tempest tests depends on this.
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200253 for f in ${flavors[@]:1}; do
254 if [[ $f -ne $flavor_ref ]]; then
255 flavor_ref_alt=$f
256 break
257 fi
258 done
259 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100260 fi
261
Maru Newbya5c774e2012-12-10 10:40:01 +0000262 if [ "$Q_USE_NAMESPACE" != "False" ]; then
263 tenant_networks_reachable=false
Attila Fazekasf9e77392013-12-03 06:17:16 +0100264 if ! is_service_enabled n-net; then
265 ssh_connect_method="floating"
266 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000267 else
268 tenant_networks_reachable=true
269 fi
270
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200271 ssh_connect_method=${TEMPEST_SSH_CONNECT_METHOD:-$ssh_connect_method}
272
Tomoe Sugiharaafbc6312013-11-14 20:02:47 +0000273 if [ "$Q_L3_ENABLED" = "True" ]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400274 public_network_id=$(neutron net-list | grep $PUBLIC_NETWORK_NAME | \
Maru Newbya5c774e2012-12-10 10:40:01 +0000275 awk '{print $2}')
Maru Newby31c94ab2012-12-19 03:59:20 +0000276 if [ "$Q_USE_NAMESPACE" == "False" ]; then
Dean Troyerdc97cb72015-03-28 08:20:50 -0500277 # If namespaces are disabled, DevStack will create a single
Maru Newby31c94ab2012-12-19 03:59:20 +0000278 # public router that tempest should be configured to use.
Mark McClainb05c8762013-07-06 23:29:39 -0400279 public_router_id=$(neutron router-list | awk "/ $Q_ROUTER_NAME / \
Sean Dague101b4242013-10-22 08:47:11 -0400280 { print \$2 }")
Maru Newby31c94ab2012-12-19 03:59:20 +0000281 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000282 fi
283
Jamie Lennoxb17ad752015-05-29 06:04:47 +0000284 EC2_URL=$(get_endpoint_url ec2 public || true)
Andrey Pavlov40e652a2015-04-02 22:39:59 +0300285 if [[ -z $EC2_URL ]]; then
286 EC2_URL="$EC2_SERVICE_PROTOCOL://$SERVICE_HOST:8773/"
287 fi
Jamie Lennoxb17ad752015-05-29 06:04:47 +0000288 S3_URL=$(get_endpoint_url s3 public || true)
Andrey Pavlov40e652a2015-04-02 22:39:59 +0300289 if [[ -z $S3_URL ]]; then
290 S3_URL="http://$SERVICE_HOST:${S3_SERVICE_PORT:-3333}"
291 fi
292
Masayuki Igawa5a252d92014-11-21 21:55:09 +0900293 iniset $TEMPEST_CONFIG DEFAULT use_syslog $SYSLOG
Dean Troyerdc97cb72015-03-28 08:20:50 -0500294
Matthew Treinish859cc682013-07-26 15:22:44 -0400295 # Oslo
Joe Gordon23d6d502015-03-06 15:24:22 -0800296 iniset $TEMPEST_CONFIG oslo_concurrency lock_path $TEMPEST_STATE_PATH
Matthew Treinish14ccba02013-07-29 16:15:53 -0400297 mkdir -p $TEMPEST_STATE_PATH
john-griffithdc4dc7f2014-01-22 18:09:32 -0700298 iniset $TEMPEST_CONFIG DEFAULT use_stderr False
299 iniset $TEMPEST_CONFIG DEFAULT log_file tempest.log
300 iniset $TEMPEST_CONFIG DEFAULT debug True
Matthew Treinish859cc682013-07-26 15:22:44 -0400301
Attila Fazekas2aa35172012-12-05 20:03:40 +0100302 # Timeouts
john-griffithdc4dc7f2014-01-22 18:09:32 -0700303 iniset $TEMPEST_CONFIG compute build_timeout $BUILD_TIMEOUT
304 iniset $TEMPEST_CONFIG volume build_timeout $BUILD_TIMEOUT
305 iniset $TEMPEST_CONFIG boto build_timeout $BUILD_TIMEOUT
john-griffithdc4dc7f2014-01-22 18:09:32 -0700306 iniset $TEMPEST_CONFIG boto http_socket_timeout 5
Attila Fazekas2aa35172012-12-05 20:03:40 +0100307
Attila Fazekas97d3d202013-01-19 19:20:49 +0100308 # Identity
john-griffithdc4dc7f2014-01-22 18:09:32 -0700309 iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v2.0/"
Steve Martinellib74e01c2014-12-18 01:35:35 -0500310 iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_URI_V3"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000311 iniset $TEMPEST_CONFIG identity username $TEMPEST_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700312 iniset $TEMPEST_CONFIG identity password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000313 iniset $TEMPEST_CONFIG identity tenant_name $TEMPEST_TENANT_NAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700314 iniset $TEMPEST_CONFIG identity alt_username $ALT_USERNAME
315 iniset $TEMPEST_CONFIG identity alt_password "$password"
316 iniset $TEMPEST_CONFIG identity alt_tenant_name $ALT_TENANT_NAME
Matthew Treinish7ced1502015-03-23 15:51:54 -0400317 if [[ "$TEMPEST_HAS_ADMIN" == "True" ]]; then
318 iniset $TEMPEST_CONFIG identity admin_username $ADMIN_USERNAME
319 iniset $TEMPEST_CONFIG identity admin_password "$password"
320 iniset $TEMPEST_CONFIG identity admin_tenant_name $ADMIN_TENANT_NAME
321 iniset $TEMPEST_CONFIG identity admin_tenant_id $ADMIN_TENANT_ID
322 iniset $TEMPEST_CONFIG identity admin_domain_name $ADMIN_DOMAIN_NAME
323 fi
Samuel de Medeiros Queiroz3fd71d62015-05-03 14:54:45 -0300324 if [ "$ENABLE_IDENTITY_V2" == "False" ]; then
325 # Only Identity v3 is available; then skip Identity API v2 tests
Jamie Lennox75c1dfe2015-08-13 10:40:57 +1000326 iniset $TEMPEST_CONFIG identity-feature-enabled api_v2 False
Samuel de Medeiros Queiroz3fd71d62015-05-03 14:54:45 -0300327 # In addition, use v3 auth tokens for running all Tempest tests
328 iniset $TEMPEST_CONFIG identity auth_version v3
329 else
330 iniset $TEMPEST_CONFIG identity auth_version ${TEMPEST_AUTH_VERSION:-v2}
331 fi
332
Rob Crittendene1d013f2015-02-10 14:15:35 -0500333 if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then
334 iniset $TEMPEST_CONFIG identity ca_certificates_file $SSL_BUNDLE_FILE
335 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100336
Sean Daguec3771452013-06-13 14:23:37 -0400337 # Image
Dean Troyerdc97cb72015-03-28 08:20:50 -0500338 # We want to be able to override this variable in the gate to avoid
339 # doing an external HTTP fetch for this test.
Sean Daguec3771452013-06-13 14:23:37 -0400340 if [[ ! -z "$TEMPEST_HTTP_IMAGE" ]]; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700341 iniset $TEMPEST_CONFIG image http_image $TEMPEST_HTTP_IMAGE
Sean Daguec3771452013-06-13 14:23:37 -0400342 fi
afazekas50a3edf2015-05-27 11:50:12 +0200343 iniset $TEMPEST_CONFIG image-feature-enabled deactivate_image true
Sean Daguec3771452013-06-13 14:23:37 -0400344
David Kranzf100e1c2015-06-01 10:29:59 -0400345 # Image Features
346 iniset $TEMPEST_CONFIG image-feature-enabled deactivate_image True
347
Attila Fazekas97d3d202013-01-19 19:20:49 +0100348 # Compute
john-griffithdc4dc7f2014-01-22 18:09:32 -0700349 iniset $TEMPEST_CONFIG compute ssh_user ${DEFAULT_INSTANCE_USER:-cirros} # DEPRECATED
350 iniset $TEMPEST_CONFIG compute network_for_ssh $PRIVATE_NETWORK_NAME
351 iniset $TEMPEST_CONFIG compute ip_version_for_ssh 4
352 iniset $TEMPEST_CONFIG compute ssh_timeout $BUILD_TIMEOUT
353 iniset $TEMPEST_CONFIG compute image_ref $image_uuid
354 iniset $TEMPEST_CONFIG compute image_ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
355 iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid_alt
Kirill Shileev608f8842014-10-03 22:48:58 +0400356 iniset $TEMPEST_CONFIG compute image_alt_ssh_user ${ALT_INSTANCE_USER:-cirros}
john-griffithdc4dc7f2014-01-22 18:09:32 -0700357 iniset $TEMPEST_CONFIG compute flavor_ref $flavor_ref
358 iniset $TEMPEST_CONFIG compute flavor_ref_alt $flavor_ref_alt
john-griffithdc4dc7f2014-01-22 18:09:32 -0700359 iniset $TEMPEST_CONFIG compute ssh_connect_method $ssh_connect_method
Matthew Treinish4b684ae2015-05-15 12:38:09 -0400360 if [[ ! $(is_service_enabled n-cell) && ! $(is_service_enabled neutron) ]]; then
melanie wittf5b550e2015-04-10 22:20:07 +0000361 iniset $TEMPEST_CONFIG compute fixed_network_name $PRIVATE_NETWORK_NAME
362 fi
Attila Fazekas97d3d202013-01-19 19:20:49 +0100363
Sean Daguede19bf92014-03-20 16:54:58 -0400364 # Compute Features
Dean Troyerdc97cb72015-03-28 08:20:50 -0500365 # Run ``verify_tempest_config -ur`` to retrieve enabled extensions on API endpoints
Salvatore33e8ee22014-10-05 01:36:34 +0200366 # NOTE(mtreinish): This must be done after auth settings are added to the tempest config
367 local tmp_cfg_file=$(mktemp)
Joe Gordon1368b982015-02-04 15:28:18 -0800368 cd $TEMPEST_DIR
Pavlo Shchelokovskyy199c6042015-03-18 10:48:47 +0000369 tox -revenv -- verify-tempest-config -uro $tmp_cfg_file
Salvatore33e8ee22014-10-05 01:36:34 +0200370
371 local compute_api_extensions=${COMPUTE_API_EXTENSIONS:-"all"}
372 if [[ ! -z "$DISABLE_COMPUTE_API_EXTENSIONS" ]]; then
373 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
374 compute_api_extensions=${COMPUTE_API_EXTENSIONS:-$(iniget $tmp_cfg_file compute-feature-enabled api_extensions | tr -d " ")}
375 # Remove disabled extensions
376 compute_api_extensions=$(remove_disabled_extensions $compute_api_extensions $DISABLE_COMPUTE_API_EXTENSIONS)
377 fi
378
Sean Daguede19bf92014-03-20 16:54:58 -0400379 iniset $TEMPEST_CONFIG compute-feature-enabled resize True
Matthew Treinish270f93e2014-03-20 21:18:42 +0000380 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
381 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
382 iniset $TEMPEST_CONFIG compute-feature-enabled block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
Salvatore33e8ee22014-10-05 01:36:34 +0200383 iniset $TEMPEST_CONFIG compute-feature-enabled api_extensions $compute_api_extensions
Matt Riedemann58065f22015-03-14 06:13:26 -0700384 # TODO(mriedem): Remove the preserve_ports flag when Juno is end of life.
385 iniset $TEMPEST_CONFIG compute-feature-enabled preserve_ports True
Matthew Gilliard1b5a4982015-04-10 08:42:22 +0100386 # TODO(gilliard): Remove the live_migrate_paused_instances flag when Juno is end of life.
387 iniset $TEMPEST_CONFIG compute-feature-enabled live_migrate_paused_instances True
Matt Riedemanne57a3322015-06-20 14:48:00 -0700388 iniset $TEMPEST_CONFIG compute-feature-enabled attach_encrypted_volume ${ATTACH_ENCRYPTED_VOLUME_AVAILABLE:-True}
Matt Riedemann89ee5852015-07-09 13:25:04 -0700389 # TODO(mriedem): Remove this when kilo-eol happens since the
390 # neutron.allow_duplicate_networks option was removed from nova in Liberty
391 # and is now the default behavior.
392 iniset $TEMPEST_CONFIG compute-feature-enabled allow_duplicate_networks ${NOVA_ALLOW_DUPLICATE_NETWORKS:-True}
Sean Daguede19bf92014-03-20 16:54:58 -0400393
Marian Horbanea21eb42015-08-18 06:57:18 -0400394 # Network
john-griffithdc4dc7f2014-01-22 18:09:32 -0700395 iniset $TEMPEST_CONFIG network api_version 2.0
396 iniset $TEMPEST_CONFIG network tenant_networks_reachable "$tenant_networks_reachable"
397 iniset $TEMPEST_CONFIG network public_network_id "$public_network_id"
398 iniset $TEMPEST_CONFIG network public_router_id "$public_router_id"
399 iniset $TEMPEST_CONFIG network default_network "$FIXED_RANGE"
Matthew Treinishccf60f72014-03-03 22:48:31 -0500400 iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED"
Sean M. Collinsbb2908b2014-05-15 10:24:31 -0400401 iniset $TEMPEST_CONFIG network-feature-enabled ipv6_subnet_attributes "$IPV6_SUBNET_ATTRIBUTES_ENABLED"
Salvatore33e8ee22014-10-05 01:36:34 +0200402
403 local network_api_extensions=${NETWORK_API_EXTENSIONS:-"all"}
404 if [[ ! -z "$DISABLE_NETWORK_API_EXTENSIONS" ]]; then
405 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
406 network_api_extensions=${NETWORK_API_EXTENSIONS:-$(iniget $tmp_cfg_file network-feature-enabled api_extensions | tr -d " ")}
407 # Remove disabled extensions
408 network_api_extensions=$(remove_disabled_extensions $network_api_extensions $DISABLE_NETWORK_API_EXTENSIONS)
409 fi
410 iniset $TEMPEST_CONFIG network-feature-enabled api_extensions $network_api_extensions
Attila Fazekas2aa35172012-12-05 20:03:40 +0100411
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200412 # boto
Andrey Pavlov40e652a2015-04-02 22:39:59 +0300413 iniset $TEMPEST_CONFIG boto ec2_url "$EC2_URL"
414 iniset $TEMPEST_CONFIG boto s3_url "$S3_URL"
john-griffithdc4dc7f2014-01-22 18:09:32 -0700415 iniset $TEMPEST_CONFIG boto s3_materials_path "$BOTO_MATERIALS_PATH"
Adalberto Medeiros53971532014-07-10 16:55:49 -0300416 iniset $TEMPEST_CONFIG boto ari_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initrd.manifest.xml
417 iniset $TEMPEST_CONFIG boto ami_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-blank.img.manifest.xml
418 iniset $TEMPEST_CONFIG boto aki_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-vmlinuz.manifest.xml
john-griffithdc4dc7f2014-01-22 18:09:32 -0700419 iniset $TEMPEST_CONFIG boto instance_type "$boto_instance_type"
420 iniset $TEMPEST_CONFIG boto http_socket_timeout 30
421 iniset $TEMPEST_CONFIG boto ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100422
Sean Dague669c4fc2014-04-03 11:28:01 -0400423 # Orchestration Tests
424 if is_service_enabled heat; then
425 if [[ ! -z "$HEAT_CFN_IMAGE_URL" ]]; then
Alessandro Pilottif3e75bf2014-12-15 20:02:08 +0200426 iniset $TEMPEST_CONFIG orchestration image_ref $(basename "${HEAT_CFN_IMAGE_URL%.*}")
Sean Dague669c4fc2014-04-03 11:28:01 -0400427 fi
Attila Fazekas51557a52014-06-13 16:09:37 +0200428 # build a specialized heat flavor
Sean Dague669c4fc2014-04-03 11:28:01 -0400429 available_flavors=$(nova flavor-list)
430 if [[ ! ( $available_flavors =~ 'm1.heat' ) ]]; then
Attila Fazekas51557a52014-06-13 16:09:37 +0200431 nova flavor-create m1.heat 451 512 0 1
Sean Dague669c4fc2014-04-03 11:28:01 -0400432 fi
433 iniset $TEMPEST_CONFIG orchestration instance_type "m1.heat"
434 iniset $TEMPEST_CONFIG orchestration build_timeout 900
Matthew Treinish886cbb22015-03-18 22:03:01 -0400435 iniset $TEMPEST_CONFIG orchestration stack_owner_role "_member_"
Steve Bakerd5cccad2013-07-19 10:34:24 +1200436 fi
437
William Marshall24d866e2013-07-02 12:26:31 -0500438 # Scenario
Matthew Treinishd2cb2342015-04-02 11:08:24 -0400439 SCENARIO_IMAGE_DIR=${SCENARIO_IMAGE_DIR:-$FILES/images/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec}
440 iniset $TEMPEST_CONFIG scenario img_dir $SCENARIO_IMAGE_DIR
Adalberto Medeiros53971532014-07-10 16:55:49 -0300441 iniset $TEMPEST_CONFIG scenario ami_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-blank.img"
442 iniset $TEMPEST_CONFIG scenario ari_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initrd"
443 iniset $TEMPEST_CONFIG scenario aki_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-vmlinuz"
Matthew Treinishd2cb2342015-04-02 11:08:24 -0400444 iniset $TEMPEST_CONFIG scenario img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.img"
William Marshall24d866e2013-07-02 12:26:31 -0500445
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400446 # Large Ops Number
john-griffithdc4dc7f2014-01-22 18:09:32 -0700447 iniset $TEMPEST_CONFIG scenario large_ops_number ${TEMPEST_LARGE_OPS_NUMBER:-0}
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400448
Vadim Rovachev2541d612014-05-29 18:48:10 +0400449 # Telemetry
Dean Troyerdc97cb72015-03-28 08:20:50 -0500450 # Ceilometer API optimization happened in Juno that allows to run more tests in tempest.
Vadim Rovachev2541d612014-05-29 18:48:10 +0400451 # Once Tempest retires support for icehouse this flag can be removed.
452 iniset $TEMPEST_CONFIG telemetry too_slow_to_test "False"
gordon chung71e4e6f2015-03-16 16:33:01 -0400453 iniset $TEMPEST_CONFIG telemetry-feature-enabled events "True"
Vadim Rovachev2541d612014-05-29 18:48:10 +0400454
Dean Troyerdc97cb72015-03-28 08:20:50 -0500455 # Object Store
Salvatore33e8ee22014-10-05 01:36:34 +0200456 local object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
457 if [[ ! -z "$DISABLE_OBJECT_STORAGE_API_EXTENSIONS" ]]; then
458 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
459 object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-$(iniget $tmp_cfg_file object-storage-feature-enabled discoverable_apis | tr -d " ")}
460 # Remove disabled extensions
461 object_storage_api_extensions=$(remove_disabled_extensions $object_storage_api_extensions $DISABLE_STORAGE_API_EXTENSIONS)
462 fi
463 iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis $object_storage_api_extensions
Salvatore Orlando3046bc62014-08-21 12:11:10 -0700464
lanoux994db612015-08-03 13:48:12 +0000465 # Validation
466 iniset $TEMPEST_CONFIG validation run_validation ${TEMPEST_RUN_VALIDATION:-False}
467
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200468 # Volume
David Kranzd1d66672015-06-11 13:09:37 -0400469 # TODO(dkranz): Remove the bootable flag when Juno is end of life.
470 iniset $TEMPEST_CONFIG volume-feature-enabled bootable True
471
Salvatore33e8ee22014-10-05 01:36:34 +0200472 local volume_api_extensions=${VOLUME_API_EXTENSIONS:-"all"}
473 if [[ ! -z "$DISABLE_VOLUME_API_EXTENSIONS" ]]; then
474 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
475 volume_api_extensions=${VOLUME_API_EXTENSIONS:-$(iniget $tmp_cfg_file volume-feature-enabled api_extensions | tr -d " ")}
Marian Horbanea21eb42015-08-18 06:57:18 -0400476 # Remove disabled extensions
Salvatore33e8ee22014-10-05 01:36:34 +0200477 volume_api_extensions=$(remove_disabled_extensions $volume_api_extensions $DISABLE_VOLUME_API_EXTENSIONS)
478 fi
479 iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions $volume_api_extensions
480
Giulio Fidente3d60f4d2014-02-20 16:43:49 +0100481 if ! is_service_enabled c-bak; then
482 iniset $TEMPEST_CONFIG volume-feature-enabled backup False
Giulio Fidente3632ab12013-09-10 02:51:26 +0200483 fi
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000484
Dean Troyerdc97cb72015-03-28 08:20:50 -0500485 # Using ``CINDER_ENABLED_BACKENDS``
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000486 if [[ -n "$CINDER_ENABLED_BACKENDS" ]] && [[ $CINDER_ENABLED_BACKENDS =~ .*,.* ]]; then
Matthew Treinishdb1c3842014-02-04 20:58:00 +0000487 iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000488 local i=1
489 local be
490 for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
491 local be_name=${be##*:}
492 iniset $TEMPEST_CONFIG volume "backend${i}_name" "$be_name"
493 i=$(( i + 1 ))
494 done
john-griffithdc4dc7f2014-01-22 18:09:32 -0700495 fi
496
Eric Harney01456482014-10-14 18:53:53 -0400497 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
Patrick East1c0628f2014-10-22 16:22:47 -0700498 "$TEMPEST_VOLUME_VENDOR" != "$TEMPEST_DEFAULT_VOLUME_VENDOR" ]; then
Ed Balduf2f23d752014-07-29 14:42:27 -0600499 iniset $TEMPEST_CONFIG volume vendor_name "$TEMPEST_VOLUME_VENDOR"
Eric Harney01456482014-10-14 18:53:53 -0400500 fi
501 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
JordanP82a7d932014-12-04 14:09:16 +0100502 "$TEMPEST_STORAGE_PROTOCOL" != "$TEMPEST_DEFAULT_STORAGE_PROTOCOL" ]; then
503 iniset $TEMPEST_CONFIG volume storage_protocol "$TEMPEST_STORAGE_PROTOCOL"
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200504 fi
505
Julie Pichonfea70f82013-07-29 11:22:08 +0100506 # Dashboard
john-griffithdc4dc7f2014-01-22 18:09:32 -0700507 iniset $TEMPEST_CONFIG dashboard dashboard_url "http://$SERVICE_HOST/"
508 iniset $TEMPEST_CONFIG dashboard login_url "http://$SERVICE_HOST/auth/login/"
Julie Pichonfea70f82013-07-29 11:22:08 +0100509
Dean Troyerdc97cb72015-03-28 08:20:50 -0500510 # CLI
john-griffithdc4dc7f2014-01-22 18:09:32 -0700511 iniset $TEMPEST_CONFIG cli cli_dir $NOVA_BIN_DIR
Ian Wienand7fa19022013-06-25 14:11:48 +1000512
Adam Gandelman43bd6672014-04-03 11:13:13 -0700513 # Baremetal
514 if [ "$VIRT_DRIVER" = "ironic" ] ; then
515 iniset $TEMPEST_CONFIG baremetal driver_enabled True
Jay Faulkner6c0da092015-03-26 15:19:32 -0700516 iniset $TEMPEST_CONFIG baremetal unprovision_timeout 300
Vladyslav Drok41309002015-04-29 13:36:52 +0300517 iniset $TEMPEST_CONFIG baremetal deploy_img_dir $FILES
518 iniset $TEMPEST_CONFIG baremetal node_uuid $IRONIC_NODE_UUID
Adam Gandelmanfdfe7a02014-07-24 10:06:18 -0400519 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
520 iniset $TEMPEST_CONFIG compute-feature-enabled console_output False
521 iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False
522 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration False
523 iniset $TEMPEST_CONFIG compute-feature-enabled pause False
524 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
525 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
526 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
527 iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
David Shrewsburycf21b712014-08-13 07:03:58 -0400528 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
Adam Gandelman43bd6672014-04-03 11:13:13 -0700529 fi
530
Nels Nelson7b47c472015-01-05 16:36:42 -0600531 # Libvirt-LXC
532 if [ "$VIRT_DRIVER" = "libvirt" ] && [ "$LIBVIRT_TYPE" = "lxc" ]; then
533 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
534 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
535 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
536 fi
537
Dean Troyerdc97cb72015-03-28 08:20:50 -0500538 # ``service_available``
Dean Troyer4237f592014-01-29 16:22:11 -0600539 for service in ${TEMPEST_SERVICES//,/ }; do
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400540 if is_service_enabled $service ; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700541 iniset $TEMPEST_CONFIG service_available $service "True"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400542 else
john-griffithdc4dc7f2014-01-22 18:09:32 -0700543 iniset $TEMPEST_CONFIG service_available $service "False"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400544 fi
545 done
546
Rob Crittendene1d013f2015-02-10 14:15:35 -0500547 if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then
Dean Troyerdc97cb72015-03-28 08:20:50 -0500548 # Use the ``BOTO_CONFIG`` environment variable to point to this file
Rob Crittenden90c20202014-11-17 01:16:22 -0500549 iniset $BOTO_CONF Boto ca_certificates_file $SSL_BUNDLE_FILE
550 sudo chown $STACK_USER $BOTO_CONF
551 fi
552
Matthew Treinishdf8f43b2015-08-09 20:30:39 -0400553 # Auth
554 iniset $TEMPEST_CONFIG auth tempest_roles "Member"
555 if [[ $TEMPEST_USE_TEST_ACCOUNTS == "True" ]]; then
556 if [[ $TEMPEST_HAS_ADMIN == "True" ]]; then
557 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 -0400558 else
Matthew Treinishdf8f43b2015-08-09 20:30:39 -0400559 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
560 fi
561 iniset $TEMPEST_CONFIG auth allow_tenant_isolation False
562 iniset $TEMPEST_CONFIG auth test_accounts_file "etc/accounts.yaml"
563 else
564 iniset $TEMPEST_CONFIG auth allow_tenant_isolation ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
565 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100566 # Restore IFS
567 IFS=$ifs
Sean Dagued0931212012-10-04 16:06:44 -0400568}
569
Dean Troyer42a59c22014-03-03 14:31:29 -0600570# create_tempest_accounts() - Set up common required tempest accounts
571
572# Project User Roles
573# ------------------------------------------------------------------
574# alt_demo alt_demo Member
575
Dean Troyer42a59c22014-03-03 14:31:29 -0600576function create_tempest_accounts {
577 if is_service_enabled tempest; then
578 # Tempest has some tests that validate various authorization checks
579 # between two regular users in separate tenants
Jamie Lennoxb632c9e2015-05-28 23:36:15 +0000580 get_or_create_project alt_demo default
Jamie Lennox9d7e7762015-05-29 01:08:53 +0000581 get_or_create_user alt_demo "$ADMIN_PASSWORD" "default" "alt_demo@example.com"
Jamie Lennox9b215db2015-02-10 18:19:57 +1100582 get_or_add_user_project_role Member alt_demo alt_demo
Dean Troyer42a59c22014-03-03 14:31:29 -0600583 fi
584}
585
Dean Troyerdc97cb72015-03-28 08:20:50 -0500586# install_tempest_lib() - Collect source, prepare, and install ``tempest-lib``
Matthew Treinish34723862014-09-08 14:01:21 -0400587function install_tempest_lib {
Sean Dague91b22902014-11-18 07:13:35 -0500588 if use_library_from_git "tempest-lib"; then
589 git_clone_by_name "tempest-lib"
Sean Dague86b65dd2014-11-20 17:23:04 -0500590 setup_dev_lib "tempest-lib"
Dean Troyerdc97cb72015-03-28 08:20:50 -0500591 # NOTE(mtreinish) For testing ``tempest-lib`` from git with Tempest we need to
592 # put the git version of ``tempest-lib`` in the Tempest job's tox venv
Matthew Treinish83e166b2015-02-18 19:01:20 -0500593 export PIP_VIRTUAL_ENV=${PROJECT_VENV["tempest"]}
594 setup_dev_lib "tempest-lib"
595 unset PIP_VIRTUAL_ENV
Sean Dague5cb19062014-11-01 01:37:45 +0100596 fi
Matthew Treinish34723862014-09-08 14:01:21 -0400597}
598
Sean Dagued0931212012-10-04 16:06:44 -0400599# install_tempest() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100600function install_tempest {
Sean Dagued0931212012-10-04 16:06:44 -0400601 git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
Clark Boylan33dc8692014-08-19 22:37:10 -0700602 pip_install tox
Matthew Treinish83e166b2015-02-18 19:01:20 -0500603 pushd $TEMPEST_DIR
604 tox --notest -efull
605 PROJECT_VENV["tempest"]=${TEMPEST_DIR}/.tox/full
606 install_tempest_lib
607 popd
Sean Dagued0931212012-10-04 16:06:44 -0400608}
609
Dean Troyerdc97cb72015-03-28 08:20:50 -0500610# init_tempest() - Initialize EC2 images
Ian Wienandaee18c72014-02-21 15:35:08 +1100611function init_tempest {
Adalberto Medeiros53971532014-07-10 16:55:49 -0300612 local base_image_name=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}
613 # /opt/stack/devstack/files/images/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec
Attila Fazekas3c529222013-01-21 06:50:33 +0100614 local image_dir="$FILES/images/${base_image_name}-uec"
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100615 local kernel="$image_dir/${base_image_name}-vmlinuz"
616 local ramdisk="$image_dir/${base_image_name}-initrd"
617 local disk_image="$image_dir/${base_image_name}-blank.img"
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200618 if is_service_enabled nova; then
Dean Troyerdc97cb72015-03-28 08:20:50 -0500619 # If the CirrOS uec downloaded and the system is UEC capable
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200620 if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a "$VIRT_DRIVER" != "openvz" \
621 -a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then
622 echo "Prepare aki/ari/ami Images"
623 mkdir -p $BOTO_MATERIALS_PATH
624 ( #new namespace
Andrey Pavlov7cc39072015-03-30 20:49:22 +0300625 # euca2ools should be installed to call euca-* commands
626 is_package_installed euca2ools || install_package euca2ools
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200627 # tenant:demo ; user: demo
628 source $TOP_DIR/accrc/demo/demo
629 euca-bundle-image -r ${CIRROS_ARCH} -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH"
630 euca-bundle-image -r ${CIRROS_ARCH} -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH"
631 euca-bundle-image -r ${CIRROS_ARCH} -i "$disk_image" -d "$BOTO_MATERIALS_PATH"
632 ) 2>&1 </dev/null | cat
633 else
634 echo "Boto materials are not prepared"
635 fi
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100636 fi
637}
638
Sean Dagued0931212012-10-04 16:06:44 -0400639# Restore xtrace
640$XTRACE
Sean Dague584d90e2013-03-29 14:34:53 -0400641
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100642# Tell emacs to use shell-script-mode
643## Local variables:
644## mode: shell-script
645## End: