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
68 #Update pod.yaml with IP
70 sed -ri "s/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/${HOST_IP}/" pod.yaml
71 #Cleaning the environment before running Livemigration through yardstick
73 #Waiting for ssh to be available for the host machine
75 if runLiveMigration ${test_env} ${test_name};then
76 livemigration_result=`expr ${livemigration_result} + 0`
78 echo "live migration test case failed"
79 livemigration_result=`expr ${livemigration_result} + 1`
82 echo "Incorrect test environment for live migration"
87 function getTestParams {
88 HOST_IP=$( setHostIP $test_type )
89 test_time=$( setTestTime $test_type )
95 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP $test_time $test_type $test_case
96 #Verifying whether the test node is up and running
98 #Waiting for ssh to be available for the host machine.
100 #calculating and verifying sha512sum of the guestimage.
101 if ! verifyGuestImage;then
104 #Update kvmfornfv_cyclictest_${testName}.yaml with test_time and pod.yaml with IP
107 collect_MBWInfo $test_type
108 #Cleaning the environment before running cyclictest through yardstick
110 #Creating a docker image with yardstick installed and launching ubuntu docker to run yardstick cyclic testcase
111 if runCyclicTest ${ftrace_enable} ${test_name};then
112 cyclictest_result=`expr ${cyclictest_result} + 0`
114 echo "Test case execution FAILED for ${test_case} environment"
115 cyclictest_result=`expr ${cyclictest_result} + 1`
117 echo "Terminating PCM Process"
118 sudo ssh root@${HOST_IP} "pid=\$(ps aux | grep 'pcm' | awk '{print \$2}' | head -1); echo \$pid |xargs kill -SIGTERM"
120 #Collecting the Memory Bandwidth Information using pcm-memory utility
121 function collect_MBWInfo {
123 timeStamp=$(date +%Y%m%d%H%M%S)
124 echo "Running PCM memory to collect memory bandwidth"
125 sudo ssh root@${HOST_IP} "mkdir -p /root/MBWInfo"
126 sudo ssh root@${HOST_IP} "${pcm_memory} 60 &>/root/MBWInfo/MBWInfo_${testType}_${timeStamp} &disown"
128 function install_pcm {
129 sudo ssh root@${HOST_IP} '
130 modelName=`cat /proc/cpuinfo | grep -i "model name" | uniq`
131 if echo "$modelName" | grep -i "xeon" ;then
132 echo "pcm utility supports $modelName processor"
134 echo "check for the pcm utility supported processors"
138 if [ ! -d "pcm" ]; then
139 `git clone https://github.com/opcm/pcm`
142 echo "Disabling NMI Watchdog"
143 echo 0 > /proc/sys/kernel/nmi_watchdog
144 echo "To Access MSR registers installing msr-tools"
145 sudo yum install msr-tools
151 #Execution of testcases based on test type and test name from releng.
152 if [ ${test_type} == "verify" ];then
155 if [ ${ftrace_enable} -eq '1' ]; then
156 for env in ${cyclictest_env_verify[@]}
158 #Enabling ftrace for kernel debugging.
159 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' $WORKSPACE/tests/kvmfornfv_cyclictest_hostenv_guestenv.yaml
160 #Executing cyclictest through yardstick.
164 #Execution of packet forwarding test cases.
167 for env in ${cyclictest_env_verify[@]}
169 #Executing cyclictest through yardstick.
173 #Execution of packet forwarding test cases.
175 for envi in ${lm_env_verify[@]}
177 echo "Executing Live Migration on the node"
178 liveMigration ${envi}
181 if [ ${cyclictest_result} -ne 0 ] || [ ${packetforward_result} -ne 0 ] || [ ${livemigration_result} -ne 0 ];then
182 echo "Test case FAILED"
187 elif [ ${test_type} == "daily" ];then
190 if [ ${test_name} == "packet_forward" ];then
193 #clean the test environment after the test case execution.
194 sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
196 if [ ${packetforward_result} -ne 0 ] ; then
197 echo "Execution of packet forwarding test cases FAILED"
200 echo "Executed packet forwarding test cases SUCCESSFULLY"
203 elif [ ${test_name} == "cyclictest" ];then
204 if [ ${ftrace_enable} -eq '1' ]; then
205 for env in ${cyclictest_env_daily[@]}
207 #Enabling ftrace for kernel debugging.
208 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' kvmfornfv_cyclictest_hostenv_guestenv.yaml
209 #Executing cyclictest through yardstick.
211 #disabling ftrace and collecting the logs to upload to artifact repository.
216 for env in ${cyclictest_env_daily[@]}
218 #Executing cyclictest through yardstick.
223 if [ ${cyclictest_result} -ne 0 ] ; then
224 echo "Cyclictest case execution FAILED"
227 echo "Cyclictest case executed SUCCESSFULLY"
230 elif [ ${test_name} == "livemigration" ];then
231 for envi in ${lm_env_verify[@]}
233 echo "Executing Live Migration on the node"
234 liveMigration ${envi}
236 sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
238 if [ ${livemigration_result} -ne 0 ] ; then
239 echo "livemigration test case execution FAILED"
242 echo "livemigration test case executed SUCCESSFULLY"
246 elif [ ${test_type} == "merge" ];then
247 echo "Test is not enabled for ${test_type}"
250 echo "Incorrect test type ${test_type}"