Merging fixes for heat-plugin into master

Change-Id: I84bc0c85c469580992939c0e8d90954f1f8794d1
Related-PROD: PROD-32143
diff --git a/configure.sh b/configure.sh
index 250e2e0..35b1b8c 100755
--- a/configure.sh
+++ b/configure.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-
+ 
 variables=(
 OS_USERNAME
 OS_PASSWORD
@@ -39,6 +39,20 @@
   echo "pre_newton_neutron=True" >> /etc/rally/rally.conf
 }
 
+update_cacerts () {
+  # configuring certificates file
+  if [ -z ${OS_CACERT+x} ]; then
+    echo '# No OS_CACERT is set, update of crt file skipped'
+  else
+    echo '# Adding custom certificates'
+    ca=( $(find ${1} -name cacert.pem) )
+    for crt in ${ca[@]}; do
+      cat ${OS_CACERT} >>${crt}
+      echo '-> ${crt}'
+    done
+  fi
+}
+
 tempest_configuration () {
   sub_name=`date "+%H_%M_%S"`
   # default tempest version is 18.0.0 now, unless
@@ -50,6 +64,7 @@
     rally verify create-verifier --name tempest_verifier_$sub_name --type tempest --source $TEMPEST_REPO --system-wide --version $tempest_version
     #rally verify add-verifier-ext --source /var/lib/telemetry-tempest-plugin
     rally verify add-verifier-ext --source /var/lib/heat-tempest-plugin
+    update_cacerts "/usr/local/lib"
   else
     if [ -n "${PROXY}" ]; then
       export https_proxy=$PROXY
@@ -59,10 +74,12 @@
     rally verify add-verifier-ext --version 0.2.0 --source https://github.com/openstack/heat-tempest-plugin
     pip install --force-reinstall python-cinderclient==3.2.0
     unset https_proxy
+    update_cacerts "/home/rally/.rally/verification"
   fi
   # set password length to 32
   data_utils_path=`find /home/rally/.rally/verification/ -name data_utils.py`
   sed -i 's/length=15/length=32/g' $data_utils_path
+
   # supress tempest.conf display in console
   #rally verify configure-verifier --show
 }
@@ -70,7 +87,8 @@
 glance_image() {
 current_path=$(pwd)
 # fetch image with exact name: testvm
-IMAGE_REF2=$(glance image-list | grep '\btestvm\b' | awk '{print $2}')
+IMAGE_NAME2=testvm
+IMAGE_REF2=$(glance image-list | grep '\b${IMAGE_NAME2}\b' | awk '{print $2}')
 if [ "${IMAGE_REF2}" == "" ]; then
   if [ "$PROXY" != "offline" ]; then
     if [ -n "${PROXY}" ]; then
@@ -84,14 +102,15 @@
   if [ -e $current_path/cvp-configuration/cirros-0.3.4-x86_64-disk.img ]; then
     echo "MD5 should be ee1eca47dc88f4879d8a229cc70a07c6"
     md5sum $current_path/cvp-configuration/cirros-0.3.4-x86_64-disk.img
-    glance image-create --name=testvm --visibility=public --container-format=bare --disk-format=qcow2 < $current_path/cvp-configuration/cirros-0.3.4-x86_64-disk.img
-    IMAGE_REF2=$(glance image-list | grep '\btestvm\b' | awk '{print $2}')
+    glance image-create --name=${IMAGE_NAME2} --visibility=public --container-format=bare --disk-format=qcow2 < $current_path/cvp-configuration/cirros-0.3.4-x86_64-disk.img
+    IMAGE_REF2=$(glance image-list | grep '\b${IMAGE_NAME2}\b' | awk '{print $2}')
   else
     echo "Cirros image was not downloaded! Some tests may fail"
     IMAGE_REF2=""
   fi
 fi
 sed -i 's/${IMAGE_REF2}/'$IMAGE_REF2'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
+sed -i 's/${IMAGE_NAME2}/'$IMAGE_NAME2'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
 }
 
 quick_configuration () {
diff --git a/tempest/tempest_ext.conf b/tempest/tempest_ext.conf
index cc28635..5a73965 100644
--- a/tempest/tempest_ext.conf
+++ b/tempest/tempest_ext.conf
@@ -20,6 +20,7 @@
 project_name = ${OS_TENANT_NAME}
 admin_project_name = ${OS_TENANT_NAME}
 region = ${OS_REGION_NAME}
+auth_version = 3
 auth_url = ${OS_AUTH_URL}
 project_domain_name = Default
 user_domain_name = Default
@@ -30,8 +31,8 @@
 floating_network_name = ${PUBLIC_NET}
 fixed_subnet_name = ${FIXED_SUBNET_NAME}
 disable_ssl_certificate_validation = True
-image_ref = ${IMAGE_REF2}
-minimal_image_ref = ${IMAGE_REF2}
+image_ref = ${IMAGE_NAME2}
+minimal_image_ref = ${IMAGE_NAME2}
 fixed_network_name = ${FIXED_NET}
 build_timeout = 180
 ssh_timeout = 30