3 ############################################################
4 ## This script is an interface to trigger the
5 ## cyclicTestTrigger.sh for test type like patch verification,
7 ## Releng will trigger this script by passing test type as
8 ## verify/daily and test name as idle_idle/stress_idle/
9 ## packet_forward as arguments.
10 ## Verify Job runs idle_idle,packet_forward test
11 ## daily job runs base on the test name parameter
12 ############################################################
17 cyclictest_env_verify=("idle_idle" "memorystress_idle") #cyclictest environment
18 cyclictest_env_daily=("idle_idle" "cpustress_idle" "memorystress_idle" "iostress_idle")
19 cyclictest_result=0 #exit code of cyclictest
20 packetforward_result=0 #exit code of packet forward
21 lm_env_verify=("peer-peer" "local")
22 source $WORKSPACE/ci/envs/host-config
24 #check if any kernel rpms available for testing
25 rpm_count=`ls -1 $WORKSPACE/build_output/*.rpm 2>/dev/null | wc -l`
26 if [ $rpm_count = 0 ];then
27 echo "This patch is used for building kernel debian packages required by compass installer and \
28 the test environment for testing debain packages is not available"
32 function packetForward {
33 #executing packet forwarding test cases based on the job type.
34 if [ ${test_type} == "verify" ];then
35 echo "packet forwarding test cases are not yet implemented for verify job"
36 packetforward_result=0
37 elif [ ${test_type} == "daily" ];then
38 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP
40 #Waiting for ssh to be available for the host machine.
42 # copy files and rpms and setup environment required for executing test cases
45 #Verifying whether the test node is up and running
48 #Install and Execute packet forwarding test cases
49 runPacketForwarding $test_type
50 packetforward_result=$?
52 echo "Incorrect test type ${test_type}"
56 function liveMigration {
57 #executing live migration test case on the host machine
59 echo "Test Environment ${test_env}"
60 if [ ${test_env} == "peer-peer" ];then
61 echo "live migration is not implemented for peer to peer"
62 livemigration_result=0
63 elif [ ${test_env} == "local" ];then
64 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP
66 #Waiting for ssh to be available for the host machine.
68 runLiveMigration ${test_env}
69 livemigration_result=$?
71 echo "Incorrect test environment for live migration"
76 function getTestParams {
77 HOST_IP=$( setHostIP $test_type )
78 test_time=$( setTestTime $test_type )
83 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP $test_time $test_type $test_case
84 #Verifying whether the test node is up and running
86 #Waiting for ssh to be available for the host machine.
88 #calculating and verifying sha512sum of the guestimage.
89 if ! verifyGuestImage;then
92 #Update kvmfornfv_cyclictest_${testName}.yaml with test_time and pod.yaml with IP
95 collect_MBWInfo $test_type
96 #Cleaning the environment before running cyclictest through yardstick
98 #Creating a docker image with yardstick installed and launching ubuntu docker to run yardstick cyclic testcase
99 if runCyclicTest ${ftrace_enable};then
100 cyclictest_result=`expr ${cyclictest_result} + 0`
102 echo "Test case execution FAILED for ${test_case} environment"
103 cyclictest_result=`expr ${cyclictest_result} + 1`
105 echo "Terminating PCM Process"
106 sudo ssh root@${HOST_IP} "pid=\$(ps aux | grep 'pcm' | awk '{print \$2}' | head -1); echo \$pid |xargs kill -SIGTERM"
108 #Collecting the Memory Bandwidth Information using pcm-memory utility
109 function collect_MBWInfo {
111 timeStamp=$(date +%Y%m%d%H%M%S)
112 echo "Running PCM memory to collect memory bandwidth"
113 sudo ssh root@${HOST_IP} "mkdir -p /root/MBWInfo"
114 sudo ssh root@${HOST_IP} "${pcm_memory} 60 &>/root/MBWInfo/MBWInfo_${testType}_${timeStamp} &disown"
116 function install_pcm {
117 sudo ssh root@${HOST_IP} '
118 modelName=`cat /proc/cpuinfo | grep -i "model name" | uniq`
119 if echo "$modelName" | grep -i "xeon" ;then
120 echo "pcm utility supports $modelName processor"
122 echo "check for the pcm utility supported processors"
126 if [ ! -d "pcm" ]; then
127 `git clone https://github.com/opcm/pcm`
130 echo "Disabling NMI Watchdog"
131 echo 0 > /proc/sys/kernel/nmi_watchdog
132 echo "To Access MSR registers installing msr-tools"
133 sudo yum install msr-tools
139 #Execution of testcases based on test type and test name from releng.
140 if [ ${test_type} == "verify" ];then
143 if [ ${ftrace_enable} -eq '1' ]; then
144 for env in ${cyclictest_env_verify[@]}
146 #Enabling ftrace for kernel debugging.
147 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' $WORKSPACE/tests/kvmfornfv_cyclictest_hostenv_guestenv.yaml
148 #Executing cyclictest through yardstick.
152 #Execution of packet forwarding test cases.
155 for env in ${cyclictest_env_verify[@]}
157 #Executing cyclictest through yardstick.
161 #Execution of packet forwarding test cases.
163 for envi in ${lm_env_verify[@]}
165 echo "Executing Live Migration on the node"
166 liveMigration ${envi}
169 if [ ${cyclictest_result} -ne 0 ] || [ ${packetforward_result} -ne 0 ];then
170 echo "Test case FAILED"
175 elif [ ${test_type} == "daily" ];then
176 echo "Daily job test cases execution disabled temporarily"
180 if [ ${test_name} == "packet_forward" ];then
183 #clean the test environment after the test case execution.
184 sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
186 if [ ${packetforward_result} -ne 0 ] ; then
187 echo "Execution of packet forwarding test cases FAILED"
190 echo "Executed packet forwarding test cases SUCCESSFULLY"
193 elif [ ${test_name} == "cyclictest" ];then
194 if [ ${ftrace_enable} -eq '1' ]; then
195 for env in ${cyclictest_env_daily[@]}
197 #Enabling ftrace for kernel debugging.
198 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' kvmfornfv_cyclictest_hostenv_guestenv.yaml
199 #Executing cyclictest through yardstick.
201 #disabling ftrace and collecting the logs to upload to artifact repository.
206 for env in ${cyclictest_env_daily[@]}
208 #Executing cyclictest through yardstick.
213 if [ ${cyclictest_result} -ne 0 ] ; then
214 echo "Cyclictest case execution FAILED"
217 echo "Cyclictest case executed SUCCESSFULLY"
220 elif [ ${test_name} == "livemigration" ];then
221 for envi in ${lm_env_verify[@]}
223 echo "Executing Live Migration on the node"
224 liveMigration ${envi}
226 sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
228 if [ ${livemigration_result} -ne 0 ] ; then
229 echo "livemigration test case execution FAILED"
232 echo "livemigration test case executed SUCCESSFULLY"
236 elif [ ${test_type} == "merge" ];then
237 echo "Test is not enabled for ${test_type}"
240 echo "Incorrect test type ${test_type}"