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.
18 # Space separated list of available testbeds, described by topology files
19 TOPOLOGIES_3N_HSW="topologies/available/lf_3n_hsw_testbed1.yaml \
20 topologies/available/lf_3n_hsw_testbed2.yaml \
21 topologies/available/lf_3n_hsw_testbed3.yaml"
22 TOPOLOGIES_2N_SKX="topologies/available/lf_2n_skx_testbed21.yaml \
23 topologies/available/lf_2n_skx_testbed24.yaml"
24 TOPOLOGIES_3N_SKX="topologies/available/lf_3n_skx_testbed31.yaml \
25 topologies/available/lf_3n_skx_testbed32.yaml"
28 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
29 export PYTHONPATH=${SCRIPT_DIR}
30 export DEBIAN_FRONTEND=noninteractive
33 RESERVATION_DIR="/tmp/reservation_dir"
36 JOB_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
37 LOG_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
38 JOB_ARCHIVE_DIR="archive"
39 LOG_ARCHIVE_DIR="$WORKSPACE/archives"
40 mkdir -p ${JOB_ARCHIVE_DIR}
41 mkdir -p ${LOG_ARCHIVE_DIR}
46 TOPOLOGIES=$TOPOLOGIES_2N_SKX
47 TOPOLOGIES_TAGS="2_node_*_link_topo"
50 TOPOLOGIES=$TOPOLOGIES_3N_SKX
51 TOPOLOGIES_TAGS="3_node_*_link_topo"
54 TOPOLOGIES=$TOPOLOGIES_3N_HSW
55 TOPOLOGIES_TAGS="3_node_*_link_topo"
71 # If we run this script from CSIT jobs we want to use stable version
72 DPDK_REPO='https://fast.dpdk.org/rel/'
73 if [[ ${TEST_TAG} == *DAILY ]] || \
74 [[ ${TEST_TAG} == *WEEKLY ]];
76 echo Downloading latest DPDK packages from repo...
77 DPDK_STABLE_VER=$(wget --no-check-certificate --quiet -O - ${DPDK_REPO} | \
78 grep -v '2015' | grep -Eo 'dpdk-[^\"]+xz' | tail -1)
80 echo Downloading DPDK packages of specific version from repo...
81 DPDK_STABLE_VER='dpdk-18.05.tar.xz'
83 wget --no-check-certificate --quiet ${DPDK_REPO}${DPDK_STABLE_VER}
86 echo "Unable to identify dut type based on JOB_NAME variable: ${JOB_NAME}"
92 # ENVIRONMENT PREPARATION
93 virtualenv --system-site-packages env
95 pip install -r requirements.txt
97 # We iterate over available topologies and wait until we reserve topology
99 for TOPOLOGY in ${TOPOLOGIES};
101 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
102 if [ $? -eq 0 ]; then
103 WORKING_TOPOLOGY=${TOPOLOGY}
104 echo "Reserved: ${WORKING_TOPOLOGY}"
109 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
110 # Exit the infinite while loop if we made a reservation
114 # Wait ~3minutes before next try
115 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
116 echo "Sleeping ${SLEEP_TIME}"
120 #for DPDK test, we don't need to install the VPP deb
121 function cancel_all {
122 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
125 # On script exit we cancel the reservation
126 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
129 PYBOT_ARGS="--consolewidth 100 \
131 --variable TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
132 --suite tests.${DUT}.perf"
135 # select specific performance tests based on jenkins job type variable
137 TAGS=('mrrAND64bAND1c'
148 if [[ -z "$TEST_TAG_STRING" ]]; then
149 # If nothing is specified, we will run pre-selected tests by
150 # following tags. Items of array will be concatenated by OR in Robot
152 TEST_TAG_ARRAY=('mrrANDnic_intel-x710AND1cAND64b')
154 # If trigger contains tags, split them into array.
155 TEST_TAG_ARRAY=(${TEST_TAG_STRING//:/ })
160 for TAG in "${TEST_TAG_ARRAY[@]}"; do
161 if [[ ${TAG} == "!"* ]]; then
162 # Exclude tags are not prefixed.
165 # We will prefix with perftest to prevent running other tests
168 if [[ ${JOB_NAME} == vpp-* ]] ; then
169 # Automatic prefixing for VPP jobs to limit the NIC used and
170 # traffic evaluation to MRR.
171 prefix="${prefix}mrrANDnic_intel-x710AND"
173 TAGS+=("$prefix${TAG}")
181 # Catenate TAG selections
183 for TAG in "${TAGS[@]}"; do
184 if [[ ${TAG} == "!"* ]]; then
185 EXPANDED_TAGS+=(" --exclude ${TAG#$"!"} ")
187 EXPANDED_TAGS+=(" --include ${TOPOLOGIES_TAGS}AND${TAG} ")
192 pybot ${PYBOT_ARGS}${EXPANDED_TAGS[@]} tests/
193 RETURN_STATUS=$(echo $?)
195 # Archive JOB artifacts in jenkins
196 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
197 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
199 # Archive JOB artifacts to logs.fd.io
200 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
201 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
204 exit ${RETURN_STATUS}