blob: 68945013197727c1adb10af7852e081139d7fd85 [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``
32# - ``CINDER_MULTI_LVM_BACKEND``
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +000033# - ``CINDER_ENABLED_BACKENDS``
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
Dean Troyer6d04fd72012-12-21 11:03:37 -060066
Attila Fazekas2d4c8da2014-03-19 10:42:01 +010067BOTO_MATERIALS_PATH="$FILES/images/s3-materials/cirros-${CIRROS_VERSION}"
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
77IPV6_ENABLED=$(trueorfalse True $IPV6_ENABLED)
sridhargaddamfe733ae2014-06-03 09:03:45 +053078IPV6_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
Sean Dagued0931212012-10-04 16:06:44 -040083# configure_tempest() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +110084function configure_tempest {
Matthew Treinish95fb0d42013-01-28 16:24:14 -050085 setup_develop $TEMPEST_DIR
Attila Fazekas65c08462012-12-07 14:20:51 +010086 local image_lines
87 local images
88 local num_images
89 local image_uuid
90 local image_uuid_alt
Attila Fazekas65c08462012-12-07 14:20:51 +010091 local password
92 local line
93 local flavors
Clark Boylan3b80bde2013-11-20 17:51:50 -080094 local available_flavors
Attila Fazekas65c08462012-12-07 14:20:51 +010095 local flavors_ref
96 local flavor_lines
Maru Newbya5c774e2012-12-10 10:40:01 +000097 local public_network_id
Maru Newby31c94ab2012-12-19 03:59:20 +000098 local public_router_id
Maru Newbya5c774e2012-12-10 10:40:01 +000099 local tenant_networks_reachable
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100100 local boto_instance_type="m1.tiny"
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200101 local ssh_connect_method="fixed"
Attila Fazekas2aa35172012-12-05 20:03:40 +0100102
Dean Troyer6d04fd72012-12-21 11:03:37 -0600103 # Save IFS
Attila Fazekas2aa35172012-12-05 20:03:40 +0100104 ifs=$IFS
105
106 # Glance should already contain images to be used in tempest
107 # testing. Here we simply look for images stored in Glance
108 # and set the appropriate variables for use in the tempest config
109 # We ignore ramdisk and kernel images, look for the default image
Attila Fazekas65c08462012-12-07 14:20:51 +0100110 # ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the
111 # first image returned and set ``image_uuid_alt`` to the second,
Attila Fazekas2aa35172012-12-05 20:03:40 +0100112 # if there is more than one returned...
113 # ... Also ensure we only take active images, so we don't get snapshots in process
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500114 declare -a images
115
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200116 if is_service_enabled glance; then
117 while read -r IMAGE_NAME IMAGE_UUID; do
118 if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
119 image_uuid="$IMAGE_UUID"
120 image_uuid_alt="$IMAGE_UUID"
121 fi
122 images+=($IMAGE_UUID)
123 # TODO(stevemar): update this command to use openstackclient's `openstack image list`
124 # when it supports listing by status.
125 done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500126
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200127 case "${#images[*]}" in
128 0)
129 echo "Found no valid images to use!"
130 exit 1
131 ;;
132 1)
133 if [ -z "$image_uuid" ]; then
134 image_uuid=${images[0]}
135 image_uuid_alt=${images[0]}
136 fi
137 ;;
138 *)
139 if [ -z "$image_uuid" ]; then
140 image_uuid=${images[0]}
141 image_uuid_alt=${images[1]}
142 fi
143 ;;
144 esac
145 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100146
147 # Create tempest.conf from tempest.conf.sample
148 # copy every time, because the image UUIDS are going to change
Ian Wienand5f90fc02014-02-24 15:40:42 +1100149 if [[ ! -d $TEMPEST_CONFIG_DIR ]]; then
150 sudo mkdir -p $TEMPEST_CONFIG_DIR
151 fi
152 sudo chown $STACK_USER $TEMPEST_CONFIG_DIR
153 cp $TEMPEST_DIR/etc/tempest.conf.sample $TEMPEST_CONFIG
154 chmod 644 $TEMPEST_CONFIG
Attila Fazekas2aa35172012-12-05 20:03:40 +0100155
Attila Fazekas65c08462012-12-07 14:20:51 +0100156 password=${ADMIN_PASSWORD:-secrete}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100157
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000158 # See files/keystone_data.sh and stack.sh where admin, demo and alt_demo
159 # user and tenant are set up...
160 ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
161 ADMIN_TENANT_NAME=${ADMIN_TENANT_NAME:-admin}
Andrea Frittoli03523252014-04-08 13:43:56 +0100162 ADMIN_DOMAIN_NAME=${ADMIN_DOMAIN_NAME:-Default}
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000163 TEMPEST_USERNAME=${TEMPEST_USERNAME:-demo}
164 TEMPEST_TENANT_NAME=${TEMPEST_TENANT_NAME:-demo}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100165 ALT_USERNAME=${ALT_USERNAME:-alt_demo}
166 ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
Harshada Mangesh Kakad49126232014-05-23 09:16:52 +0000167 ADMIN_TENANT_ID=$(openstack project list | awk "/ admin / { print \$2 }")
Attila Fazekas2aa35172012-12-05 20:03:40 +0100168
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200169 if is_service_enabled nova; then
170 # If the ``DEFAULT_INSTANCE_TYPE`` not declared, use the new behavior
171 # Tempest creates instane types for himself
172 if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
173 available_flavors=$(nova flavor-list)
174 if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
175 if is_arch "ppc64"; then
176 # qemu needs at least 128MB of memory to boot on ppc64
177 nova flavor-create m1.nano 42 128 0 1
178 else
179 nova flavor-create m1.nano 42 64 0 1
180 fi
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200181 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200182 flavor_ref=42
183 boto_instance_type=m1.nano
184 if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
185 if is_arch "ppc64"; then
186 nova flavor-create m1.micro 84 256 0 1
187 else
188 nova flavor-create m1.micro 84 128 0 1
189 fi
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200190 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200191 flavor_ref_alt=84
192 else
193 # Check Nova for existing flavors and, if set, look for the
194 # ``DEFAULT_INSTANCE_TYPE`` and use that.
195 boto_instance_type=$DEFAULT_INSTANCE_TYPE
196 flavor_lines=`nova flavor-list`
197 IFS=$'\r\n'
198 flavors=""
199 for line in $flavor_lines; do
200 f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
201 flavors="$flavors $f"
202 done
Attila Fazekas2aa35172012-12-05 20:03:40 +0100203
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200204 for line in $flavor_lines; do
205 flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
206 done
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100207
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200208 IFS=" "
209 flavors=($flavors)
210 num_flavors=${#flavors[*]}
211 echo "Found $num_flavors flavors"
212 if [[ $num_flavors -eq 0 ]]; then
213 echo "Found no valid flavors to use!"
214 exit 1
Adalberto Medeiros63a71a22013-06-06 08:46:04 -0400215 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200216 flavor_ref=${flavors[0]}
217 flavor_ref_alt=$flavor_ref
218
219 # ensure flavor_ref and flavor_ref_alt have different values
220 # some resize instance in tempest tests depends on this.
221 for f in ${flavors[@]:1}; do
222 if [[ $f -ne $flavor_ref ]]; then
223 flavor_ref_alt=$f
224 break
225 fi
226 done
227 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100228 fi
229
Maru Newbya5c774e2012-12-10 10:40:01 +0000230 if [ "$Q_USE_NAMESPACE" != "False" ]; then
231 tenant_networks_reachable=false
Attila Fazekasf9e77392013-12-03 06:17:16 +0100232 if ! is_service_enabled n-net; then
233 ssh_connect_method="floating"
234 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000235 else
236 tenant_networks_reachable=true
237 fi
238
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200239 ssh_connect_method=${TEMPEST_SSH_CONNECT_METHOD:-$ssh_connect_method}
240
Tomoe Sugiharaafbc6312013-11-14 20:02:47 +0000241 if [ "$Q_L3_ENABLED" = "True" ]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400242 public_network_id=$(neutron net-list | grep $PUBLIC_NETWORK_NAME | \
Maru Newbya5c774e2012-12-10 10:40:01 +0000243 awk '{print $2}')
Maru Newby31c94ab2012-12-19 03:59:20 +0000244 if [ "$Q_USE_NAMESPACE" == "False" ]; then
245 # If namespaces are disabled, devstack will create a single
246 # public router that tempest should be configured to use.
Mark McClainb05c8762013-07-06 23:29:39 -0400247 public_router_id=$(neutron router-list | awk "/ $Q_ROUTER_NAME / \
Sean Dague101b4242013-10-22 08:47:11 -0400248 { print \$2 }")
Maru Newby31c94ab2012-12-19 03:59:20 +0000249 fi
Maru Newbya5c774e2012-12-10 10:40:01 +0000250 fi
251
salvatoree4e535b2014-10-29 18:22:46 +0100252 iniset $TEMPEST_CONF DEFAULT use_syslog $SYSLOG
Matthew Treinish859cc682013-07-26 15:22:44 -0400253 # Oslo
john-griffithdc4dc7f2014-01-22 18:09:32 -0700254 iniset $TEMPEST_CONFIG DEFAULT lock_path $TEMPEST_STATE_PATH
Matthew Treinish14ccba02013-07-29 16:15:53 -0400255 mkdir -p $TEMPEST_STATE_PATH
john-griffithdc4dc7f2014-01-22 18:09:32 -0700256 iniset $TEMPEST_CONFIG DEFAULT use_stderr False
257 iniset $TEMPEST_CONFIG DEFAULT log_file tempest.log
258 iniset $TEMPEST_CONFIG DEFAULT debug True
Matthew Treinish859cc682013-07-26 15:22:44 -0400259
Attila Fazekas2aa35172012-12-05 20:03:40 +0100260 # Timeouts
john-griffithdc4dc7f2014-01-22 18:09:32 -0700261 iniset $TEMPEST_CONFIG compute build_timeout $BUILD_TIMEOUT
262 iniset $TEMPEST_CONFIG volume build_timeout $BUILD_TIMEOUT
263 iniset $TEMPEST_CONFIG boto build_timeout $BUILD_TIMEOUT
john-griffithdc4dc7f2014-01-22 18:09:32 -0700264 iniset $TEMPEST_CONFIG boto http_socket_timeout 5
Attila Fazekas2aa35172012-12-05 20:03:40 +0100265
Attila Fazekas97d3d202013-01-19 19:20:49 +0100266 # Identity
john-griffithdc4dc7f2014-01-22 18:09:32 -0700267 iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v2.0/"
Matthew Treinish6c9430e2014-02-06 17:06:00 +0000268 iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v3/"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000269 iniset $TEMPEST_CONFIG identity username $TEMPEST_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700270 iniset $TEMPEST_CONFIG identity password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000271 iniset $TEMPEST_CONFIG identity tenant_name $TEMPEST_TENANT_NAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700272 iniset $TEMPEST_CONFIG identity alt_username $ALT_USERNAME
273 iniset $TEMPEST_CONFIG identity alt_password "$password"
274 iniset $TEMPEST_CONFIG identity alt_tenant_name $ALT_TENANT_NAME
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000275 iniset $TEMPEST_CONFIG identity admin_username $ADMIN_USERNAME
john-griffithdc4dc7f2014-01-22 18:09:32 -0700276 iniset $TEMPEST_CONFIG identity admin_password "$password"
Andrea Frittolid46d9dd2014-03-05 13:38:19 +0000277 iniset $TEMPEST_CONFIG identity admin_tenant_name $ADMIN_TENANT_NAME
Harshada Mangesh Kakad49126232014-05-23 09:16:52 +0000278 iniset $TEMPEST_CONFIG identity admin_tenant_id $ADMIN_TENANT_ID
Andrea Frittoli03523252014-04-08 13:43:56 +0100279 iniset $TEMPEST_CONFIG identity admin_domain_name $ADMIN_DOMAIN_NAME
Andrea Frittoli07f1d0e2014-03-06 23:23:01 +0000280 iniset $TEMPEST_CONFIG identity auth_version ${TEMPEST_AUTH_VERSION:-v2}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100281
Sean Daguec3771452013-06-13 14:23:37 -0400282 # Image
283 # for the gate we want to be able to override this variable so we aren't
284 # doing an HTTP fetch over the wide internet for this test
285 if [[ ! -z "$TEMPEST_HTTP_IMAGE" ]]; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700286 iniset $TEMPEST_CONFIG image http_image $TEMPEST_HTTP_IMAGE
Sean Daguec3771452013-06-13 14:23:37 -0400287 fi
288
Attila Fazekas97d3d202013-01-19 19:20:49 +0100289 # Compute
john-griffithdc4dc7f2014-01-22 18:09:32 -0700290 iniset $TEMPEST_CONFIG compute allow_tenant_isolation ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
291 iniset $TEMPEST_CONFIG compute ssh_user ${DEFAULT_INSTANCE_USER:-cirros} # DEPRECATED
292 iniset $TEMPEST_CONFIG compute network_for_ssh $PRIVATE_NETWORK_NAME
293 iniset $TEMPEST_CONFIG compute ip_version_for_ssh 4
294 iniset $TEMPEST_CONFIG compute ssh_timeout $BUILD_TIMEOUT
295 iniset $TEMPEST_CONFIG compute image_ref $image_uuid
296 iniset $TEMPEST_CONFIG compute image_ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
297 iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid_alt
Kirill Shileev608f8842014-10-03 22:48:58 +0400298 iniset $TEMPEST_CONFIG compute image_alt_ssh_user ${ALT_INSTANCE_USER:-cirros}
john-griffithdc4dc7f2014-01-22 18:09:32 -0700299 iniset $TEMPEST_CONFIG compute flavor_ref $flavor_ref
300 iniset $TEMPEST_CONFIG compute flavor_ref_alt $flavor_ref_alt
john-griffithdc4dc7f2014-01-22 18:09:32 -0700301 iniset $TEMPEST_CONFIG compute ssh_connect_method $ssh_connect_method
Attila Fazekas97d3d202013-01-19 19:20:49 +0100302
Sean Daguede19bf92014-03-20 16:54:58 -0400303 # Compute Features
304 iniset $TEMPEST_CONFIG compute-feature-enabled resize True
Matthew Treinish270f93e2014-03-20 21:18:42 +0000305 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
306 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
307 iniset $TEMPEST_CONFIG compute-feature-enabled block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
Salvatore Orlando3046bc62014-08-21 12:11:10 -0700308 iniset $TEMPEST_CONFIG compute-feature-enabled api_extensions ${COMPUTE_API_EXTENSIONS:-"all"}
309 iniset $TEMPEST_CONFIG compute-feature-disabled api_extensions ${DISABLE_COMPUTE_API_EXTENSIONS}
Sean Daguede19bf92014-03-20 16:54:58 -0400310
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200311 # Compute admin
Sean Daguee530ba32014-03-07 05:58:18 -0500312 iniset $TEMPEST_CONFIG "compute-admin" username $ADMIN_USERNAME
313 iniset $TEMPEST_CONFIG "compute-admin" password "$password"
314 iniset $TEMPEST_CONFIG "compute-admin" tenant_name $ADMIN_TENANT_NAME
Attila Fazekas2aa35172012-12-05 20:03:40 +0100315
armando-migliaccio71ef61a2014-02-19 22:19:24 -0800316 # Network
john-griffithdc4dc7f2014-01-22 18:09:32 -0700317 iniset $TEMPEST_CONFIG network api_version 2.0
318 iniset $TEMPEST_CONFIG network tenant_networks_reachable "$tenant_networks_reachable"
319 iniset $TEMPEST_CONFIG network public_network_id "$public_network_id"
320 iniset $TEMPEST_CONFIG network public_router_id "$public_router_id"
321 iniset $TEMPEST_CONFIG network default_network "$FIXED_RANGE"
Matthew Treinishccf60f72014-03-03 22:48:31 -0500322 iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED"
Sean M. Collinsbb2908b2014-05-15 10:24:31 -0400323 iniset $TEMPEST_CONFIG network-feature-enabled ipv6_subnet_attributes "$IPV6_SUBNET_ATTRIBUTES_ENABLED"
Salvatore Orlando3046bc62014-08-21 12:11:10 -0700324 iniset $TEMPEST_CONFIG network-feature-enabled api_extensions ${NETWORK_API_EXTENSIONS:-"all"}
325 iniset $TEMPEST_CONFIG network-feature-disabled api_extensions ${DISABLE_NETWORK_API_EXTENSIONS}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100326
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200327 # boto
Rob Crittenden18d47782014-03-19 17:47:42 -0400328 iniset $TEMPEST_CONFIG boto ec2_url "$EC2_SERVICE_PROTOCOL://$SERVICE_HOST:8773/services/Cloud"
john-griffithdc4dc7f2014-01-22 18:09:32 -0700329 iniset $TEMPEST_CONFIG boto s3_url "http://$SERVICE_HOST:${S3_SERVICE_PORT:-3333}"
330 iniset $TEMPEST_CONFIG boto s3_materials_path "$BOTO_MATERIALS_PATH"
Adalberto Medeiros53971532014-07-10 16:55:49 -0300331 iniset $TEMPEST_CONFIG boto ari_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initrd.manifest.xml
332 iniset $TEMPEST_CONFIG boto ami_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-blank.img.manifest.xml
333 iniset $TEMPEST_CONFIG boto aki_manifest cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-vmlinuz.manifest.xml
john-griffithdc4dc7f2014-01-22 18:09:32 -0700334 iniset $TEMPEST_CONFIG boto instance_type "$boto_instance_type"
335 iniset $TEMPEST_CONFIG boto http_socket_timeout 30
336 iniset $TEMPEST_CONFIG boto ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100337
Sean Dague669c4fc2014-04-03 11:28:01 -0400338 # Orchestration Tests
339 if is_service_enabled heat; then
340 if [[ ! -z "$HEAT_CFN_IMAGE_URL" ]]; then
341 iniset $TEMPEST_CONFIG orchestration image_ref $(basename "$HEAT_CFN_IMAGE_URL" ".qcow2")
342 fi
Attila Fazekas51557a52014-06-13 16:09:37 +0200343 # build a specialized heat flavor
Sean Dague669c4fc2014-04-03 11:28:01 -0400344 available_flavors=$(nova flavor-list)
345 if [[ ! ( $available_flavors =~ 'm1.heat' ) ]]; then
Attila Fazekas51557a52014-06-13 16:09:37 +0200346 nova flavor-create m1.heat 451 512 0 1
Sean Dague669c4fc2014-04-03 11:28:01 -0400347 fi
348 iniset $TEMPEST_CONFIG orchestration instance_type "m1.heat"
349 iniset $TEMPEST_CONFIG orchestration build_timeout 900
Steve Bakerd5cccad2013-07-19 10:34:24 +1200350 fi
351
William Marshall24d866e2013-07-02 12:26:31 -0500352 # Scenario
Adalberto Medeiros53971532014-07-10 16:55:49 -0300353 iniset $TEMPEST_CONFIG scenario img_dir "$FILES/images/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec"
354 iniset $TEMPEST_CONFIG scenario ami_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-blank.img"
355 iniset $TEMPEST_CONFIG scenario ari_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initrd"
356 iniset $TEMPEST_CONFIG scenario aki_img_file "cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-vmlinuz"
William Marshall24d866e2013-07-02 12:26:31 -0500357
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400358 # Large Ops Number
john-griffithdc4dc7f2014-01-22 18:09:32 -0700359 iniset $TEMPEST_CONFIG scenario large_ops_number ${TEMPEST_LARGE_OPS_NUMBER:-0}
Joe Gordonbb8c6d42013-08-26 17:00:05 -0400360
Vadim Rovachev2541d612014-05-29 18:48:10 +0400361 # Telemetry
362 # Ceilometer API optimization happened in juno that allows to run more tests in tempest.
363 # Once Tempest retires support for icehouse this flag can be removed.
364 iniset $TEMPEST_CONFIG telemetry too_slow_to_test "False"
365
Salvatore Orlando3046bc62014-08-21 12:11:10 -0700366 # Object storage
367 iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis ${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
368 iniset $TEMPEST_CONFIG object-storage-feature-disabled discoverable_apis ${OBJECT_STORAGE_DISABLE_API_EXTENSIONS}
369
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200370 # Volume
Salvatore Orlando3046bc62014-08-21 12:11:10 -0700371 iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions ${VOLUME_API_EXTENSIONS:-"all"}
372 iniset $TEMPEST_CONFIG volume-feature-disabled api_extensions ${DISABLE_VOLUME_API_EXTENSIONS}
Giulio Fidente3d60f4d2014-02-20 16:43:49 +0100373 if ! is_service_enabled c-bak; then
374 iniset $TEMPEST_CONFIG volume-feature-enabled backup False
Giulio Fidente3632ab12013-09-10 02:51:26 +0200375 fi
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000376
377 # Using CINDER_ENABLED_BACKENDS
378 if [[ -n "$CINDER_ENABLED_BACKENDS" ]] && [[ $CINDER_ENABLED_BACKENDS =~ .*,.* ]]; then
Matthew Treinishdb1c3842014-02-04 20:58:00 +0000379 iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000380 local i=1
381 local be
382 for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
383 local be_name=${be##*:}
384 iniset $TEMPEST_CONFIG volume "backend${i}_name" "$be_name"
385 i=$(( i + 1 ))
386 done
john-griffithdc4dc7f2014-01-22 18:09:32 -0700387 fi
388
Eric Harney01456482014-10-14 18:53:53 -0400389 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
Patrick East1c0628f2014-10-22 16:22:47 -0700390 "$TEMPEST_VOLUME_VENDOR" != "$TEMPEST_DEFAULT_VOLUME_VENDOR" ]; then
Ed Balduf2f23d752014-07-29 14:42:27 -0600391 iniset $TEMPEST_CONFIG volume vendor_name "$TEMPEST_VOLUME_VENDOR"
Eric Harney01456482014-10-14 18:53:53 -0400392 fi
393 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
394 $TEMPEST_STORAGE_PROTOCOL != $TEMPEST_DEFAULT_STORAGE_PROTOCOL ]; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700395 iniset $TEMPEST_CONFIG volume storage_protocol $TEMPEST_STORAGE_PROTOCOL
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200396 fi
397
Julie Pichonfea70f82013-07-29 11:22:08 +0100398 # Dashboard
john-griffithdc4dc7f2014-01-22 18:09:32 -0700399 iniset $TEMPEST_CONFIG dashboard dashboard_url "http://$SERVICE_HOST/"
400 iniset $TEMPEST_CONFIG dashboard login_url "http://$SERVICE_HOST/auth/login/"
Julie Pichonfea70f82013-07-29 11:22:08 +0100401
Ian Wienand7fa19022013-06-25 14:11:48 +1000402 # cli
john-griffithdc4dc7f2014-01-22 18:09:32 -0700403 iniset $TEMPEST_CONFIG cli cli_dir $NOVA_BIN_DIR
Ian Wienand7fa19022013-06-25 14:11:48 +1000404
Adam Gandelman43bd6672014-04-03 11:13:13 -0700405 # Baremetal
406 if [ "$VIRT_DRIVER" = "ironic" ] ; then
407 iniset $TEMPEST_CONFIG baremetal driver_enabled True
Adam Gandelmanfdfe7a02014-07-24 10:06:18 -0400408 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
409 iniset $TEMPEST_CONFIG compute-feature-enabled console_output False
410 iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False
411 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration False
412 iniset $TEMPEST_CONFIG compute-feature-enabled pause False
413 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
414 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
415 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
416 iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
David Shrewsburycf21b712014-08-13 07:03:58 -0400417 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
Adam Gandelman43bd6672014-04-03 11:13:13 -0700418 fi
419
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400420 # service_available
Dean Troyer4237f592014-01-29 16:22:11 -0600421 for service in ${TEMPEST_SERVICES//,/ }; do
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400422 if is_service_enabled $service ; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700423 iniset $TEMPEST_CONFIG service_available $service "True"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400424 else
john-griffithdc4dc7f2014-01-22 18:09:32 -0700425 iniset $TEMPEST_CONFIG service_available $service "False"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400426 fi
427 done
428
Attila Fazekas2aa35172012-12-05 20:03:40 +0100429 # Restore IFS
430 IFS=$ifs
Sean Dagued0931212012-10-04 16:06:44 -0400431}
432
Dean Troyer42a59c22014-03-03 14:31:29 -0600433# create_tempest_accounts() - Set up common required tempest accounts
434
435# Project User Roles
436# ------------------------------------------------------------------
437# alt_demo alt_demo Member
438
439# Migrated from keystone_data.sh
440function create_tempest_accounts {
441 if is_service_enabled tempest; then
442 # Tempest has some tests that validate various authorization checks
443 # between two regular users in separate tenants
Bartosz Górski0abde392014-02-28 14:15:19 +0100444 get_or_create_project alt_demo
445 get_or_create_user alt_demo "$ADMIN_PASSWORD" alt_demo "alt_demo@example.com"
446 get_or_add_user_role Member alt_demo alt_demo
Dean Troyer42a59c22014-03-03 14:31:29 -0600447 fi
448}
449
Matthew Treinish34723862014-09-08 14:01:21 -0400450# install_tempest_lib() - Collect source, prepare, and install tempest-lib
451function install_tempest_lib {
Sean Dague91b22902014-11-18 07:13:35 -0500452 if use_library_from_git "tempest-lib"; then
453 git_clone_by_name "tempest-lib"
Sean Dague86b65dd2014-11-20 17:23:04 -0500454 setup_dev_lib "tempest-lib"
Sean Dague5cb19062014-11-01 01:37:45 +0100455 fi
Matthew Treinish34723862014-09-08 14:01:21 -0400456}
457
Sean Dagued0931212012-10-04 16:06:44 -0400458# install_tempest() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100459function install_tempest {
Matthew Treinish34723862014-09-08 14:01:21 -0400460 install_tempest_lib
Sean Dagued0931212012-10-04 16:06:44 -0400461 git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
Clark Boylan33dc8692014-08-19 22:37:10 -0700462 pip_install tox
Sean Dagued0931212012-10-04 16:06:44 -0400463}
464
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100465# init_tempest() - Initialize ec2 images
Ian Wienandaee18c72014-02-21 15:35:08 +1100466function init_tempest {
Adalberto Medeiros53971532014-07-10 16:55:49 -0300467 local base_image_name=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}
468 # /opt/stack/devstack/files/images/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec
Attila Fazekas3c529222013-01-21 06:50:33 +0100469 local image_dir="$FILES/images/${base_image_name}-uec"
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100470 local kernel="$image_dir/${base_image_name}-vmlinuz"
471 local ramdisk="$image_dir/${base_image_name}-initrd"
472 local disk_image="$image_dir/${base_image_name}-blank.img"
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200473 if is_service_enabled nova; then
474 # if the cirros uec downloaded and the system is uec capable
475 if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a "$VIRT_DRIVER" != "openvz" \
476 -a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then
477 echo "Prepare aki/ari/ami Images"
478 mkdir -p $BOTO_MATERIALS_PATH
479 ( #new namespace
480 # tenant:demo ; user: demo
481 source $TOP_DIR/accrc/demo/demo
482 euca-bundle-image -r ${CIRROS_ARCH} -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH"
483 euca-bundle-image -r ${CIRROS_ARCH} -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH"
484 euca-bundle-image -r ${CIRROS_ARCH} -i "$disk_image" -d "$BOTO_MATERIALS_PATH"
485 ) 2>&1 </dev/null | cat
486 else
487 echo "Boto materials are not prepared"
488 fi
Attila Fazekas1d29d8b2013-01-07 15:51:32 +0100489 fi
490}
491
Sean Dagued0931212012-10-04 16:06:44 -0400492# Restore xtrace
493$XTRACE
Sean Dague584d90e2013-03-29 14:34:53 -0400494
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100495# Tell emacs to use shell-script-mode
496## Local variables:
497## mode: shell-script
498## End: