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_testbed22.yaml \
24 topologies/available/lf_2n_skx_testbed23.yaml \
25 topologies/available/lf_2n_skx_testbed24.yaml"
26 TOPOLOGIES_3N_SKX="topologies/available/lf_3n_skx_testbed31.yaml \
27 topologies/available/lf_3n_skx_testbed32.yaml"
30 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
31 export PYTHONPATH=${SCRIPT_DIR}
32 export DEBIAN_FRONTEND=noninteractive
35 RESERVATION_DIR="/tmp/reservation_dir"
38 JOB_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
39 LOG_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
40 JOB_ARCHIVE_DIR="archive"
41 LOG_ARCHIVE_DIR="$WORKSPACE/archives"
42 mkdir -p ${JOB_ARCHIVE_DIR}
43 mkdir -p ${LOG_ARCHIVE_DIR}
48 TOPOLOGIES=$TOPOLOGIES_2N_SKX
49 TOPOLOGIES_TAGS="2_node_*_link_topo"
52 TOPOLOGIES=$TOPOLOGIES_3N_SKX
53 TOPOLOGIES_TAGS="3_node_*_link_topo"
56 TOPOLOGIES=$TOPOLOGIES_3N_HSW
57 TOPOLOGIES_TAGS="3_node_*_link_topo"
73 # If we run this script from CSIT jobs we want to use stable version
74 DPDK_REPO='https://fast.dpdk.org/rel/'
75 if [[ ${TEST_TAG} == *DAILY ]] || \
76 [[ ${TEST_TAG} == *WEEKLY ]];
78 echo Downloading latest DPDK packages from repo...
79 DPDK_STABLE_VER=$(wget --no-check-certificate --quiet -O - ${DPDK_REPO} | \
80 grep -v '2015' | grep -Eo 'dpdk-[^\"]+xz' | tail -1)
82 echo Downloading DPDK packages of specific version from repo...
83 DPDK_STABLE_VER='dpdk-18.05.tar.xz'
85 wget --no-check-certificate --quiet ${DPDK_REPO}${DPDK_STABLE_VER}
88 echo "Unable to identify dut type based on JOB_NAME variable: ${JOB_NAME}"
94 # ENVIRONMENT PREPARATION
95 virtualenv --system-site-packages env
97 pip install -r requirements.txt
99 # We iterate over available topologies and wait until we reserve topology
101 for TOPOLOGY in ${TOPOLOGIES};
103 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
104 if [ $? -eq 0 ]; then
105 WORKING_TOPOLOGY=${TOPOLOGY}
106 echo "Reserved: ${WORKING_TOPOLOGY}"
111 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
112 # Exit the infinite while loop if we made a reservation
116 # Wait ~3minutes before next try
117 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
118 echo "Sleeping ${SLEEP_TIME}"
122 #for DPDK test, we don't need to install the VPP deb
123 function cancel_all {
124 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
127 # On script exit we cancel the reservation
128 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
131 PYBOT_ARGS="--consolewidth 100 \
133 --variable TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
134 --suite tests.${DUT}.perf"
137 # select specific performance tests based on jenkins job type variable
139 TAGS=('mrrAND64bAND1c'
150 if [[ -z "$TEST_TAG_STRING" ]]; then
151 # If nothing is specified, we will run pre-selected tests by
152 # following tags. Items of array will be concatenated by OR in Robot
154 TEST_TAG_ARRAY=('mrrANDnic_intel-x710AND1cAND64b')
156 # If trigger contains tags, split them into array.
157 TEST_TAG_ARRAY=(${TEST_TAG_STRING//:/ })
162 for TAG in "${TEST_TAG_ARRAY[@]}"; do
163 if [[ ${TAG} == "!"* ]]; then
164 # Exclude tags are not prefixed.
167 # We will prefix with perftest to prevent running other tests
170 if [[ ${JOB_NAME} == vpp-* ]] ; then
171 # Automatic prefixing for VPP jobs to limit the NIC used and
172 # traffic evaluation to MRR.
173 prefix="${prefix}mrrANDnic_intel-x710AND"
175 TAGS+=("$prefix${TAG}")
183 # Catenate TAG selections
185 for TAG in "${TAGS[@]}"; do
186 if [[ ${TAG} == "!"* ]]; then
187 EXPANDED_TAGS+=(" --exclude ${TAG#$"!"} ")
189 EXPANDED_TAGS+=(" --include ${TOPOLOGIES_TAGS}AND${TAG} ")
194 pybot ${PYBOT_ARGS}${EXPANDED_TAGS[@]} tests/
195 RETURN_STATUS=$(echo $?)
197 # Archive JOB artifacts in jenkins
198 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
199 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
201 # Archive JOB artifacts to logs.fd.io
202 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
203 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
206 exit ${RETURN_STATUS}