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 # We iterate over available topologies and wait until we reserve topology
115 for TOPOLOGY in ${TOPOLOGIES};
117 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
118 if [ $? -eq 0 ]; then
119 WORKING_TOPOLOGY=${TOPOLOGY}
120 echo "Reserved: ${WORKING_TOPOLOGY}"
125 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
126 # Exit the infinite while loop if we made a reservation
130 # Wait ~3minutes before next try
131 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
132 echo "Sleeping ${SLEEP_TIME}"
136 function cancel_all {
137 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
138 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
141 # On script exit we cancel the reservation and installation and delete all vpp
143 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
145 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py \
146 -t ${WORKING_TOPOLOGY} -d ${INSTALLATION_DIR} -p ${DUT_PKGS}
147 if [ $? -eq 0 ]; then
148 echo "DUT installed on hosts from: ${WORKING_TOPOLOGY}"
150 echo "Failed to copy DUT packages files to hosts from: ${WORKING_TOPOLOGY}"
155 PYBOT_ARGS="--consolewidth 100 \
157 --variable TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
158 --suite tests.${DUT}.perf"
161 # select specific performance tests based on jenkins job type variable
163 TAGS=('ndrdiscANDnic_intel-x520-da2AND1c'
164 'ndrdiscANDnic_intel-x520-da2AND2c'
165 'ndrpdrANDnic_intel-x520-da2AND1c'
166 'ndrpdrANDnic_intel-x520-da2AND2c'
167 'ndrdiscAND1cANDipsec'
168 'ndrdiscAND2cANDipsec')
170 PERFTEST_SEMI_WEEKLY )
171 TAGS=('ndrdiscANDnic_intel-x710AND1c'
172 'ndrdiscANDnic_intel-x710AND2c'
173 'ndrdiscANDnic_intel-xl710AND1c'
174 'ndrdiscANDnic_intel-xl710AND2c')
177 TAGS=('mrrAND64bAND1c'
183 'mrrANDimixAND1cANDvhost'
184 'mrrANDimixAND2cANDvhost'
185 'mrrANDimixAND4cANDvhost'
186 'mrrANDimixAND1cANDmemif'
187 'mrrANDimixAND2cANDmemif'
188 'mrrANDimixAND4cANDmemif')
191 if [[ -z "$TEST_TAG_STRING" ]]; then
192 # If nothing is specified, we will run pre-selected tests by
193 # following tags. Items of array will be concatenated by OR in Robot
195 TEST_TAG_ARRAY=('mrrANDnic_intel-x710AND1cAND64bANDip4base'
196 'mrrANDnic_intel-x710AND1cAND78bANDip6base'
197 'mrrANDnic_intel-x710AND1cAND64bANDl2bdbase')
199 # If trigger contains tags, split them into array.
200 TEST_TAG_ARRAY=(${TEST_TAG_STRING//:/ })
205 for TAG in "${TEST_TAG_ARRAY[@]}"; do
206 if [[ ${TAG} == "!"* ]]; then
207 # Exclude tags are not prefixed.
210 # We will prefix with perftest to prevent running other tests
213 if [[ ${JOB_NAME} == vpp-* ]] ; then
214 # Automatic prefixing for VPP jobs to limit the NIC used and
215 # traffic evaluation to MRR.
216 prefix="${prefix}mrrANDnic_intel-x710AND"
218 TAGS+=("$prefix${TAG}")
226 # Catenate TAG selections
228 for TAG in "${TAGS[@]}"; do
229 if [[ ${TAG} == "!"* ]]; then
230 EXPANDED_TAGS+=(" --exclude ${TAG#$"!"} ")
232 EXPANDED_TAGS+=(" --include ${TOPOLOGIES_TAGS}AND${TAG} ")
237 pybot ${PYBOT_ARGS}${EXPANDED_TAGS[@]} tests/
238 RETURN_STATUS=$(echo $?)
240 # Archive JOB artifacts in jenkins
241 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
242 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
244 # Archive JOB artifacts to logs.fd.io
245 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
246 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
249 exit ${RETURN_STATUS}