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 livemigration_result=0 #exit code of livemigration
23 source $WORKSPACE/ci/envs/host-config
25 #check if any kernel rpms available for testing
26 rpm_count=`ls -1 $WORKSPACE/build_output/*.rpm 2>/dev/null | wc -l`
27 if [ $rpm_count = 0 ];then
28 echo "This patch is used for building kernel debian packages required by compass installer and \
29 the test environment for testing debain packages is not available"
33 function packetForward {
34 #executing packet forwarding test cases based on the job type.
35 if [ ${test_type} == "verify" ];then
36 echo "packet forwarding test cases are not yet implemented for verify job"
37 packetforward_result=0
38 elif [ ${test_type} == "daily" ];then
39 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP
41 #Waiting for ssh to be available for the host machine.
43 # copy files and rpms and setup environment required for executing test cases
46 #Verifying whether the test node is up and running
49 #Install and Execute packet forwarding test cases
50 runPacketForwarding $test_type
51 packetforward_result=$?
53 echo "Incorrect test type ${test_type}"
58 function liveMigration {
59 #executing live migration test case on the host machine
61 test_name=livemigration
62 echo "Test Environment ${test_env}"
63 if [ ${test_env} == "peer-peer" ];then
64 echo "live migration is not implemented for peer to peer"
65 elif [ ${test_env} == "local" ];then
66 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP
69 #Waiting for ssh to be available for the host machine.
71 if runLiveMigration ${test_env} ${test_name};then
72 livemigration_result=`expr ${livemigration_result} + 0`
74 echo "live migration test case failed"
75 livemigration_result=`expr ${livemigration_result} + 1`
78 echo "Incorrect test environment for live migration"
83 function getTestParams {
84 HOST_IP=$( setHostIP $test_type )
85 test_time=$( setTestTime $test_type )
91 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP $test_time $test_type $test_case
92 #Verifying whether the test node is up and running
94 #Waiting for ssh to be available for the host machine.
96 #calculating and verifying sha512sum of the guestimage.
97 if ! verifyGuestImage;then
100 #Update kvmfornfv_cyclictest_${testName}.yaml with test_time and pod.yaml with IP
103 collect_MBWInfo $test_type
104 #Cleaning the environment before running cyclictest through yardstick
106 #Creating a docker image with yardstick installed and launching ubuntu docker to run yardstick cyclic testcase
107 if runCyclicTest ${ftrace_enable} ${test_name};then
108 cyclictest_result=`expr ${cyclictest_result} + 0`
110 echo "Test case execution FAILED for ${test_case} environment"
111 cyclictest_result=`expr ${cyclictest_result} + 1`
113 echo "Terminating PCM Process"
114 sudo ssh root@${HOST_IP} "pid=\$(ps aux | grep 'pcm' | awk '{print \$2}' | head -1); echo \$pid |xargs kill -SIGTERM"
116 #Collecting the Memory Bandwidth Information using pcm-memory utility
117 function collect_MBWInfo {
119 timeStamp=$(date +%Y%m%d%H%M%S)
120 echo "Running PCM memory to collect memory bandwidth"
121 sudo ssh root@${HOST_IP} "mkdir -p /root/MBWInfo"
122 sudo ssh root@${HOST_IP} "${pcm_memory} 60 &>/root/MBWInfo/MBWInfo_${testType}_${timeStamp} &disown"
124 function install_pcm {
125 sudo ssh root@${HOST_IP} '
126 modelName=`cat /proc/cpuinfo | grep -i "model name" | uniq`
127 if echo "$modelName" | grep -i "xeon" ;then
128 echo "pcm utility supports $modelName processor"
130 echo "check for the pcm utility supported processors"
134 if [ ! -d "pcm" ]; then
135 `git clone https://github.com/opcm/pcm`
138 echo "Disabling NMI Watchdog"
139 echo 0 > /proc/sys/kernel/nmi_watchdog
140 echo "To Access MSR registers installing msr-tools"
141 sudo yum install msr-tools
147 #Execution of testcases based on test type and test name from releng.
148 if [ ${test_type} == "verify" ];then
151 if [ ${ftrace_enable} -eq '1' ]; then
152 for env in ${cyclictest_env_verify[@]}
154 #Enabling ftrace for kernel debugging.
155 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' $WORKSPACE/tests/kvmfornfv_cyclictest_hostenv_guestenv.yaml
156 #Executing cyclictest through yardstick.
160 #Execution of packet forwarding test cases.
163 for env in ${cyclictest_env_verify[@]}
165 #Executing cyclictest through yardstick.
169 #Execution of packet forwarding test cases.
171 for envi in ${lm_env_verify[@]}
173 echo "Executing Live Migration on the node"
174 liveMigration ${envi}
177 if [ ${cyclictest_result} -ne 0 ] || [ ${packetforward_result} -ne 0 ] || [ ${livemigration_result} -ne 0 ];then
178 echo "Test case FAILED"
183 elif [ ${test_type} == "daily" ];then
186 if [ ${test_name} == "packet_forward" ];then
189 #clean the test environment after the test case execution.
190 sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
192 if [ ${packetforward_result} -ne 0 ] ; then
193 echo "Execution of packet forwarding test cases FAILED"
196 echo "Executed packet forwarding test cases SUCCESSFULLY"
199 elif [ ${test_name} == "cyclictest" ];then
200 if [ ${ftrace_enable} -eq '1' ]; then
201 for env in ${cyclictest_env_daily[@]}
203 #Enabling ftrace for kernel debugging.
204 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' kvmfornfv_cyclictest_hostenv_guestenv.yaml
205 #Executing cyclictest through yardstick.
207 #disabling ftrace and collecting the logs to upload to artifact repository.
212 for env in ${cyclictest_env_daily[@]}
214 #Executing cyclictest through yardstick.
219 if [ ${cyclictest_result} -ne 0 ] ; then
220 echo "Cyclictest case execution FAILED"
223 echo "Cyclictest case executed SUCCESSFULLY"
226 elif [ ${test_name} == "livemigration" ];then
227 for envi in ${lm_env_verify[@]}
229 echo "Executing Live Migration on the node"
230 liveMigration ${envi}
232 sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
234 if [ ${livemigration_result} -ne 0 ] ; then
235 echo "livemigration test case execution FAILED"
238 echo "livemigration test case executed SUCCESSFULLY"
242 elif [ ${test_type} == "merge" ];then
243 echo "Test is not enabled for ${test_type}"
246 echo "Incorrect test type ${test_type}"