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 pvp_tput pvvp_tput pvpv_cont'
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-%dT%H:%M:%SZ")
84 ( cd /root/workspace/scripts ; python2.7 data_publish.py $time_stamp $test_type $results_dir )
85 #cleaning the results after publishing on grafana dashboard.
86 ( cd ${TEST_REPORT_LOG_DIR}/${LOG_SUBDIR} ; rm -rf results* )
89 function execute_vsperf() {
90 # figure out list of TCs and execution parameters
93 TESTPARAM=$TESTPARAM_DAILY
94 TESTCASES=$TESTCASES_DAILY
97 echo "No vsperf test cases implemented for this job type"
102 echo -e "\nExecution of VSPERF for $1"
103 DATE_SUFFIX=$(date -u +"%Y-%m-%d_%H-%M-%S")
104 source "$VSPERFENV_DIR"/bin/activate
108 # use SRIOV specific TCs and configuration
109 TESTPARAM=$TESTPARAM_SRIOV
110 TESTCASES=$TESTCASES_SRIOV
111 # figure out log file name
113 LOG_FILE="${LOG_FILE_PREFIX}_${LOG_SUBDIR}_${DATE_SUFFIX}.log"
114 echo " $VSPERF_BIN --vswitch none --vnf QemuPciPassthrough $CONF_FILE_SRIOV $TESTPARAM $TESTCASES &> $LOG_FILE"
115 $VSPERF_BIN --vswitch none --vnf QemuPciPassthrough $CONF_FILE_SRIOV $TESTPARAM $TESTCASES &> $LOG_FILE
118 # figure out log file name
119 LOG_SUBDIR="OvsDpdkVhost"
120 LOG_FILE="${LOG_FILE_PREFIX}_${LOG_SUBDIR}_${DATE_SUFFIX}.log"
122 echo "daily test cases started"
123 echo " $VSPERF_BIN --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES > $LOG_FILE"
124 $VSPERF_BIN --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES &>> $LOG_FILE
127 # evaluation of results
128 echo -e "\nResults for $1"
129 RES_DIR="/$(grep "Creating result directory" $LOG_FILE | cut -d'/' -f2-)"
130 if [[ "/" == "${RES_DIR}" ]] ; then
131 echo "FAILURE: Results are not available."
132 echo "-------------------------------------------------------------------"
134 echo "-------------------------------------------------------------------"
135 exit $EXIT_NO_RESULTS
137 print_results "${RES_DIR}"
138 if [ $(($EXIT & $EXIT_TC_FAILED)) -gt 0 ] ; then
139 echo "-------------------------------------------------------------------"
141 echo "-------------------------------------------------------------------"
144 # show detailed result figures
145 for md_file in $(grep '\.md"$' $LOG_FILE | cut -d'"' -f2); do
146 # TC resut file header
147 echo -e "\n-------------------------------------------------------------------"
149 echo -e "-------------------------------------------------------------------\n"
151 sed -n '/^- Test ID/,/Bidirectional/{/Packet size/b;p;/Bidirectional/q};/Results\/Metrics Collected/,/Statistics collected/{/^$/p;/^|/p}' $md_file
153 sed -n '/Results\/Metrics Collected/,/Statistics collected/{/^$/p;/^|/p}' $md_file | grep -v "Unknown" | cat -s
156 # copy logs into dedicated directory
157 mkdir -p ${TEST_REPORT_LOG_DIR}/${LOG_SUBDIR}
158 [ -f "$LOG_FILE" ] && mv "${LOG_FILE}" "${TEST_REPORT_LOG_DIR}/${LOG_SUBDIR}" &> /dev/null
159 [ -d "$RES_DIR" ] && mv "$RES_DIR" "${TEST_REPORT_LOG_DIR}/${LOG_SUBDIR}" &> /dev/null
161 # Publish test cases results to Grafana Dashboard
165 #Install vsperf and set up the environment
168 #Install kvmfornfv built qemu rpm
171 # execute job based on passed parameter
174 echo "========================================================"
175 echo "KVM4NFV daily job executing packet forwarding test cases"
176 echo "========================================================"
177 execute_vsperf OVS_with_DPDK_and_vHost_User $1
178 execute_vsperf SRIOV $1
182 echo "test cases not implemented for this job type"