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_testbed3.yaml"
20 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
23 RESERVATION_DIR="/tmp/reservation_dir"
24 INSTALLATION_DIR="/tmp/install_dir"
26 PYBOT_ARGS="-W 150 -L TRACE"
28 JOB_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
29 LOG_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
30 JOB_ARCHIVE_DIR="archive"
31 LOG_ARCHIVE_DIR="$WORKSPACE/archives"
32 mkdir -p ${JOB_ARCHIVE_DIR}
33 mkdir -p ${LOG_ARCHIVE_DIR}
35 # If we run this script from CSIT jobs we want to use stable vpp version
36 if [[ ${JOB_NAME} == csit-* ]] ;
41 if [[ ${TEST_TAG} == *DAILY ]] || \
42 [[ ${TEST_TAG} == *WEEKLY ]];
44 # Download the latest VPP build .deb install packages
45 echo Downloading VPP packages...
46 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh --skip-install
48 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
49 # Take vpp package and get the vpp version
50 VPP_STABLE_VER="$( expr match $(ls *.deb | head -n 1) 'vpp-\(.*\)-deb.deb' )"
52 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)_amd64
53 VPP_REPO_URL=$(cat ${SCRIPT_DIR}/VPP_REPO_URL_UBUNTU)
54 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER_UBUNTU)
56 # Download vpp build from nexus and set VPP_DEBS variable
57 wget -q "${VPP_REPO_URL}/vpp/${VPP_STABLE_VER}/vpp-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
58 wget -q "${VPP_REPO_URL}/vpp-dbg/${VPP_STABLE_VER}/vpp-dbg-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
59 wget -q "${VPP_REPO_URL}/vpp-dev/${VPP_STABLE_VER}/vpp-dev-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
60 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${DPDK_STABLE_VER}/vpp-dpdk-dkms-${DPDK_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
61 wget -q "${VPP_REPO_URL}/vpp-lib/${VPP_STABLE_VER}/vpp-lib-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
62 wget -q "${VPP_REPO_URL}/vpp-plugins/${VPP_STABLE_VER}/vpp-plugins-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
63 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
68 # If we run this script from vpp project we want to use local build
69 elif [[ ${JOB_NAME} == vpp-* ]] ;
71 # Use local packages provided as argument list
72 # Jenkins VPP deb paths (convert to full path)
73 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
74 # Take vpp package and get the vpp version
75 VPP_STABLE_VER="$( expr match $1 'vpp-\(.*\)-deb.deb' )"
77 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
82 export PYTHONPATH=${SCRIPT_DIR}
84 sudo apt-get -y update
85 sudo apt-get -y install libpython2.7-dev python-virtualenv
87 virtualenv --system-site-packages env
91 pip install -r requirements.txt
93 # We iterate over available topologies and wait until we reserve topology
95 for TOPOLOGY in ${TOPOLOGIES};
97 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
99 WORKING_TOPOLOGY=${TOPOLOGY}
100 echo "Reserved: ${WORKING_TOPOLOGY}"
105 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
106 # Exit the infinite while loop if we made a reservation
110 # Wait ~3minutes before next try
111 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
112 echo "Sleeping ${SLEEP_TIME}"
116 function cancel_all {
117 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
118 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
121 # On script exit we cancel the reservation and installation and delete all vpp
123 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
125 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -t ${WORKING_TOPOLOGY} \
126 -d ${INSTALLATION_DIR} \
128 if [ $? -eq 0 ]; then
129 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
131 echo "Failed to copy vpp deb files to DUTs"
136 # run specific performance tests based on jenkins job type variable
138 pybot ${PYBOT_ARGS} \
139 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
140 -s "tests.vpp.perf" \
141 --include ndrdiscANDnic_intel-x520-da2AND1t1cORndrdiscANDnic_intel-x520-da2AND2t2c \
142 --include ndrdiscAND1t1cANDipsecORndrdiscAND2t2cANDipsec \
144 RETURN_STATUS=$(echo $?)
146 PERFTEST_SEMI_WEEKLY )
147 pybot ${PYBOT_ARGS} \
148 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
149 -s "tests.vpp.perf" \
150 --include ndrdiscANDnic_intel-x710AND1t1cORndrdiscANDnic_intel-x710AND2t2cORndrdiscANDnic_intel-xl710AND1t1cORndrdiscANDnic_intel-xl710AND2t2c \
152 RETURN_STATUS=$(echo $?)
155 pybot ${PYBOT_ARGS} \
156 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
157 -s "tests.vpp.perf" \
158 --include mrrAND64bAND1t1c \
159 --include mrrAND64bAND2t2c \
160 --include mrrAND64bAND4t4c \
161 --include mrrAND78bAND1t1c \
162 --include mrrAND78bAND2t2c \
163 --include mrrAND78bAND4t4c \
164 --include mrrANDimixAND1t1cANDvhost \
165 --include mrrANDimixAND2t2cANDvhost \
166 --include mrrANDimixAND4t4cANDvhost \
167 --include mrrANDimixAND1t1cANDmemif \
168 --include mrrANDimixAND2t2cANDmemif \
169 --include mrrANDimixAND4t4cANDmemif \
171 RETURN_STATUS=$(echo $?)
173 VERIFY-PERF-NDRDISC )
174 pybot ${PYBOT_ARGS} \
175 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
176 -s "tests.vpp.perf" \
177 --include ndrdiscAND1t1cORndrdiscAND2t2c \
179 RETURN_STATUS=$(echo $?)
181 VERIFY-PERF-PDRDISC )
182 pybot ${PYBOT_ARGS} \
183 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
184 -s "tests.vpp.perf" \
185 --include pdrdiscAND1t1cORpdrdiscAND2t2c \
187 RETURN_STATUS=$(echo $?)
190 pybot ${PYBOT_ARGS} \
191 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
192 -s "tests.vpp.perf" \
193 --include mrrAND1t1cORmrrAND2t2c \
195 RETURN_STATUS=$(echo $?)
198 pybot ${PYBOT_ARGS} \
199 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
200 -s "tests.vpp.perf" \
201 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip4baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
203 RETURN_STATUS=$(echo $?)
206 pybot ${PYBOT_ARGS} \
207 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
208 -s "tests.vpp.perf" \
209 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip6baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
211 RETURN_STATUS=$(echo $?)
214 pybot ${PYBOT_ARGS} \
215 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
216 -s "tests.vpp.perf" \
217 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDl2xcbaseORndrdiscANDnic_intel-x520-da2AND1t1cANDl2bdbase \
219 RETURN_STATUS=$(echo $?)
222 pybot ${PYBOT_ARGS} \
223 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
224 -s "tests.vpp.perf" \
225 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDlisp \
227 RETURN_STATUS=$(echo $?)
230 pybot ${PYBOT_ARGS} \
231 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
232 -s "tests.vpp.perf" \
233 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvxlan \
235 RETURN_STATUS=$(echo $?)
238 pybot ${PYBOT_ARGS} \
239 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
240 -s "tests.vpp.perf" \
241 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
243 RETURN_STATUS=$(echo $?)
246 pybot ${PYBOT_ARGS} \
247 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
248 -s "tests.vpp.perf" \
249 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDmemif \
251 RETURN_STATUS=$(echo $?)
253 VERIFY-PERF-IPSECHW )
254 pybot ${PYBOT_ARGS} \
255 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
256 -s "tests.vpp.perf.crypto" \
257 --include ndrdiscANDnic_intel-xl710AND1t1cANDipsechw \
258 --include ndrdiscANDnic_intel-xl710AND2t2cANDipsechw \
259 --include mrrANDnic_intel-xl710AND1t1cANDipsechw \
260 --include mrrANDnic_intel-xl710AND2t2cANDipsechw \
262 RETURN_STATUS=$(echo $?)
264 VPP-VERIFY-PERF-IP4 )
265 pybot ${PYBOT_ARGS} \
266 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
267 -s "tests.vpp.perf" \
268 --include mrrANDnic_intel-x520-da2AND1t1cANDip4baseORmrrANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
270 RETURN_STATUS=$(echo $?)
272 VPP-VERIFY-PERF-IP6 )
273 pybot ${PYBOT_ARGS} \
274 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
275 -s "tests.vpp.perf" \
276 --include mrrANDnic_intel-x520-da2AND1t1cANDip6baseORmrrANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
278 RETURN_STATUS=$(echo $?)
281 pybot ${PYBOT_ARGS} \
282 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
283 -s "tests.vpp.perf" \
284 --include mrrANDnic_intel-x520-da2AND1t1cANDl2xcbaseORmrrANDnic_intel-x520-da2AND1t1cANDl2bdbase \
286 RETURN_STATUS=$(echo $?)
288 VPP-VERIFY-PERF-LISP )
289 pybot ${PYBOT_ARGS} \
290 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
291 -s "tests.vpp.perf" \
292 --include pdrchkANDnic_intel-x520-da2AND1t1cANDlisp \
294 RETURN_STATUS=$(echo $?)
296 VPP-VERIFY-PERF-VXLAN )
297 pybot ${PYBOT_ARGS} \
298 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
299 -s "tests.vpp.perf" \
300 --include pdrchkANDnic_intel-x520-da2AND1t1cANDvxlan \
302 RETURN_STATUS=$(echo $?)
304 VPP-VERIFY-PERF-VHOST )
305 pybot ${PYBOT_ARGS} \
306 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
307 -s "tests.vpp.perf" \
308 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
310 RETURN_STATUS=$(echo $?)
312 VPP-VERIFY-PERF-MEMIF )
313 pybot ${PYBOT_ARGS} \
314 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
315 -s "tests.vpp.perf" \
316 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDmemif \
317 --include pdrdiscANDnic_intel-x520-da2AND2t2cANDmemif \
318 --include mrrANDnic_intel-x520-da2AND1t1cANDmemif \
319 --include mrrANDnic_intel-x520-da2AND2t2cANDmemif \
321 RETURN_STATUS=$(echo $?)
323 VPP-VERIFY-PERF-ACL )
324 pybot ${PYBOT_ARGS} \
325 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
326 -s "tests.vpp.perf" \
327 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDacl \
328 --include pdrdiscANDnic_intel-x520-da2AND2t2cANDacl \
330 RETURN_STATUS=$(echo $?)
332 VPP-VERIFY-PERF-IPSECHW )
333 pybot ${PYBOT_ARGS} \
334 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
335 -s "tests.vpp.perf.crypto" \
336 --include pdrdiscANDnic_intel-xl710AND1t1cANDipsechw \
337 --include pdrdiscANDnic_intel-xl710AND2t2cANDipsechw \
338 --include mrrANDnic_intel-xl710AND1t1cANDipsechw \
339 --include mrrANDnic_intel-xl710AND2t2cANDipsechw \
341 RETURN_STATUS=$(echo $?)
344 # run full performance test suite and exit on fail
345 pybot ${PYBOT_ARGS} \
346 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
347 -s "tests.vpp.perf" \
350 RETURN_STATUS=$(echo $?)
353 # Archive JOB artifacts in jenkins
354 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
355 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
357 # Archive JOB artifacts to logs.fd.io
358 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
359 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
362 exit ${RETURN_STATUS}