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"
34 INSTALLATION_DIR="/tmp/install_dir"
37 JOB_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
38 LOG_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
39 JOB_ARCHIVE_DIR="archive"
40 LOG_ARCHIVE_DIR="$WORKSPACE/archives"
41 mkdir -p ${JOB_ARCHIVE_DIR}
42 mkdir -p ${LOG_ARCHIVE_DIR}
47 TOPOLOGIES=$TOPOLOGIES_2N_SKX
48 TOPOLOGIES_TAGS="2_node_*_link_topo"
51 TOPOLOGIES=$TOPOLOGIES_3N_SKX
52 TOPOLOGIES_TAGS="3_node_*_link_topo"
55 TOPOLOGIES=$TOPOLOGIES_3N_HSW
56 TOPOLOGIES_TAGS="3_node_*_link_topo"
68 # Use downloaded packages with specific version
69 if [[ ${TEST_TAG} == *DAILY ]] || \
70 [[ ${TEST_TAG} == *WEEKLY ]];
72 echo Downloading latest VPP packages from NEXUS...
73 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh \
76 echo Downloading VPP packages of specific version from NEXUS...
77 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)
78 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER_UBUNTU)
79 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh \
80 --skip-install --vpp ${VPP_STABLE_VER} --dkms ${DPDK_STABLE_VER}
82 # Jenkins VPP deb paths (convert to full path)
83 DUT_PKGS="$( readlink -f ${DUT}*.deb | tr '\n' ' ' )"
86 # Use local packages provided as argument list
87 # Jenkins VPP deb paths (convert to full path)
88 DUT_PKGS="$( readlink -f $@ | tr '\n' ' ' )"
91 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
103 echo "Unable to identify dut type based on JOB_NAME variable: ${JOB_NAME}"
108 # ENVIRONMENT PREPARATION
109 virtualenv --system-site-packages env
111 pip install -r requirements.txt
113 if [ -z "${TOPOLOGIES}" ]; then
114 echo "No applicable topology found!"
117 # We iterate over available topologies and wait until we reserve topology
119 for TOPOLOGY in ${TOPOLOGIES};
121 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
122 if [ $? -eq 0 ]; then
123 WORKING_TOPOLOGY=${TOPOLOGY}
124 echo "Reserved: ${WORKING_TOPOLOGY}"
129 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
130 # Exit the infinite while loop if we made a reservation
134 # Wait ~3minutes before next try
135 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
136 echo "Sleeping ${SLEEP_TIME}"
140 function cancel_all {
141 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
142 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
145 # On script exit we cancel the reservation and installation and delete all vpp
147 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
149 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py \
150 -t ${WORKING_TOPOLOGY} -d ${INSTALLATION_DIR} -p ${DUT_PKGS}
151 if [ $? -eq 0 ]; then
152 echo "DUT installed on hosts from: ${WORKING_TOPOLOGY}"
154 echo "Failed to copy DUT packages files to hosts from: ${WORKING_TOPOLOGY}"
159 PYBOT_ARGS="--consolewidth 100 \
161 --variable TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
162 --suite tests.${DUT}.perf"
165 # select specific performance tests based on jenkins job type variable
167 TAGS=('ndrdiscANDnic_intel-x520-da2AND1c'
168 'ndrdiscANDnic_intel-x520-da2AND2c'
169 'ndrpdrANDnic_intel-x520-da2AND1c'
170 'ndrpdrANDnic_intel-x520-da2AND2c'
171 'ndrdiscAND1cANDipsec'
172 'ndrdiscAND2cANDipsec')
174 PERFTEST_SEMI_WEEKLY )
175 TAGS=('ndrdiscANDnic_intel-x710AND1c'
176 'ndrdiscANDnic_intel-x710AND2c'
177 'ndrdiscANDnic_intel-xl710AND1c'
178 'ndrdiscANDnic_intel-xl710AND2c')
181 TAGS=('mrrAND64bAND1c'
187 'mrrANDimixAND1cANDvhost'
188 'mrrANDimixAND2cANDvhost'
189 'mrrANDimixAND4cANDvhost'
190 'mrrANDimixAND1cANDmemif'
191 'mrrANDimixAND2cANDmemif'
192 'mrrANDimixAND4cANDmemif')
195 if [[ -z "$TEST_TAG_STRING" ]]; then
196 # If nothing is specified, we will run pre-selected tests by
197 # following tags. Items of array will be concatenated by OR in Robot
199 TEST_TAG_ARRAY=('mrrANDnic_intel-x710AND1cAND64bANDip4base'
200 'mrrANDnic_intel-x710AND1cAND78bANDip6base'
201 'mrrANDnic_intel-x710AND1cAND64bANDl2bdbase')
203 # If trigger contains tags, split them into array.
204 TEST_TAG_ARRAY=(${TEST_TAG_STRING//:/ })
209 for TAG in "${TEST_TAG_ARRAY[@]}"; do
210 if [[ ${TAG} == "!"* ]]; then
211 # Exclude tags are not prefixed.
214 # We will prefix with perftest to prevent running other tests
217 if [[ ${JOB_NAME} == vpp-* ]] ; then
218 # Automatic prefixing for VPP jobs to limit the NIC used and
219 # traffic evaluation to MRR.
220 prefix="${prefix}mrrANDnic_intel-x710AND"
222 TAGS+=("$prefix${TAG}")
230 # Catenate TAG selections
232 for TAG in "${TAGS[@]}"; do
233 if [[ ${TAG} == "!"* ]]; then
234 EXPANDED_TAGS+=(" --exclude ${TAG#$"!"} ")
236 EXPANDED_TAGS+=(" --include ${TOPOLOGIES_TAGS}AND${TAG} ")
241 pybot ${PYBOT_ARGS}${EXPANDED_TAGS[@]} tests/
242 RETURN_STATUS=$(echo $?)
244 # Archive JOB artifacts in jenkins
245 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
246 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
248 # Archive JOB artifacts to logs.fd.io
249 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
250 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
253 exit ${RETURN_STATUS}