3 # Copyright 2015 Intel Corporation.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # VSPERF nightly build execution script
20 # build-vsperf.sh job_type
21 # where job_type is one of "verify", "merge", "daily"
29 LOG_FILE_USER='/tmp/vsperf_user.log'
30 LOG_FILE_VANILLA='/tmp/vsperf_vanilla.log'
31 LOG_FILE_PREFIX="/tmp/vsperf_build_"
32 OPNFV_POD="intel-pod3"
34 # CI job specific configuration
35 # VERIFY - run basic set of TCs with default settings
36 TESTCASES_VERIFY="phy2phy_tput pvp_tput"
38 # MERGE - run selected TCs with default settings
39 TESTCASES_MERGE="phy2phy_tput back2back phy2phy_cont pvp_tput pvvp_tput"
41 # DAILY - run selected TCs for defined packet sizes
42 TESTCASES_DAILY='phy2phy_tput back2back phy2phy_tput_mod_vlan phy2phy_scalability pvp_tput pvp_back2back pvvp_tput pvvp_back2back'
43 TESTPARAM_DAILY='--test-params pkt_sizes=64,128,512,1024,1518'
44 # check if user config file exists if not then we will use default settings
45 [ -f $HOME/vsperf.conf ] && CONF_FILE="--conf-file ${HOME}/vsperf.conf" || CONF_FILE=""
51 # terminate vsperf and all its utilities
52 # it is expected that vsperf is the only python3 app
53 # and no other ovs or qemu instances are running
57 function terminate_vsperf() {
58 sudo pkill stress &> /dev/null
59 sudo pkill python3 &> /dev/null
60 sudo killall -9 qemu-system-x86_64 &> /dev/null
62 # sometimes qemu resists to terminate, so wait a bit and kill it again
63 if pgrep qemu-system-x86_64 &> /dev/null ; then
65 sudo killall -9 qemu-system-x86_64 &> /dev/null
69 sudo pkill ovs-vswitchd &> /dev/null
71 sudo pkill ovsdb-server &> /dev/null
75 # check and print testcase execution status
77 # $1 - directory with results
78 function print_results() {
79 for i in $TESTCASES ; do
80 if [[ $i == *"pvp"* ]]; then
82 elif [[ $i == *"pvvp"* ]]; then
87 RES_FILE="result_${i}_${DEPLOYMENT}.csv"
89 if [ -e "${1}/${RES_FILE}" ]; then
90 printf " %-70s %-6s\n" $RES_FILE "OK"
92 printf " %-70s %-6s\n" $RES_FILE "FAILED"
98 # execute tests and display results
100 # $1 - vswitch and vnf combination, one of OVS_vanilla, OVS_with_DPDK_and_vHost_Cuse, OVS_with_DPDK_and_vHost_User
101 # $2 - CI job type, one of verify, merge, daily
102 function execute_vsperf() {
103 # figure out log file name
104 LOG_FILE="${LOG_FILE_PREFIX}"`date "+%Y%m%d_%H%M%S%N"`".log"
106 # figure out list of TCs and execution parameters
109 TESTPARAM=$TESTPARAM_VERIFY
110 TESTCASES=$TESTCASES_VERIFY
113 TESTPARAM=$TESTPARAM_MERGE
114 TESTCASES=$TESTCASES_MERGE
117 # by default use daily build
118 TESTPARAM=$TESTPARAM_DAILY
119 TESTCASES=$TESTCASES_DAILY
124 echo -e "\nExecution of VSPERF for $1"
125 # vsperf must be executed directly from vsperf directory
129 echo "$VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsVanilla --vnf QemuVirtioNet $CONF_FILE $TESTPARAM $TESTCASES &> $LOG_FILE"
130 $VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsVanilla --vnf QemuVirtioNet $CONF_FILE $TESTPARAM $TESTCASES &> $LOG_FILE
132 "OVS_with_DPDK_and_vHost_Cuse")
133 echo "$VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsDpdkVhost --vnf QemuDpdkVhostCuse $CONF_FILE $TESTPARAM $TESTCASES &> $LOG_FILE"
134 $VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsDpdkVhost --vnf QemuDpdkVhostCuse $CONF_FILE $TESTPARAM $TESTCASES &> $LOG_FILE
137 echo "$VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES > $LOG_FILE"
138 $VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES &> $LOG_FILE
141 # let's go back to CI dir
144 # evaluation of results
145 echo -e "\nResults for $1"
146 RES_DIR=`grep "Creating result directory" $LOG_FILE | cut -d'/' -f2-`
147 if [ "x" == "x${RES_DIR}" ] ; then
148 echo "FAILURE: Results are not available."
150 print_results "/${RES_DIR}"
153 # show detailed result figures
154 for md_file in $(grep '\.md"$' $LOG_FILE | cut -d'"' -f2); do
155 # TC resut file header
156 echo -e "\n-------------------------------------------------------------------"
158 echo -e "-------------------------------------------------------------------\n"
160 sed -n '/^- Test ID/,/Bidirectional/{/Packet size/b;p;/Bidirectional/q};/Results\/Metrics Collected/,/Statistics collected/{/^$/p;/^|/p}' $md_file
162 sed -n '/Results\/Metrics Collected/,/Statistics collected/{/^$/p;/^|/p}' $md_file | grep -v "Unknown" | cat -s
170 # execute job based on passed parameter
173 echo "VSPERF verify job"
174 echo "================="
176 #execute_vsperf OVS_with_DPDK_and_vHost_User $1
181 echo "VSPERF merge job"
182 echo "================"
184 #execute_vsperf OVS_with_DPDK_and_vHost_User $1
189 echo "VSPERF daily job"
190 echo "================"
193 execute_vsperf OVS_with_DPDK_and_vHost_User $1
195 execute_vsperf OVS_vanilla $1