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.
17 # Space separated list of available testbeds, described by topology files
18 TOPOLOGIES="topologies/available/lf_3n_hsw_testbed1.yaml \
19 topologies/available/lf_3n_hsw_testbed2.yaml \
20 topologies/available/lf_3n_hsw_testbed3.yaml"
22 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
23 export PYTHONPATH=${SCRIPT_DIR}
24 export DEBIAN_FRONTEND=noninteractive
27 RESERVATION_DIR="/tmp/reservation_dir"
28 INSTALLATION_DIR="/tmp/install_dir"
30 JOB_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
31 LOG_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
32 JOB_ARCHIVE_DIR="archive"
33 LOG_ARCHIVE_DIR="$WORKSPACE/archives"
34 mkdir -p ${JOB_ARCHIVE_DIR}
35 mkdir -p ${LOG_ARCHIVE_DIR}
37 # If we run this script from CSIT jobs we want to use stable vpp version
38 if [[ ${JOB_NAME} == csit-* ]] ;
40 if [[ ${TEST_TAG} == *DAILY ]] || \
41 [[ ${TEST_TAG} == *WEEKLY ]];
43 echo Downloading latest VPP packages from NEXUS...
44 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh \
47 echo Downloading VPP packages of specific version from NEXUS...
48 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)
49 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER_UBUNTU)
50 #Temporary if arch will not be removed from VPP_STABLE_VER_UBUNTU
51 #VPP_STABLE_VER=${VPP_STABLE_VER%_amd64}
52 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh \
53 --skip-install --vpp ${VPP_STABLE_VER} --dkms ${DPDK_STABLE_VER}
55 # Jenkins VPP deb paths (convert to full path)
56 VPP_DEBS="$( readlink -f vpp*.deb | tr '\n' ' ' )"
58 # If we run this script from vpp project we want to use local build
59 elif [[ ${JOB_NAME} == vpp-* ]] ;
61 # Use local packages provided as argument list
62 # Jenkins VPP deb paths (convert to full path)
63 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
65 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
71 sudo apt-get -y update
72 sudo apt-get -y install libpython2.7-dev python-virtualenv
74 virtualenv --system-site-packages env
78 pip install -r requirements.txt
80 # We iterate over available topologies and wait until we reserve topology
82 for TOPOLOGY in ${TOPOLOGIES};
84 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
86 WORKING_TOPOLOGY=${TOPOLOGY}
87 echo "Reserved: ${WORKING_TOPOLOGY}"
92 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
93 # Exit the infinite while loop if we made a reservation
97 # Wait ~3minutes before next try
98 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
99 echo "Sleeping ${SLEEP_TIME}"
103 function cancel_all {
104 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
105 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
108 # On script exit we cancel the reservation and installation and delete all vpp
110 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
112 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py \
113 -t ${WORKING_TOPOLOGY} -d ${INSTALLATION_DIR} -p ${VPP_DEBS}
114 if [ $? -eq 0 ]; then
115 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
117 echo "Failed to copy vpp deb files to DUTs"
121 # Based on job we will identify DUT
122 if [[ ${JOB_NAME} == *hc2vpp* ]] ;
125 elif [[ ${JOB_NAME} == *vpp* ]] ;
128 elif [[ ${JOB_NAME} == *ligato* ]] ;
131 elif [[ ${JOB_NAME} == *dpdk* ]] ;
135 echo "Unable to identify dut type based on JOB_NAME variable: ${JOB_NAME}"
139 PYBOT_ARGS="--consolewidth 120 --loglevel TRACE --variable TOPOLOGY_PATH:${WORKING_TOPOLOGY} --suite tests.${DUT}.perf"
142 # select specific performance tests based on jenkins job type variable
144 TAGS=('ndrdiscANDnic_intel-x520-da2AND1t1c'
145 'ndrdiscANDnic_intel-x520-da2AND2t2c'
146 'ndrpdrANDnic_intel-x520-da2AND1t1c'
147 'ndrpdrANDnic_intel-x520-da2AND2t2c'
148 'ndrdiscAND1t1cANDipsec'
149 'ndrdiscAND2t2cANDipsec')
151 PERFTEST_SEMI_WEEKLY )
152 TAGS=('ndrdiscANDnic_intel-x710AND1t1c'
153 'ndrdiscANDnic_intel-x710AND2t2c'
154 'ndrdiscANDnic_intel-xl710AND1t1c'
155 'ndrdiscANDnic_intel-xl710AND2t2c')
158 TAGS=('mrrAND64bAND1t1c'
164 'mrrANDimixAND1t1cANDvhost'
165 'mrrANDimixAND2t2cANDvhost'
166 'mrrANDimixAND4t4cANDvhost'
167 'mrrANDimixAND1t1cANDmemif'
168 'mrrANDimixAND2t2cANDmemif'
169 'mrrANDimixAND4t4cANDmemif')
171 VERIFY-PERF-NDRDISC )
172 TAGS=('ndrdiscAND1t1c'
175 VERIFY-PERF-PDRDISC )
176 TAGS=('pdrdiscAND1t1c'
184 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDip4base'
185 'mrrANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m')
188 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDip6base'
189 'mrrANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m')
192 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDl2xcbase'
193 'mrrANDnic_intel-x520-da2AND1t1cANDl2bdbase'
197 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDlisp')
200 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDvxlan')
203 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDvhost'
207 TAGS=('pdrdiscANDnic_intel-x520-da2AND1t1cANDmemif'
208 'pdrdiscANDnic_intel-x520-da2AND2t2cANDmemif'
209 'mrrANDnic_intel-x520-da2AND1t1cANDmemif'
210 'mrrANDnic_intel-x520-da2AND2t2cANDmemif')
212 VERIFY-PERF-IPSECHW )
213 TAGS=('pdrdiscANDnic_intel-xl710AND1t1cANDipsechw'
214 'pdrdiscANDnic_intel-xl710AND2t2cANDipsechw'
215 'mrrANDnic_intel-xl710AND1t1cANDipsechw'
216 'mrrANDnic_intel-xl710AND2t2cANDipsechw')
219 TAGS=('mrrANDsrv6AND1t1c'
222 VPP-VERIFY-PERF-IP4 )
223 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDip4base'
224 'mrrANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m')
226 VPP-VERIFY-PERF-IP6 )
227 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDip6base'
228 'mrrANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m')
231 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDl2xcbase'
232 'mrrANDnic_intel-x520-da2AND1t1cANDl2bdbase'
233 'mrrANDnic_intel-x520-da2AND1t1cANDdot1q'
236 VPP-VERIFY-PERF-LISP )
237 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDlisp')
239 VPP-VERIFY-PERF-VXLAN )
240 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDvxlan')
242 VPP-VERIFY-PERF-VHOST )
243 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDvhost'
246 VPP-VERIFY-PERF-MEMIF )
247 TAGS=('pdrdiscANDnic_intel-x520-da2AND1t1cANDmemif'
248 'pdrdiscANDnic_intel-x520-da2AND2t2cANDmemif'
249 'mrrANDnic_intel-x520-da2AND1t1cANDmemif'
250 'mrrANDnic_intel-x520-da2AND2t2cANDmemif')
252 VPP-VERIFY-PERF-ACL )
253 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDacl'
254 'mrrANDnic_intel-x520-da2AND2t2cANDacl')
256 VPP-VERIFY-PERF-IPSECHW )
257 TAGS=('pdrdiscANDnic_intel-xl710AND1t1cANDipsechw'
258 'pdrdiscANDnic_intel-xl710AND2t2cANDipsechw'
259 'mrrANDnic_intel-xl710AND1t1cANDipsechw'
260 'mrrANDnic_intel-xl710AND2t2cANDipsechw')
262 VPP-VERIFY-PERF-SRV6 )
263 TAGS=('mrrANDsrv6AND1t1c'
267 if [[ -z "$TEST_TAG_STRING" ]]; then
268 # If nothing is specified, we will run pre-selected tests by
269 # following tags. Items of array will be concatenated by OR in Robot
271 TEST_TAG_ARRAY=('mrrANDnic_intel-x710AND1t1cAND64bANDip4base'
272 'mrrANDnic_intel-x710AND1t1cAND78bANDip6base'
273 'mrrANDnic_intel-x710AND1t1cAND64bANDl2bdbase')
275 # If trigger contains tags, split them into array.
276 TEST_TAG_ARRAY=(${TEST_TAG_STRING//:/ })
281 for TAG in "${TEST_TAG_ARRAY[@]}"; do
282 if [[ ${TAG} == "!"* ]]; then
283 # Exclude tags are not prefixed.
286 # We will prefix with perftest to prevent running other tests
289 if [[ ${JOB_NAME} == vpp-* ]] ; then
290 # Automatic prefixing for VPP jobs to limit the NIC used and
291 # traffic evaluation to MRR.
292 prefix="${prefix}mrrANDnic_intel-x710AND"
294 TAGS+=("$prefix${TAG}")
302 # Catenate TAG selections
304 for TAG in "${TAGS[@]}"; do
305 if [[ ${TAG} == "!"* ]]; then
306 EXPANDED_TAGS+=(" --exclude ${TAG#$"!"} ")
308 EXPANDED_TAGS+=(" --include ${TAG} ")
313 pybot ${PYBOT_ARGS}${EXPANDED_TAGS[@]} tests/
314 RETURN_STATUS=$(echo $?)
316 # Archive JOB artifacts in jenkins
317 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
318 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
320 # Archive JOB artifacts to logs.fd.io
321 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
322 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
325 exit ${RETURN_STATUS}