Fix typo openssh-client -> openssh-clients
[csit.git] / bootstrap-vpp-verify-semiweekly.sh
index a2c463c..af56e9f 100644 (file)
@@ -23,19 +23,38 @@ cat /etc/hosts
 
 PYBOT_ARGS="--noncritical MULTI_THREAD"
 
-ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
+JOB_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
+LOG_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
+JOB_ARCHIVE_DIR="archive"
+LOG_ARCHIVE_DIR="$WORKSPACE/archives"
+mkdir -p ${JOB_ARCHIVE_DIR}
+mkdir -p ${LOG_ARCHIVE_DIR}
 
 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 export PYTHONPATH=${SCRIPT_DIR}
 
-if [ -f "/etc/redhat-release" ]; then
+# Create tmp dir
+mkdir ${SCRIPT_DIR}/tmp
+
+# Use tmp dir to store log files
+LOG_PATH="${SCRIPT_DIR}/tmp"
+
+OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
+OS_VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
+
+if [ "$OS_ID" == "centos" ]; then
     DISTRO="CENTOS"
-    sudo yum install -y python-devel python-virtualenv
-else
+    PACKAGE="rpm"
+    sudo yum install -y python-devel python-virtualenv openssh-clients sshpass
+elif [ "$OS_ID" == "ubuntu" ]; then
     DISTRO="UBUNTU"
+    PACKAGE="deb"
     export DEBIAN_FRONTEND=noninteractive
     sudo apt-get -y update
     sudo apt-get -y install libpython2.7-dev python-virtualenv
+else
+    echo "$OS_ID is not yet supported."
+    exit 1
 fi
 
 # 1st step: Download and prepare VPP packages
@@ -45,31 +64,24 @@ if [ "${#}" -ne "0" ]; then
     arr=(${@})
     echo ${arr[0]}
 else
-    case "$DISTRO" in
-        CENTOS )
-            PACKAGE=rpm
-            ;;
-        UBUNTU )
-            PACKAGE=deb
-    esac
     # Download the latest VPP build install packages
-    rm -f *.${PACKAGE}
-    echo Downloading VPP packages...
-    bash ${SCRIPT_DIR}/resources/tools/download_install_vpp_pkgs.sh --skip-install
+    CSIT_DIR=${SCRIPT_DIR}
+    source "${SCRIPT_DIR}/resources/libraries/bash/function/artifacts.sh"
+    download_artifacts
+    # Need to revert -euo as the rest of script is not optimized for this.
+    set +euo pipefail
 fi
 
-# Take vpp package and get the vpp version
-VPP_PKGS=(*.$PACKAGE)
-case "$DISTRO" in
-        CENTOS )
-            VPP_VER="$( expr match $(ls *.rpm | head -n 1) 'vpp-\(.*\).rpm' )"
-            ;;
-        UBUNTU )
-            VPP_VER="$( expr match $(ls *.deb | head -n 1) 'vpp-\(.*\)-deb.deb' )"
-esac
-
+VIRL_DIR_LOC="/tmp/"
+VPP_PKGS=(*vpp*.$PACKAGE)
+VPP_PKGS_FULL=("${VPP_PKGS[@]/#/${VIRL_DIR_LOC}}")
 echo ${VPP_PKGS[@]}
 
+VIRL_TOPOLOGY=$(cat ${SCRIPT_DIR}/VIRL_TOPOLOGY_${DISTRO})
+VIRL_RELEASE=$(cat ${SCRIPT_DIR}/VIRL_RELEASE_${DISTRO})
+
+VPP_VER="$( expr match $(ls vpp*.${PACKAGE} | head -n 1) 'vpp[-|_]\(.*\)'.${PACKAGE} )"
+
 set +x
 echo "****************************************************************************************************************************************"
 echo "1st step: Download VPP packages                                                                                                 FINISHED"
@@ -106,16 +118,6 @@ VIRL_SERVER_STATUS_FILE="status"
 VIRL_SERVER_EXPECTED_STATUS="PRODUCTION"
 VIRL_SESSION_EXPIRY="620"
 
-case "$DISTRO" in
-        CENTOS )
-            VIRL_TOPOLOGY=$(cat ${SCRIPT_DIR}/VIRL_TOPOLOGY_CENTOS)
-            VIRL_RELEASE=$(cat ${SCRIPT_DIR}/VIRL_RELEASE_CENTOS)
-            ;;
-        UBUNTU )
-            VIRL_TOPOLOGY=$(cat ${SCRIPT_DIR}/VIRL_TOPOLOGY_UBUNTU)
-            VIRL_RELEASE=$(cat ${SCRIPT_DIR}/VIRL_RELEASE_UBUNTU)
-esac
-
 SSH_OPTIONS="-i ${VIRL_PKEY} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o BatchMode=yes -o LogLevel=error"
 
 function ssh_do() {
@@ -190,20 +192,8 @@ do
     fi
 done
 
-
-VIRL_DIR_LOC="/tmp"
-VPP_PKGS_VIRL=(${VPP_PKGS[@]})
-
-# Prepend directory location at remote host to deb file list
-for index in "${!VPP_PKGS_VIRL[@]}"; do
-    VPP_PKGS_VIRL[${index}]=${VIRL_DIR_LOC}/${VPP_PKGS_VIRL[${index}]}
-done
-
-echo "Updated file names: " ${VPP_PKGS_VIRL[@]}
-
-cat ${VIRL_PKEY}
 # Copy the files to VIRL host
-scp ${SSH_OPTIONS} *.${PACKAGE} \
+scp ${SSH_OPTIONS} ${VPP_PKGS[@]} \
     ${VIRL_USERNAME}@${VIRL_SERVER}:${VIRL_DIR_LOC}/
 
 result=$?
@@ -225,7 +215,7 @@ VIRL_SID=$(ssh ${SSH_OPTIONS} \
     ${VIRL_USERNAME}@${VIRL_SERVER} \
     "start-testcase -vv --copy ${VIRL_TOPOLOGY} \
     --expiry ${VIRL_SESSION_EXPIRY} \
-    --release ${VIRL_RELEASE} ${VPP_PKGS_VIRL[@]}")
+    --release ${VIRL_RELEASE} ${VPP_PKGS_FULL[@]}")
 retval=$?
 if [ ${retval} -ne "0" ]; then
     echo "VIRL simulation start failed"
@@ -270,7 +260,8 @@ echo Running functional tests on the VIRL system...
 
 # There are used three iterations of functional tests there
 # to check the stability and reliability of the results.
-for test_set in 1 2 3
+partial_logs=""
+for test_set in 1 2
 do
     echo
     echo Functional test loop: ${test_set}
@@ -278,14 +269,17 @@ do
 
     pybot -L TRACE -W 136\
         -v TOPOLOGY_PATH:${SCRIPT_DIR}/topologies/enabled/topology_VIRL.yaml \
-        --suite "tests.func" \
+        --suite "tests.vpp.func" \
         --include vm_envAND3_node_single_link_topo \
         --include vm_envAND3_node_double_link_topo \
         --exclude PERFTEST \
+        --exclude SOFTWIRE \
+        --exclude SKIP_TEST \
         --noncritical EXPECTED_FAILING \
-        --output log_func_test_set${test_set} \
+        --output ${LOG_PATH}/output_func_test_set${test_set} \
         tests/
     PARTIAL_RC=$(echo $?)
+    partial_logs="${partial_logs} ${LOG_PATH}/output_func_test_set${test_set}.xml"
     if [ ${PARTIAL_RC} -eq 250 ]; then
         MORE_FAILS=1
     fi
@@ -343,16 +337,18 @@ echo Post-processing test data...
 
 # Rebot output post-processing
 rebot --noncritical EXPECTED_FAILING \
-      --output output.xml \
-      ./log_func_test_set1.xml ./log_func_test_set2.xml ./log_func_test_set3.xml
+      --output output.xml ${partial_logs}
 
 # Remove unnecessary files
-rm -f ./log_test_set1.xml ./log_test_set2.xml ./log_test_set3.xml
+rm -f ${partial_logs}
 
-# Archive artifacts
-mkdir archive
-for i in ${ARCHIVE_ARTIFACTS[@]}; do
-    cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
+# Archive JOB artifacts in jenkins
+for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
+    cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
+done
+# Archive JOB artifacts to logs.fd.io
+for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
+    cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
 done
 
 echo Post-processing finished.

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.