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"
36 INSTALLATION_DIR="/tmp/install_dir"
39 JOB_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
40 LOG_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
41 JOB_ARCHIVE_DIR="archive"
42 LOG_ARCHIVE_DIR="$WORKSPACE/archives"
43 mkdir -p ${JOB_ARCHIVE_DIR}
44 mkdir -p ${LOG_ARCHIVE_DIR}
49 TOPOLOGIES=$TOPOLOGIES_2N_SKX
50 TOPOLOGIES_TAGS="2_node_*_link_topo"
53 TOPOLOGIES=$TOPOLOGIES_3N_SKX
54 TOPOLOGIES_TAGS="3_node_*_link_topo"
57 TOPOLOGIES=$TOPOLOGIES_3N_HSW
58 TOPOLOGIES_TAGS="3_node_*_link_topo"
70 # Use downloaded packages with specific version
71 if [[ ${TEST_TAG} == *DAILY ]] || \
72 [[ ${TEST_TAG} == *WEEKLY ]];
74 echo Downloading latest VPP packages from NEXUS...
75 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh \
78 echo Downloading VPP packages of specific version from NEXUS...
79 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)
80 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER_UBUNTU)
81 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh \
82 --skip-install --vpp ${VPP_STABLE_VER} --dkms ${DPDK_STABLE_VER}
84 # Jenkins VPP deb paths (convert to full path)
85 DUT_PKGS="$( readlink -f ${DUT}*.deb | tr '\n' ' ' )"
88 # Use local packages provided as argument list
89 # Jenkins VPP deb paths (convert to full path)
90 DUT_PKGS="$( readlink -f $@ | tr '\n' ' ' )"
93 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
105 echo "Unable to identify dut type based on JOB_NAME variable: ${JOB_NAME}"
110 # ENVIRONMENT PREPARATION
111 virtualenv --system-site-packages env
113 pip install -r requirements.txt
115 # We iterate over available topologies and wait until we reserve topology
117 for TOPOLOGY in ${TOPOLOGIES};
119 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
120 if [ $? -eq 0 ]; then
121 WORKING_TOPOLOGY=${TOPOLOGY}
122 echo "Reserved: ${WORKING_TOPOLOGY}"
127 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
128 # Exit the infinite while loop if we made a reservation
132 # Wait ~3minutes before next try
133 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
134 echo "Sleeping ${SLEEP_TIME}"
138 function cancel_all {
139 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
140 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
143 # On script exit we cancel the reservation and installation and delete all vpp
145 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
147 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py \
148 -t ${WORKING_TOPOLOGY} -d ${INSTALLATION_DIR} -p ${DUT_PKGS}
149 if [ $? -eq 0 ]; then
150 echo "DUT installed on hosts from: ${WORKING_TOPOLOGY}"
152 echo "Failed to copy DUT packages files to hosts from: ${WORKING_TOPOLOGY}"
157 PYBOT_ARGS="--consolewidth 100 \
159 --variable TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
160 --suite tests.${DUT}.perf"
163 # select specific performance tests based on jenkins job type variable
165 TAGS=('ndrdiscANDnic_intel-x520-da2AND1c'
166 'ndrdiscANDnic_intel-x520-da2AND2c'
167 'ndrpdrANDnic_intel-x520-da2AND1c'
168 'ndrpdrANDnic_intel-x520-da2AND2c'
169 'ndrdiscAND1cANDipsec'
170 'ndrdiscAND2cANDipsec')
172 PERFTEST_SEMI_WEEKLY )
173 TAGS=('ndrdiscANDnic_intel-x710AND1c'
174 'ndrdiscANDnic_intel-x710AND2c'
175 'ndrdiscANDnic_intel-xl710AND1c'
176 'ndrdiscANDnic_intel-xl710AND2c')
179 TAGS=('mrrAND64bAND1c'
185 'mrrANDimixAND1cANDvhost'
186 'mrrANDimixAND2cANDvhost'
187 'mrrANDimixAND4cANDvhost'
188 'mrrANDimixAND1cANDmemif'
189 'mrrANDimixAND2cANDmemif'
190 'mrrANDimixAND4cANDmemif')
193 if [[ -z "$TEST_TAG_STRING" ]]; then
194 # If nothing is specified, we will run pre-selected tests by
195 # following tags. Items of array will be concatenated by OR in Robot
197 TEST_TAG_ARRAY=('mrrANDnic_intel-x710AND1cAND64bANDip4base'
198 'mrrANDnic_intel-x710AND1cAND78bANDip6base'
199 'mrrANDnic_intel-x710AND1cAND64bANDl2bdbase')
201 # If trigger contains tags, split them into array.
202 TEST_TAG_ARRAY=(${TEST_TAG_STRING//:/ })
207 for TAG in "${TEST_TAG_ARRAY[@]}"; do
208 if [[ ${TAG} == "!"* ]]; then
209 # Exclude tags are not prefixed.
212 # We will prefix with perftest to prevent running other tests
215 if [[ ${JOB_NAME} == vpp-* ]] ; then
216 # Automatic prefixing for VPP jobs to limit the NIC used and
217 # traffic evaluation to MRR.
218 prefix="${prefix}mrrANDnic_intel-x710AND"
220 TAGS+=("$prefix${TAG}")
228 # Catenate TAG selections
230 for TAG in "${TAGS[@]}"; do
231 if [[ ${TAG} == "!"* ]]; then
232 EXPANDED_TAGS+=(" --exclude ${TAG#$"!"} ")
234 EXPANDED_TAGS+=(" --include ${TOPOLOGIES_TAGS}AND${TAG} ")
239 pybot ${PYBOT_ARGS}${EXPANDED_TAGS[@]} tests/
240 RETURN_STATUS=$(echo $?)
242 # Archive JOB artifacts in jenkins
243 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
244 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
246 # Archive JOB artifacts to logs.fd.io
247 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
248 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
251 exit ${RETURN_STATUS}