5 VSPERF="${HOME}/vswitchperf"
6 LOG_FILE_PREFIX="/tmp/vsperf_build"
8 DATE=$(date -u +"%Y-%m-%d_%H-%M-%S")
9 VSPERFENV_DIR="$HOME/vsperfenv"
10 TEST_REPORT_LOG_DIR="/tmp/packet_fwd_logs"
14 # DAILY - run selected TCs for defined packet sizes
15 TESTCASES_DAILY='phy2phy_tput phy2phy_tput_mod_vlan pvp_tput'
16 TESTPARAM_DAILY='--test-params TRAFFICGEN_PKT_SIZES=(64,128,512,1024,1518)'
17 TESTCASES_SRIOV='pvp_tput'
18 TESTPARAM_SRIOV='--test-params TRAFFICGEN_PKT_SIZES=(64,128,512,1024,1518)'
20 #mounting shared directory for collecting ixia test results.
21 shared_dir=$(sudo mount | grep ixia_results)
22 if [ -z "$shared_dir" ]; then
23 echo "mounting shared directory for results"
24 sudo mount -t cifs //10.10.100.6/ixia_results/kvm4nfv_ci /mnt/ixia_results/kvm4nfv_ci -o password=kvm4nfv! -o username=kvm4nfv,file_mode=0777,dir_mode=0777,nounix
26 echo "shared directory is already mounted for results"
29 # check if user config file exists if not then we will use default settings
30 if [ -f $HOME/vsperf.conf ] ; then
31 CONF_FILE="--conf-file ${HOME}/vsperf.conf"
33 echo "configuration file not found on the test node"
34 echo "Using configuration file available in kvmfornfv repo"
35 CONF_FILE="--conf-file /root/workspace/scripts/vsperf.conf"
38 # check if sriov config file exists if not then we will use default settings
39 if [ -f $HOME/vsperf.conf.sriov ] ; then
40 CONF_FILE_SRIOV="--conf-file ${HOME}/vsperf.conf.sriov"
42 echo "SRIOV configuration file not found on the node"
43 echo "Using SRIOV configuration file available in kvmfornfv repo"
44 CONF_FILE="--conf-file /root/workspace/scripts/vsperf.conf.sriov"
47 function install_vsperf() {
48 echo "Installing vsperf....."
49 ( cd $VSPERF/systems ; ./build_base_machine.sh )
52 #Install kvmfornfv built qemu for launching guest vm.
53 function install_qemu() {
54 echo "removing existing qemu packages and installing kvmfornfv built qemu"
55 ( cd /root/workspace/scripts ; ./host-install-qemu.sh )
58 function print_results() {
59 for i in $TESTCASES ; do
60 RES_FILE=`ls -1 $1 | egrep "result_${i}_[0-9a-zA-Z\-]+.csv"`
62 if [ "x$RES_FILE" != "x" -a -e "${1}/${RES_FILE}" ]; then
63 if grep ^FAILED "${1}/${RES_FILE}" &> /dev/null ; then
64 printf " %-70s %-6s\n" "result_${i}" "FAILED"
67 echo "--------------------------------------------------------------"
68 printf " %-50s %-6s\n" "result_${i}" "OK"
69 echo "--------------------------------------------------------------"
72 echo "------------------------------------------------------------------"
73 printf " %-50s %-6s\n" "result_${i}" "FAILED"
74 echo "------------------------------------------------------------------"
80 function publish_results() {
82 results_dir=${TEST_REPORT_LOG_DIR}/${LOG_SUBDIR}/results*
83 time_stamp=$(date -u +"%Y-%m-%d-%H-%M-%S")
84 ( cd /root/workspace/scripts ; python data_publish.py $time_stamp $test_type $results_dir )
87 function execute_vsperf() {
88 # figure out list of TCs and execution parameters
91 TESTPARAM=$TESTPARAM_DAILY
92 TESTCASES=$TESTCASES_DAILY
95 echo "No vsperf test cases implemented for this job type"
100 echo -e "\nExecution of VSPERF for $1"
101 DATE_SUFFIX=$(date -u +"%Y-%m-%d_%H-%M-%S")
102 source "$VSPERFENV_DIR"/bin/activate
105 # use SRIOV specific TCs and configuration
106 TESTPARAM=$TESTPARAM_SRIOV
107 TESTCASES=$TESTCASES_SRIOV
108 # figure out log file name
110 LOG_FILE="${LOG_FILE_PREFIX}_${LOG_SUBDIR}_${DATE_SUFFIX}.log"
111 echo " $VSPERF_BIN --vswitch none --vnf QemuPciPassthrough $CONF_FILE_SRIOV $TESTPARAM $TESTCASES &> $LOG_FILE"
112 $VSPERF_BIN --vswitch none --vnf QemuPciPassthrough $CONF_FILE_SRIOV $TESTPARAM $TESTCASES &> $LOG_FILE
115 # figure out log file name
116 LOG_SUBDIR="OvsDpdkVhost"
117 LOG_FILE="${LOG_FILE_PREFIX}_${LOG_SUBDIR}_${DATE_SUFFIX}.log"
120 echo "daily test cases started"
121 echo " $VSPERF_BIN --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES > $LOG_FILE"
122 $VSPERF_BIN --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES &>> $LOG_FILE
125 # evaluation of results
126 echo -e "\nResults for $1"
127 RES_DIR="/$(grep "Creating result directory" $LOG_FILE | cut -d'/' -f2-)"
128 if [[ "/" == "${RES_DIR}" ]] ; then
129 echo "FAILURE: Results are not available."
130 echo "-------------------------------------------------------------------"
132 echo "-------------------------------------------------------------------"
133 exit $EXIT_NO_RESULTS
135 print_results "${RES_DIR}"
136 if [ $(($EXIT & $EXIT_TC_FAILED)) -gt 0 ] ; then
137 echo "-------------------------------------------------------------------"
139 echo "-------------------------------------------------------------------"
142 # show detailed result figures
143 for md_file in $(grep '\.md"$' $LOG_FILE | cut -d'"' -f2); do
144 # TC resut file header
145 echo -e "\n-------------------------------------------------------------------"
147 echo -e "-------------------------------------------------------------------\n"
149 sed -n '/^- Test ID/,/Bidirectional/{/Packet size/b;p;/Bidirectional/q};/Results\/Metrics Collected/,/Statistics collected/{/^$/p;/^|/p}' $md_file
151 sed -n '/Results\/Metrics Collected/,/Statistics collected/{/^$/p;/^|/p}' $md_file | grep -v "Unknown" | cat -s
154 # copy logs into dedicated directory
155 mkdir -p ${TEST_REPORT_LOG_DIR}/${LOG_SUBDIR}
156 [ -f "$LOG_FILE" ] && mv "${LOG_FILE}" "${TEST_REPORT_LOG_DIR}/${LOG_SUBDIR}" &> /dev/null
157 [ -d "$RES_DIR" ] && mv "$RES_DIR" "${TEST_REPORT_LOG_DIR}/${LOG_SUBDIR}" &> /dev/null
159 # Publish test cases results to Grafana Dashboard
163 #Install vsperf and set up the environment
166 #Install kvmfornfv built qemu rpm
169 # execute job based on passed parameter
172 echo "========================================================"
173 echo "KVM4NFV daily job executing packet forwarding test cases"
174 echo "========================================================"
175 execute_vsperf OVS_with_DPDK_and_vHost_User $1
176 execute_vsperf SRIOV $1
180 echo "test cases not implemented for this job type"