blob: 15059e19d919c00b7d0195c751f8fb43d85b57f2 [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 Zhurba22737902018-02-07 14:09:47 -060022 rally_version=$(rally version 2>&1)
Oleksii Zhurbac8058d62018-06-21 17:46:11 -050023 # will be removed when we switch to Rally 0.9.2+
Oleksii Zhurba22737902018-02-07 14:09:47 -060024 if [ "$rally_version" == "0.9.0" ] || [ "$rally_version" == "0.9.1" ]; then
25 pip install ansible==2.3.2.0
Oleksii Zhurba167f4652018-03-29 16:43:41 -050026 sed -i '270s/,/}#,/g' /usr/local/lib/python2.7/dist-packages/rally/plugins/openstack/wrappers/network.py
Oleksii Zhurba22737902018-02-07 14:09:47 -060027 fi
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060028 sub_name=`date "+%H_%M_%S"`
29 rally deployment create --fromenv --name=tempest_$sub_name
30 rally deployment config
31}
32
33tempest_configuration () {
34 sub_name=`date "+%H_%M_%S"`
Oleksii Zhurba991dbc62018-07-25 16:03:51 -050035 # default tempest version is now 17.2.0
36 tempest_version='17.2.0'
37 if [ "$PROXY" == "offline" ]; then
Oleksii Zhurbac8058d62018-06-21 17:46:11 -050038 rally verify create-verifier --name tempest_verifier_$sub_name --type tempest --source $TEMPEST_REPO --system-wide --version $tempest_version
Oleksii Zhurba991dbc62018-07-25 16:03:51 -050039 rally verify add-verifier-ext --source /var/lib/telemetry-tempest-plugin
40 rally verify add-verifier-ext --source /var/lib/heat-tempest-plugin
Oleksii Zhurbac8058d62018-06-21 17:46:11 -050041 else
42 if [ -n "${PROXY}" ]; then
43 export https_proxy=$PROXY
44 fi
45 rally verify create-verifier --name tempest_verifier_$sub_name --type tempest --source $TEMPEST_REPO --version $tempest_version
Oleksii Zhurba991dbc62018-07-25 16:03:51 -050046 rally verify add-verifier-ext --source https://github.com/openstack/telemetry-tempest-plugin
47 rally verify add-verifier-ext --source https://github.com/openstack/heat-tempest-plugin
Oleksii Zhurba8b76f3d2018-08-07 12:38:26 -050048 pip install --force-reinstall python-cinderclient==3.2.0
Oleksii Zhurbac8058d62018-06-21 17:46:11 -050049 unset https_proxy
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060050 fi
Oleksii Zhurba991dbc62018-07-25 16:03:51 -050051 # supress tempest.conf display in console
52 #rally verify configure-verifier --show
Oleksii Zhurba1580fc52017-11-14 15:20:44 -060053}
54
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060055quick_configuration () {
56current_path=$(pwd)
Oleksii Zhurba4a480a32018-07-31 22:21:47 -050057# Remove this if you use local gerrit cvp-configuration repo
58if [ "$PROXY" == "offline" ]; then
59 current_path=/var/lib
60fi
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060061#image
Oleksii Zhurbafe6b5712018-06-14 13:05:00 -050062glance image-list | grep "\btestvm\b" 2>&1 >/dev/null || {
Oleksii Zhurba4a480a32018-07-31 22:21:47 -050063 if [ -n "${PROXY}" ] && [ "$PROXY" -ne "offline" ]; then
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060064 export http_proxy=$PROXY
65 fi
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060066 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 -060067 unset http_proxy
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060068 echo "MD5 should be ee1eca47dc88f4879d8a229cc70a07c6"
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060069 md5sum $current_path/cvp-configuration/cirros-0.3.4-x86_64-disk.img
Oleksii Zhurbafe6b5712018-06-14 13:05:00 -050070 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 -060071}
Oleksii Zhurbafe6b5712018-06-14 13:05:00 -050072IMAGE_REF2=$(glance image-list | grep 'testvm' | awk '{print $2}')
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060073#flavor for rally
74nova flavor-list | grep tiny 2>&1 >/dev/null || {
75 echo "Let's create m1.tiny flavor"
76 nova flavor-create --is-public true m1.tiny auto 128 1 1
77}
78#shared fixed network
79shared_count=`neutron net-list -c name -c shared | grep True | wc -l`
80if [ $shared_count -gt 1 ]; then
81 echo "TOO MANY SHARED NETWORKS! Script will choose just 1 random"
82fi
83if [ $shared_count -eq 0 ]; then
84 echo "Let's create shared fixed net"
Oleksii Zhurbaa2770002018-08-07 11:25:56 -050085 neutron net-create --shared fixed-net
86 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 -060087fi
88FIXED_NET=$(neutron net-list -c name -c shared | grep True | awk '{print $2}' | tail -n 1)
89echo "Fixed net is: $FIXED_NET"
90#Updating of tempest_full.conf file is skipped/deprecated
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060091sed -i 's/${IMAGE_REF2}/'$IMAGE_REF2'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurba0aa46702018-02-07 16:17:39 -060092sed -i 's/${FIXED_NET}/'$FIXED_NET'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060093sed -i 's/publicURL/'$TEMPEST_ENDPOINT_TYPE'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurba991dbc62018-07-25 16:03:51 -050094#supress tempest.conf display in console
95#cat $current_path/cvp-configuration/tempest/tempest_ext.conf
96cp $current_path/cvp-configuration/tempest/boot_config_none_env.yaml /home/rally/boot_config_none_env.yaml
Oleksii Zhurbab9133f72017-11-15 17:53:02 -060097}
98
Oleksii Zhurbaba5883f2018-01-18 09:52:08 -060099if [ "$1" == "reconfigure" ]; then
100 echo "This is reconfiguration"
101 rally verify configure-verifier --reconfigure
Oleksii Zhurbac8058d62018-06-21 17:46:11 -0500102 rally verify configure-verifier --extend $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurbaba5883f2018-01-18 09:52:08 -0600103 rally verify configure-verifier --show
104 exit 0
105fi
106
Oleksii Zhurba1580fc52017-11-14 15:20:44 -0600107check_variables
108rally_configuration
Oleksii Zhurba0aa46702018-02-07 16:17:39 -0600109if [ -n "${TEMPEST_REPO}" ]; then
Oleksii Zhurba1580fc52017-11-14 15:20:44 -0600110 tempest_configuration
Oleksii Zhurbab9133f72017-11-15 17:53:02 -0600111 quick_configuration
Oleksii Zhurbaca050172018-07-30 11:53:32 -0500112 # If Opencontrail is deployed, use this command
113 #cat $current_path/cvp-configuration/tempest/skip-list-oc4.yaml >> $current_path/cvp-configuration/tempest/skip-list-pike.yaml
Oleksii Zhurbac8058d62018-06-21 17:46:11 -0500114 rally verify configure-verifier --extend $current_path/cvp-configuration/tempest/tempest_ext.conf
Oleksii Zhurba991dbc62018-07-25 16:03:51 -0500115 rally verify configure-verifier --show
Oleksii Zhurbaca050172018-07-30 11:53:32 -0500116 # If Barbican tempest plugin is installed, use this
117 # mkdir /etc/tempest
Oleksii Zhurba12f311e2018-07-31 21:21:20 -0500118 # rally verify configure-verifier --show | grep -v "rally.api" > /etc/tempest/tempest.conf
Oleksii Zhurba7f3941b2018-03-27 14:38:42 -0500119 # Add 2 additional tempest tests (live migration to all nodes + ssh to all nodes)
120 # TBD
121 #cat tempest/test_extension.py >> repo/tempest/scenario/test_server_multinode.py
Oleksii Zhurba1580fc52017-11-14 15:20:44 -0600122fi
123set -e
124
Oleksii Zhurbac8058d62018-06-21 17:46:11 -0500125echo "Configuration is done!"