ixia: Fix VLAN support by IxNet class
[vswitchperf.git] / ci / build-vsperf.sh
index 24fbb8f..b4a0f24 100755 (executable)
@@ -27,8 +27,9 @@
 EXIT=0
 EXIT_TC_FAILED=1
 EXIT_SANITY_TC_FAILED=2
-EXIT_NO_RESULTS=10
-EXIT_NO_TEST_REPORT_LOG_DIR=11
+EXIT_PYLINT_FAILED=4
+EXIT_NO_RESULTS=128
+EXIT_NO_TEST_REPORT_LOG_DIR=256
 
 #
 # configuration
@@ -50,6 +51,8 @@ TESTPARAM_MERGE="--integration"
 # DAILY - run selected TCs for defined packet sizes
 TESTCASES_DAILY='phy2phy_tput back2back phy2phy_tput_mod_vlan phy2phy_scalability pvp_tput pvp_back2back pvvp_tput pvvp_back2back'
 TESTPARAM_DAILY='--test-params TRAFFICGEN_PKT_SIZES=(64,128,512,1024,1518)'
+TESTCASES_SRIOV='pvp_tput'
+TESTPARAM_SRIOV='--test-params TRAFFICGEN_PKT_SIZES=(64,128,512,1024,1518)'
 # check if user config file exists if not then we will use default settings
 if [ -f $HOME/vsperf-${BRANCH}.conf ] ; then
     # branch specific config was found
@@ -61,6 +64,12 @@ else
         CONF_FILE=""
     fi
 fi
+# check if sriov specific config file exists if not then use default configuration
+if [ -f $HOME/vsperf-${BRANCH}.conf.sriov ] ; then
+    CONF_FILE_SRIOV="${CONF_FILE}.sriov"
+else
+    CONF_FILE_SRIOV=$CONF_FILE
+fi
 
 # Test report related configuration
 TEST_REPORT_PARTIAL="*_test_report.rst"
@@ -157,6 +166,17 @@ function execute_vsperf() {
     DATE_SUFFIX=$(date -u +"%Y-%m-%d_%H-%M-%S")
 
     case $1 in
+        "SRIOV")
+            # use SRIOV specific TCs and configuration
+            TESTPARAM=$TESTPARAM_SRIOV
+            TESTCASES=$TESTCASES_SRIOV
+            # figure out log file name
+            LOG_SUBDIR="SRIOV"
+            LOG_FILE="${LOG_FILE_PREFIX}_${LOG_SUBDIR}_${DATE_SUFFIX}.log"
+
+            echo "    $VSPERF_BIN --vswitch none --vnf QemuPciPassthrough $CONF_FILE_SRIOV $TESTPARAM $TESTCASES &> $LOG_FILE"
+            $VSPERF_BIN --vswitch none --vnf QemuPciPassthrough $CONF_FILE_SRIOV $TESTPARAM $TESTCASES &> $LOG_FILE
+            ;;
         "OVS_vanilla")
             # figure out log file name
             LOG_SUBDIR="OvsVanilla"
@@ -188,7 +208,7 @@ function execute_vsperf() {
         exit $EXIT_NO_RESULTS
     else
         print_results "${RES_DIR}"
-        if [ "$EXIT" -eq "$EXIT_TC_FAILED" ] ; then
+        if [ $(($EXIT & $EXIT_TC_FAILED)) -gt 0 ] ; then
             echo "-------------------------------------------------------------------"
             cat $LOG_FILE
             echo "-------------------------------------------------------------------"
@@ -308,20 +328,28 @@ function execute_vsperf_sanity() {
         echo >> $LOG_FILE
     done
     echo "Sanity log file $LOG_FILE"
-    if [ "$EXIT" -ne "0" ] ; then
+    if [ $(($EXIT & $EXIT_SANITY_TC_FAILED)) -gt 0 ] ; then
         echo "-------------------------------------------------------------------"
         cat $LOG_FILE
         echo "-------------------------------------------------------------------"
     fi
 }
 
+# execute pylint to check code quality
+function execute_vsperf_pylint_check() {
+    if ! ./check -b ; then
+        EXIT=$EXIT_PYLINT_FAILED
+    fi
+}
+
 # check and install required packages at nodes running VERIFY and MERGE jobs
 function dependencies_check() {
     . /etc/os-release
     if [ $ID == "ubuntu" ] ; then
         echo "Dependencies check"
         echo "=================="
-        for PACKAGE in "python3-tk" "sysstat" ; do
+        # install system packages
+        for PACKAGE in "python3-tk" "sysstat" "bc" ; do
             if dpkg -s $PACKAGE &> /dev/null ; then
                 printf "    %-70s %-6s\n" $PACKAGE "OK"
             else
@@ -329,6 +357,15 @@ function dependencies_check() {
                 sudo apt-get install -y $PACKAGE
             fi
         done
+        # install additional python packages into python environment
+        for PACKAGE in "pylint" ; do
+            if pip show $PACKAGE &> /dev/null ; then
+                printf "    %-70s %-6s\n" $PACKAGE "OK"
+            else
+                printf "    %-70s %-6s\n" $PACKAGE "missing"
+                pip install $PACKAGE
+            fi
+        done
         echo
     fi
 }
@@ -386,6 +423,7 @@ case $1 in
         echo "VSPERF verify job"
         echo "================="
 
+        execute_vsperf_pylint_check
         terminate_vsperf
         execute_vsperf_sanity
         terminate_vsperf
@@ -400,6 +438,7 @@ case $1 in
         echo "VSPERF merge job"
         echo "================"
 
+        execute_pylint_check
         terminate_vsperf
         execute_vsperf_sanity
         terminate_vsperf
@@ -419,6 +458,8 @@ case $1 in
         terminate_vsperf
         execute_vsperf OVS_vanilla $1
         terminate_vsperf
+        execute_vsperf SRIOV $1
+        terminate_vsperf
 
         generate_report