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 # check and print testcase execution status
53 # $1 - directory with results
54 function print_results() {
55 for i in $TESTCASES ; do
56 if [[ $i == *"pvp"* ]]; then
58 elif [[ $i == *"pvvp"* ]]; then
63 RES_FILE="result_${i}_${DEPLOYMENT}.csv"
65 if [ -e "${1}/${RES_FILE}" ]; then
66 printf " %-70s %-6s\n" $RES_FILE "OK"
68 printf " %-70s %-6s\n" $RES_FILE "FAILED"
74 # execute tests and display results
76 # $1 - vswitch and vnf combination, one of OVS_vanilla, OVS_with_DPDK_and_vHost_Cuse, OVS_with_DPDK_and_vHost_User
77 # $2 - CI job type, one of verify, merge, daily
78 function execute_vsperf() {
79 # figure out log file name
80 LOG_FILE="${LOG_FILE_PREFIX}"`date "+%Y%m%d_%H%M%S%N"`".log"
82 # figure out list of TCs and execution parameters
85 TESTPARAM=$TESTPARAM_VERIFY
86 TESTCASES=$TESTCASES_VERIFY
89 TESTPARAM=$TESTPARAM_MERGE
90 TESTCASES=$TESTCASES_MERGE
93 # by default use daily build
94 TESTPARAM=$TESTPARAM_DAILY
95 TESTCASES=$TESTCASES_DAILY
100 echo -e "\nExecution of VSPERF for $1"
101 # vsperf must be executed directly from vsperf directory
105 echo "$VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsVanilla --vnf QemuVirtioNet $CONF_FILE $TESTPARAM $TESTCASES &> $LOG_FILE"
106 $VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsVanilla --vnf QemuVirtioNet $CONF_FILE $TESTPARAM $TESTCASES &> $LOG_FILE
108 "OVS_with_DPDK_and_vHost_Cuse")
109 echo "$VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsDpdkVhost --vnf QemuDpdkVhostCuse $CONF_FILE $TESTPARAM $TESTCASES &> $LOG_FILE"
110 $VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsDpdkVhost --vnf QemuDpdkVhostCuse $CONF_FILE $TESTPARAM $TESTCASES &> $LOG_FILE
113 echo "$VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES > $LOG_FILE"
114 $VSPERF_BIN --opnfvpod="$OPNFV_POD" --vswitch OvsVanilla --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES &> $LOG_FILE
117 # let's go back to CI dir
120 # evaluation of results
121 echo -e "\nResults for $1"
122 RES_DIR=`grep "Creating result directory" $LOG_FILE | cut -d'/' -f2-`
123 if [ "x" == "x${RES_DIR}" ] ; then
124 echo "FAILURE: Results are not available."
126 print_results "/${RES_DIR}"
134 # execute job based on passed parameter
137 echo "VSPERF verify job"
138 echo "================="
140 #execute_vsperf OVS_with_DPDK_and_vHost_User $1
145 echo "VSPERF merge job"
146 echo "================"
148 #execute_vsperf OVS_with_DPDK_and_vHost_User $1
153 echo "VSPERF daily job"
154 echo "================"
156 execute_vsperf OVS_with_DPDK_and_vHost_User $1
157 execute_vsperf OVS_vanilla $1