This patch includes scripts to create multiple yaml file for different
[kvmfornfv.git] / ci / envs / cyclictest.sh
1 #!/bin/bash
2
3 ###########################################################
4 ## Invoking this script from ubuntu docker container runs
5 ## cyclictest through yardstick
6 ###########################################################
7 source utils.sh
8
9 testType=$1 #daily/verify/merge
10 testName=$2 #idle_idle/stress_idle
11 HOST_IP=$( getHostIP )
12 pod_config='/opt/scripts/pod.yaml'
13 cyclictest_context_file='/opt/kvmfornfv_cyclictest_'${testName}'.yaml'
14
15 if [ ! -f ${pod_config} ] ; then
16     echo "file ${pod_config} not found"
17     exit 1
18 fi
19
20 if [ ! -f ${cyclictest_context_file} ] ; then
21     echo "file ${cyclictest_context_file} not found"
22     exit 1
23 fi
24
25 #setting up of image for launching guest vm.
26 ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
27 root@$HOST_IP "cp /root/images/guest1.qcow2 /root/"
28
29 #Updating the yardstick.conf file for daily
30 function updateConfDaily() {
31    DISPATCHER_TYPE=influxdb
32    DISPATCHER_FILE_NAME="/tmp/yardstick.out"
33    # Use the influxDB on the jumping server
34    DISPATCHER_INFLUXDB_TARGET="http://104.197.68.199:8086"
35    mkdir -p /etc/yardstick
36    cat << EOF > /etc/yardstick/yardstick.conf
37 [DEFAULT]
38 debug = True
39 dispatcher = ${DISPATCHER_TYPE}
40
41 [dispatcher_file]
42 file_name = ${DISPATCHER_FILE_NAME}
43
44 [dispatcher_influxdb]
45 timeout = 5
46 db_name = yardstick
47 username = opnfv
48 password = 0pnfv2015
49 target = ${DISPATCHER_INFLUXDB_TARGET}
50 EOF
51 }
52
53 #Function call to update yardstick conf file based on Job type
54 if [ "$testType" == "daily" ];then
55    updateConfDaily
56 fi
57
58 #Running cyclictest through yardstick
59 yardstick -d task start ${cyclictest_context_file}
60 output=$?
61
62 if [ "$testType" == "verify" ];then
63    chmod 777 /tmp/yardstick.out
64    cat /tmp/yardstick.out  > /opt/yardstick.out
65 fi
66
67 if [ $output != 0 ];then
68    echo "Yardstick Failed !!!"
69    exit 1
70 fi