blob: bc144f9563d4021956817b5c3b310a120b811e87 [file] [log] [blame]
Oleksii Zhurba1580fc52017-11-14 15:20:44 -06001#!/bin/bash
2
Oleksii Zhurba1580fc52017-11-14 15:20:44 -06003variables=(
4OS_USERNAME
5OS_PASSWORD
6OS_TENANT_NAME
7OS_AUTH_URL
8)
9
10check_variables () {
11 for i in $(seq 0 $(( ${#variables[@]} - 1 )) ); do
12 if [ -z "${!variables[$i]}" ]; then
13 echo "Variable \"${variables[$i]}\" is not defined"
14 exit 1
15 fi
16 done
17}
18
19rally_configuration () {
Oleksii Zhurba22737902018-02-07 14:09:47 -060020 rally_version=$(rally version 2>&1)
21 if [ "$rally_version" == "0.9.0" ] || [ "$rally_version" == "0.9.1" ]; then
22 pip install ansible==2.3.2.0
Oleksii Zhurba167f4652018-03-29 16:43:41 -050023 sed -i '270s/,/}#,/g' /usr/local/lib/python2.7/dist-packages/rally/plugins/openstack/wrappers/network.py
Oleksii Zhurba22737902018-02-07 14:09:47 -060024 fi
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060025 sub_name=`date "+%H_%M_%S"`
26 rally deployment create --fromenv --name=tempest_$sub_name
27 rally deployment config
28}
29
30tempest_configuration () {
31 sub_name=`date "+%H_%M_%S"`
32 if [ -n "${PROXY}" ]; then
33 export https_proxy=$PROXY
34 fi
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060035 rally verify create-verifier --name tempest_verifier_$sub_name --type tempest --source $TEMPEST_REPO --version $tempest_version
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060036 unset https_proxy
37 rally verify configure-verifier --show
38}
39
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060040quick_configuration () {
41current_path=$(pwd)
42#image
Oleksii Zhurbafe6b5712018-06-14 13:05:00 -050043glance image-list | grep "\btestvm\b" 2>&1 >/dev/null || {
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060044 if [ -n "${PROXY}" ]; then
45 export http_proxy=$PROXY
46 fi
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060047 ls $current_path/cvp-configuration/cirros-0.3.4-x86_64-disk.img || wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img -O $current_path/cvp-configuration/cirros-0.3.4-x86_64-disk.img
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060048 unset http_proxy
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060049 echo "MD5 should be ee1eca47dc88f4879d8a229cc70a07c6"
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060050 md5sum $current_path/cvp-configuration/cirros-0.3.4-x86_64-disk.img
Oleksii Zhurbafe6b5712018-06-14 13:05:00 -050051 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
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060052}
Oleksii Zhurbafe6b5712018-06-14 13:05:00 -050053IMAGE_REF2=$(glance image-list | grep 'testvm' | awk '{print $2}')
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060054#flavor for rally
55nova flavor-list | grep tiny 2>&1 >/dev/null || {
56 echo "Let's create m1.tiny flavor"
57 nova flavor-create --is-public true m1.tiny auto 128 1 1
58}
59#shared fixed network
60shared_count=`neutron net-list -c name -c shared | grep True | wc -l`
61if [ $shared_count -gt 1 ]; then
62 echo "TOO MANY SHARED NETWORKS! Script will choose just 1 random"
63fi
64if [ $shared_count -eq 0 ]; then
65 echo "Let's create shared fixed net"
Oleksii Zhurbafe6b5712018-06-14 13:05:00 -050066 neutron net-create --shared tempest-net
67 neutron subnet-create --name tempest-subnet --gateway 192.168.0.1 --allocation-pool start=192.168.0.2,end=192.168.0.254 --ip-version 4 tempest-net 192.168.0.0/24
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060068fi
69FIXED_NET=$(neutron net-list -c name -c shared | grep True | awk '{print $2}' | tail -n 1)
70echo "Fixed net is: $FIXED_NET"
71#Updating of tempest_full.conf file is skipped/deprecated
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060072sed -i 's/${IMAGE_REF2}/'$IMAGE_REF2'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060073sed -i 's/${FIXED_NET}/'$FIXED_NET'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060074sed -i 's/publicURL/'$TEMPEST_ENDPOINT_TYPE'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
75cat $current_path/cvp-configuration/tempest/tempest_ext.conf
76}
77
Oleksii Zhurbaba5883f2018-01-18 09:52:08 -060078if [ "$1" == "reconfigure" ]; then
79 echo "This is reconfiguration"
80 rally verify configure-verifier --reconfigure
81 rally verify configure-verifier --extend /home/rally/cvp-configuration/tempest/tempest_ext.conf
82 rally verify configure-verifier --show
83 exit 0
84fi
85
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060086check_variables
87rally_configuration
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060088if [ -n "${TEMPEST_REPO}" ]; then
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060089 tempest_configuration
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060090 quick_configuration
91 rally verify configure-verifier --extend /home/rally/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurba7f3941b2018-03-27 14:38:42 -050092 # Add 2 additional tempest tests (live migration to all nodes + ssh to all nodes)
93 # TBD
94 #cat tempest/test_extension.py >> repo/tempest/scenario/test_server_multinode.py
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060095fi
96set -e
97
98echo "Job is done!"