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_testbed22.yaml \
23 topologies/available/lf_2n_skx_testbed23.yaml"
27 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
28 export PYTHONPATH=${SCRIPT_DIR}
29 export DEBIAN_FRONTEND=noninteractive
32 RESERVATION_DIR="/tmp/reservation_dir"
33 INSTALLATION_DIR="/tmp/install_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"
67 # Use downloaded packages with specific version
68 if [[ ${TEST_TAG} == *DAILY ]] || \
69 [[ ${TEST_TAG} == *WEEKLY ]];
71 echo Downloading latest VPP packages from NEXUS...
72 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh \
75 echo Downloading VPP packages of specific version from NEXUS...
76 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)
77 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER_UBUNTU)
78 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh \
79 --skip-install --vpp ${VPP_STABLE_VER} --dkms ${DPDK_STABLE_VER}
81 # Jenkins VPP deb paths (convert to full path)
82 DUT_PKGS="$( readlink -f ${DUT}*.deb | tr '\n' ' ' )"
85 # Use local packages provided as argument list
86 # Jenkins VPP deb paths (convert to full path)
87 DUT_PKGS="$( readlink -f $@ | tr '\n' ' ' )"
90 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
102 echo "Unable to identify dut type based on JOB_NAME variable: ${JOB_NAME}"
107 # ENVIRONMENT PREPARATION
108 virtualenv --system-site-packages env
110 pip install -r requirements.txt
112 # We iterate over available topologies and wait until we reserve topology
114 for TOPOLOGY in ${TOPOLOGIES};
116 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
117 if [ $? -eq 0 ]; then
118 WORKING_TOPOLOGY=${TOPOLOGY}
119 echo "Reserved: ${WORKING_TOPOLOGY}"
124 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
125 # Exit the infinite while loop if we made a reservation
129 # Wait ~3minutes before next try
130 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
131 echo "Sleeping ${SLEEP_TIME}"
135 function cancel_all {
136 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
137 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
140 # On script exit we cancel the reservation and installation and delete all vpp
142 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
144 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py \
145 -t ${WORKING_TOPOLOGY} -d ${INSTALLATION_DIR} -p ${DUT_PKGS}
146 if [ $? -eq 0 ]; then
147 echo "DUT installed on hosts from: ${WORKING_TOPOLOGY}"
149 echo "Failed to copy DUT packages files to hosts from: ${WORKING_TOPOLOGY}"
154 PYBOT_ARGS="--consolewidth 100 \
156 --variable TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
157 --suite tests.${DUT}.perf"
160 # select specific performance tests based on jenkins job type variable
162 TAGS=('ndrdiscANDnic_intel-x520-da2AND1c'
163 'ndrdiscANDnic_intel-x520-da2AND2c'
164 'ndrpdrANDnic_intel-x520-da2AND1c'
165 'ndrpdrANDnic_intel-x520-da2AND2c'
166 'ndrdiscAND1cANDipsec'
167 'ndrdiscAND2cANDipsec')
169 PERFTEST_SEMI_WEEKLY )
170 TAGS=('ndrdiscANDnic_intel-x710AND1c'
171 'ndrdiscANDnic_intel-x710AND2c'
172 'ndrdiscANDnic_intel-xl710AND1c'
173 'ndrdiscANDnic_intel-xl710AND2c')
176 TAGS=('mrrAND64bAND1c'
182 'mrrANDimixAND1cANDvhost'
183 'mrrANDimixAND2cANDvhost'
184 'mrrANDimixAND4cANDvhost'
185 'mrrANDimixAND1cANDmemif'
186 'mrrANDimixAND2cANDmemif'
187 'mrrANDimixAND4cANDmemif')
190 if [[ -z "$TEST_TAG_STRING" ]]; then
191 # If nothing is specified, we will run pre-selected tests by
192 # following tags. Items of array will be concatenated by OR in Robot
194 TEST_TAG_ARRAY=('mrrANDnic_intel-x710AND1cAND64bANDip4base'
195 'mrrANDnic_intel-x710AND1cAND78bANDip6base'
196 'mrrANDnic_intel-x710AND1cAND64bANDl2bdbase')
198 # If trigger contains tags, split them into array.
199 TEST_TAG_ARRAY=(${TEST_TAG_STRING//:/ })
204 for TAG in "${TEST_TAG_ARRAY[@]}"; do
205 if [[ ${TAG} == "!"* ]]; then
206 # Exclude tags are not prefixed.
209 # We will prefix with perftest to prevent running other tests
212 if [[ ${JOB_NAME} == vpp-* ]] ; then
213 # Automatic prefixing for VPP jobs to limit the NIC used and
214 # traffic evaluation to MRR.
215 prefix="${prefix}mrrANDnic_intel-x710AND"
217 TAGS+=("$prefix${TAG}")
225 # Catenate TAG selections
227 for TAG in "${TAGS[@]}"; do
228 if [[ ${TAG} == "!"* ]]; then
229 EXPANDED_TAGS+=(" --exclude ${TAG#$"!"} ")
231 EXPANDED_TAGS+=(" --include ${TOPOLOGIES_TAGS}AND${TAG} ")
236 pybot ${PYBOT_ARGS}${EXPANDED_TAGS[@]} tests/
237 RETURN_STATUS=$(echo $?)
239 # Archive JOB artifacts in jenkins
240 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
241 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
243 # Archive JOB artifacts to logs.fd.io
244 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
245 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
248 exit ${RETURN_STATUS}