blob: dec06796d29450e13cb8ed77202a69d7e87d386b [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
Oleksii Zhurbac8058d62018-06-21 17:46:11 -050017 ip=$(echo ${OS_AUTH_URL} | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/')
18 export no_proxy=$ip
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060019}
20
21rally_configuration () {
Oleksii Zhurba33671b62019-02-21 17:55:22 -060022 pip install --force-reinstall python-glanceclient==2.11
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060023 sub_name=`date "+%H_%M_%S"`
24 rally deployment create --fromenv --name=tempest_$sub_name
25 rally deployment config
26}
27
28tempest_configuration () {
29 sub_name=`date "+%H_%M_%S"`
Oleksii Zhurba33671b62019-02-21 17:55:22 -060030 # default tempest version is 18.0.0 now, unless
Oleksii Zhurbad85b0022018-09-11 15:43:43 -050031 # it is explicitly defined in pipelines
32 if [ "$tempest_version" == "" ]; then
Oleksii Zhurba33671b62019-02-21 17:55:22 -060033 tempest_version='18.0.0'
Oleksii Zhurbad85b0022018-09-11 15:43:43 -050034 fi
Oleksii Zhurba991dbc62018-07-25 16:03:51 -050035 if [ "$PROXY" == "offline" ]; then
Oleksii Zhurbac8058d62018-06-21 17:46:11 -050036 rally verify create-verifier --name tempest_verifier_$sub_name --type tempest --source $TEMPEST_REPO --system-wide --version $tempest_version
Oleksii Zhurba33671b62019-02-21 17:55:22 -060037 #rally verify add-verifier-ext --source /var/lib/telemetry-tempest-plugin
Oleksii Zhurba991dbc62018-07-25 16:03:51 -050038 rally verify add-verifier-ext --source /var/lib/heat-tempest-plugin
Oleksii Zhurbac8058d62018-06-21 17:46:11 -050039 else
40 if [ -n "${PROXY}" ]; then
41 export https_proxy=$PROXY
42 fi
Oleksii Zhurbaaf3e5e82018-11-12 12:29:31 -060043 apt-get update; apt-get install -y iputils-ping curl wget
Oleksii Zhurbac8058d62018-06-21 17:46:11 -050044 rally verify create-verifier --name tempest_verifier_$sub_name --type tempest --source $TEMPEST_REPO --version $tempest_version
Oleksii Zhurba33671b62019-02-21 17:55:22 -060045 #rally verify add-verifier-ext --version 7a4bff728fbd8629ec211669264ab645aa921e2b --source https://github.com/openstack/telemetry-tempest-plugin
46 rally verify add-verifier-ext --version 0.2.0 --source https://github.com/openstack/heat-tempest-plugin
Oleksii Zhurba8b76f3d2018-08-07 12:38:26 -050047 pip install --force-reinstall python-cinderclient==3.2.0
Oleksii Zhurbac8058d62018-06-21 17:46:11 -050048 unset https_proxy
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060049 fi
Oleksii Zhurba991dbc62018-07-25 16:03:51 -050050 # supress tempest.conf display in console
51 #rally verify configure-verifier --show
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060052}
53
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060054quick_configuration () {
55current_path=$(pwd)
Oleksii Zhurba4a480a32018-07-31 22:21:47 -050056# Remove this if you use local gerrit cvp-configuration repo
57if [ "$PROXY" == "offline" ]; then
58 current_path=/var/lib
59fi
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060060#image
Oleksii Zhurbafe6b5712018-06-14 13:05:00 -050061glance image-list | grep "\btestvm\b" 2>&1 >/dev/null || {
Oleksii Zhurba4a480a32018-07-31 22:21:47 -050062 if [ -n "${PROXY}" ] && [ "$PROXY" -ne "offline" ]; then
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060063 export http_proxy=$PROXY
64 fi
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060065 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 -060066 unset http_proxy
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060067 echo "MD5 should be ee1eca47dc88f4879d8a229cc70a07c6"
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060068 md5sum $current_path/cvp-configuration/cirros-0.3.4-x86_64-disk.img
Oleksii Zhurbafe6b5712018-06-14 13:05:00 -050069 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 -060070}
Oleksii Zhurbafe6b5712018-06-14 13:05:00 -050071IMAGE_REF2=$(glance image-list | grep 'testvm' | awk '{print $2}')
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060072#flavor for rally
73nova flavor-list | grep tiny 2>&1 >/dev/null || {
74 echo "Let's create m1.tiny flavor"
75 nova flavor-create --is-public true m1.tiny auto 128 1 1
76}
77#shared fixed network
78shared_count=`neutron net-list -c name -c shared | grep True | wc -l`
79if [ $shared_count -gt 1 ]; then
80 echo "TOO MANY SHARED NETWORKS! Script will choose just 1 random"
81fi
82if [ $shared_count -eq 0 ]; then
83 echo "Let's create shared fixed net"
Oleksii Zhurbaa2770002018-08-07 11:25:56 -050084 neutron net-create --shared fixed-net
85 neutron subnet-create --name fixed-subnet --gateway 192.168.0.1 --allocation-pool start=192.168.0.2,end=192.168.0.254 --ip-version 4 fixed-net 192.168.0.0/24
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060086fi
87FIXED_NET=$(neutron net-list -c name -c shared | grep True | awk '{print $2}' | tail -n 1)
88echo "Fixed net is: $FIXED_NET"
89#Updating of tempest_full.conf file is skipped/deprecated
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060090sed -i 's/${IMAGE_REF2}/'$IMAGE_REF2'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060091sed -i 's/${FIXED_NET}/'$FIXED_NET'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurba080efa22018-11-12 13:05:44 -060092sed -i 's/${OS_USERNAME}/'$OS_USERNAME'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
93sed -i 's/${OS_TENANT_NAME}/'$OS_TENANT_NAME'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
94sed -i 's/${OS_REGION_NAME}/'$OS_REGION_NAME'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
95sed -i 's|${OS_AUTH_URL}|'"${OS_AUTH_URL}"'|g' $current_path/cvp-configuration/tempest/tempest_ext.conf
96sed -i 's|${OS_PASSWORD}|'"${OS_PASSWORD}"'|g' $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060097sed -i 's/publicURL/'$TEMPEST_ENDPOINT_TYPE'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurba991dbc62018-07-25 16:03:51 -050098#supress tempest.conf display in console
99#cat $current_path/cvp-configuration/tempest/tempest_ext.conf
100cp $current_path/cvp-configuration/tempest/boot_config_none_env.yaml /home/rally/boot_config_none_env.yaml
Oleksii Zhurbab9133f72017-11-15 17:53:02 -0600101}
102
Oleksii Zhurbaba5883f2018-01-18 09:52:08 -0600103if [ "$1" == "reconfigure" ]; then
104 echo "This is reconfiguration"
105 rally verify configure-verifier --reconfigure
Oleksii Zhurbac8058d62018-06-21 17:46:11 -0500106 rally verify configure-verifier --extend $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurbaba5883f2018-01-18 09:52:08 -0600107 rally verify configure-verifier --show
108 exit 0
109fi
110
Oleksii Zhurba1580fc52017-11-14 15:20:44 -0600111check_variables
112rally_configuration
Oleksii Zhurba0aa46702018-02-07 16:17:39 -0600113if [ -n "${TEMPEST_REPO}" ]; then
Oleksii Zhurba1580fc52017-11-14 15:20:44 -0600114 tempest_configuration
Oleksii Zhurbab9133f72017-11-15 17:53:02 -0600115 quick_configuration
Oleksii Zhurba33671b62019-02-21 17:55:22 -0600116 # If you do not have fip network, use this command
117 #cat $current_path/cvp-configuration/tempest/skip-list-fip-only.yaml >> $current_path/cvp-configuration/tempest/skip-list-queens.yaml
Oleksii Zhurbaca050172018-07-30 11:53:32 -0500118 # If Opencontrail is deployed, use this command
Oleksii Zhurba33671b62019-02-21 17:55:22 -0600119 #cat $current_path/cvp-configuration/tempest/skip-list-oc4.yaml >> $current_path/cvp-configuration/tempest/skip-list-queens.yaml
120 cat $current_path/cvp-configuration/tempest/skip-list-heat.yaml >> $current_path/cvp-configuration/tempest/skip-list-queens.yaml
Oleksii Zhurbac8058d62018-06-21 17:46:11 -0500121 rally verify configure-verifier --extend $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurba991dbc62018-07-25 16:03:51 -0500122 rally verify configure-verifier --show
Oleksii Zhurbaca050172018-07-30 11:53:32 -0500123 # If Barbican tempest plugin is installed, use this
Oleksii Zhurba33671b62019-02-21 17:55:22 -0600124 #mkdir /etc/tempest
125 #rally verify configure-verifier --show | grep -v "rally.api" > /etc/tempest/tempest.conf
Oleksii Zhurba7f3941b2018-03-27 14:38:42 -0500126 # Add 2 additional tempest tests (live migration to all nodes + ssh to all nodes)
127 # TBD
128 #cat tempest/test_extension.py >> repo/tempest/scenario/test_server_multinode.py
Oleksii Zhurba1580fc52017-11-14 15:20:44 -0600129fi
130set -e
131
Oleksii Zhurbac8058d62018-06-21 17:46:11 -0500132echo "Configuration is done!"