2 # Copyright (c) 2018 Cisco and/or its affiliates.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
17 # Space separated list of available testbeds, described by topology files
18 TOPOLOGIES="topologies/available/lf_3n_hsw_testbed1.yaml \
19 topologies/available/lf_3n_hsw_testbed2.yaml \
20 topologies/available/lf_3n_hsw_testbed3.yaml"
22 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
23 export PYTHONPATH=${SCRIPT_DIR}
24 export DEBIAN_FRONTEND=noninteractive
27 RESERVATION_DIR="/tmp/reservation_dir"
29 JOB_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
30 LOG_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
31 JOB_ARCHIVE_DIR="archive"
32 LOG_ARCHIVE_DIR="$WORKSPACE/archives"
33 mkdir -p ${JOB_ARCHIVE_DIR}
34 mkdir -p ${LOG_ARCHIVE_DIR}
36 # If we run this script from CSIT jobs we want to use stable version
37 if [[ ${JOB_NAME} == csit-* ]] ;
39 DPDK_REPO='https://fast.dpdk.org/rel/'
40 if [[ ${TEST_TAG} == *DAILY ]] || \
41 [[ ${TEST_TAG} == *WEEKLY ]];
43 echo Downloading latest DPDK packages from repo...
44 DPDK_STABLE_VER=$(wget --no-check-certificate --quiet -O - ${DPDK_REPO} | \
45 grep -v '2015' | grep -Eo 'dpdk-[^\"]+xz' | tail -1)
47 echo Downloading DPDK packages of specific version from repo...
48 DPDK_STABLE_VER='dpdk-18.05.tar.xz'
50 wget --no-check-certificate --quiet ${DPDK_REPO}${DPDK_STABLE_VER}
52 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
58 sudo apt-get -y update
59 sudo apt-get -y install libpython2.7-dev python-virtualenv
61 virtualenv --system-site-packages env
65 pip install -r requirements.txt
67 # We iterate over available topologies and wait until we reserve topology
69 for TOPOLOGY in ${TOPOLOGIES};
71 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
73 WORKING_TOPOLOGY=${TOPOLOGY}
74 echo "Reserved: ${WORKING_TOPOLOGY}"
79 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
80 # Exit the infinite while loop if we made a reservation
84 # Wait ~3minutes before next try
85 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
86 echo "Sleeping ${SLEEP_TIME}"
90 #for DPDK test, we don't need to install the VPP deb
92 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
95 # On script exit we cancel the reservation
96 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
98 # Based on job we will identify DUT
99 if [[ ${JOB_NAME} == *hc2vpp* ]] ;
102 elif [[ ${JOB_NAME} == *vpp* ]] ;
105 elif [[ ${JOB_NAME} == *ligato* ]] ;
108 elif [[ ${JOB_NAME} == *dpdk* ]] ;
112 echo "Unable to identify dut type based on JOB_NAME variable: ${JOB_NAME}"
116 PYBOT_ARGS="--consolewidth 120 --loglevel TRACE --variable TOPOLOGY_PATH:${WORKING_TOPOLOGY} --suite tests.${DUT}.perf"
119 # select specific performance tests based on jenkins job type variable
121 TAGS=('mrrAND64bAND1t1c'
132 if [[ -z "$TEST_TAG_STRING" ]]; then
133 # If nothing is specified, we will run pre-selected tests by
134 # following tags. Items of array will be concatenated by OR in Robot
136 TEST_TAG_ARRAY=('mrrANDnic_intel-x710AND1t1cAND64bANDip4base'
137 'mrrANDnic_intel-x710AND1t1cAND78bANDip6base'
138 'mrrANDnic_intel-x710AND1t1cAND64bANDl2bdbase')
140 # If trigger contains tags, split them into array.
141 TEST_TAG_ARRAY=(${TEST_TAG_STRING//:/ })
146 for TAG in "${TEST_TAG_ARRAY[@]}"; do
147 if [[ ${TAG} == "!"* ]]; then
148 # Exclude tags are not prefixed.
151 # We will prefix with perftest to prevent running other tests
154 if [[ ${JOB_NAME} == vpp-* ]] ; then
155 # Automatic prefixing for VPP jobs to limit the NIC used and
156 # traffic evaluation to MRR.
157 prefix="${prefix}mrrANDnic_intel-x710AND"
159 TAGS+=("$prefix${TAG}")
167 # Catenate TAG selections
169 for TAG in "${TAGS[@]}"; do
170 if [[ ${TAG} == "!"* ]]; then
171 EXPANDED_TAGS+=(" --exclude ${TAG#$"!"} ")
173 EXPANDED_TAGS+=(" --include ${TAG} ")
178 pybot ${PYBOT_ARGS}${EXPANDED_TAGS[@]} tests/
179 RETURN_STATUS=$(echo $?)
181 # Archive JOB artifacts in jenkins
182 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
183 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
185 # Archive JOB artifacts to logs.fd.io
186 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
187 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
190 exit ${RETURN_STATUS}