2 # Copyright (c) 2017 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_testbed1.yaml \
19 topologies/available/lf_testbed2.yaml \
20 topologies/available/lf_testbed3.yaml"
22 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
25 RESERVATION_DIR="/tmp/reservation_dir"
26 INSTALLATION_DIR="/tmp/install_dir"
28 PYBOT_ARGS="-W 150 -L TRACE"
30 JOB_ARCHIVE_ARTIFACTS=(log.html output.xml report.html output_perf_data.xml)
31 LOG_ARCHIVE_ARTIFACTS=(output.xml)
32 LOG_ARCHIVES_DIR="$WORKSPACE/archives"
33 mkdir -p ${LOG_ARCHIVES_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 $?)
145 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
146 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVES_DIR}/${i}.log
149 PERFTEST_SEMI_WEEKLY )
150 pybot ${PYBOT_ARGS} \
151 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
152 -s "tests.vpp.perf" \
153 --include ndrdiscANDnic_intel-x710AND1t1cORndrdiscANDnic_intel-x710AND2t2cORndrdiscANDnic_intel-xl710AND1t1cORndrdiscANDnic_intel-xl710AND2t2c \
155 RETURN_STATUS=$(echo $?)
156 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
157 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVES_DIR}/${i}.log
160 VERIFY-PERF-NDRDISC )
161 pybot ${PYBOT_ARGS} \
162 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
163 -s "tests.vpp.perf" \
164 --include ndrdiscAND1t1cORndrdiscAND2t2c \
166 RETURN_STATUS=$(echo $?)
168 VERIFY-PERF-PDRDISC )
169 pybot ${PYBOT_ARGS} \
170 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
171 -s "tests.vpp.perf" \
172 --include pdrdiscAND1t1cORpdrdiscAND2t2c \
174 RETURN_STATUS=$(echo $?)
177 pybot ${PYBOT_ARGS} \
178 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
179 -s "tests.vpp.perf" \
180 --include mrrAND1t1cORmrrAND2t2c \
182 RETURN_STATUS=$(echo $?)
185 pybot ${PYBOT_ARGS} \
186 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
187 -s "tests.vpp.perf" \
188 --include mrrAND1t1cORmrrAND2t2c \
190 RETURN_STATUS=$(echo $?)
191 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
192 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVES_DIR}/${i}.log
196 pybot ${PYBOT_ARGS} \
197 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
198 -s "tests.vpp.perf" \
199 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip4baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
201 RETURN_STATUS=$(echo $?)
204 pybot ${PYBOT_ARGS} \
205 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
206 -s "tests.vpp.perf" \
207 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip6baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
209 RETURN_STATUS=$(echo $?)
212 pybot ${PYBOT_ARGS} \
213 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
214 -s "tests.vpp.perf" \
215 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDl2xcbaseORndrdiscANDnic_intel-x520-da2AND1t1cANDl2bdbase \
217 RETURN_STATUS=$(echo $?)
220 pybot ${PYBOT_ARGS} \
221 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
222 -s "tests.vpp.perf" \
223 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDlisp \
225 RETURN_STATUS=$(echo $?)
228 pybot ${PYBOT_ARGS} \
229 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
230 -s "tests.vpp.perf" \
231 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvxlan \
233 RETURN_STATUS=$(echo $?)
236 pybot ${PYBOT_ARGS} \
237 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
238 -s "tests.vpp.perf" \
239 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
241 RETURN_STATUS=$(echo $?)
244 pybot ${PYBOT_ARGS} \
245 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
246 -s "tests.vpp.perf" \
247 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDmemif \
249 RETURN_STATUS=$(echo $?)
251 VERIFY-PERF-IPSECHW )
252 pybot ${PYBOT_ARGS} \
253 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
254 -s "tests.vpp.perf.crypto" \
255 --include ndrdiscANDnic_intel-xl710AND1t1cANDipsechw \
256 --include ndrdiscANDnic_intel-xl710AND2t2cANDipsechw \
259 VPP-VERIFY-PERF-IP4 )
260 pybot ${PYBOT_ARGS} \
261 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
262 -s "tests.vpp.perf" \
263 --include mrrANDnic_intel-x520-da2AND1t1cANDip4baseORmrrANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
265 RETURN_STATUS=$(echo $?)
267 VPP-VERIFY-PERF-IP6 )
268 pybot ${PYBOT_ARGS} \
269 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
270 -s "tests.vpp.perf" \
271 --include mrrANDnic_intel-x520-da2AND1t1cANDip6baseORmrrANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
273 RETURN_STATUS=$(echo $?)
276 pybot ${PYBOT_ARGS} \
277 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
278 -s "tests.vpp.perf" \
279 --include mrrANDnic_intel-x520-da2AND1t1cANDl2xcbaseORmrrANDnic_intel-x520-da2AND1t1cANDl2bdbase \
281 RETURN_STATUS=$(echo $?)
283 VPP-VERIFY-PERF-LISP )
284 pybot ${PYBOT_ARGS} \
285 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
286 -s "tests.vpp.perf" \
287 --include pdrchkANDnic_intel-x520-da2AND1t1cANDlisp \
289 RETURN_STATUS=$(echo $?)
291 VPP-VERIFY-PERF-VXLAN )
292 pybot ${PYBOT_ARGS} \
293 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
294 -s "tests.vpp.perf" \
295 --include pdrchkANDnic_intel-x520-da2AND1t1cANDvxlan \
297 RETURN_STATUS=$(echo $?)
299 VPP-VERIFY-PERF-VHOST )
300 pybot ${PYBOT_ARGS} \
301 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
302 -s "tests.vpp.perf" \
303 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
305 RETURN_STATUS=$(echo $?)
307 VPP-VERIFY-PERF-MEMIF )
308 pybot ${PYBOT_ARGS} \
309 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
310 -s "tests.vpp.perf" \
311 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDmemif \
312 --include pdrdiscANDnic_intel-x520-da2AND2t2cANDmemif \
313 --include mrrANDnic_intel-x520-da2AND1t1cANDmemif \
314 --include mrrANDnic_intel-x520-da2AND2t2cANDmemif \
316 RETURN_STATUS=$(echo $?)
318 VPP-VERIFY-PERF-ACL )
319 pybot ${PYBOT_ARGS} \
320 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
321 -s "tests.vpp.perf" \
322 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDacl \
323 --include pdrdiscANDnic_intel-x520-da2AND2t2cANDacl \
325 RETURN_STATUS=$(echo $?)
327 VPP-VERIFY-PERF-IPSECHW )
328 pybot ${PYBOT_ARGS} \
329 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
330 -s "tests.vpp.perf.crypto" \
331 --include pdrdiscANDnic_intel-xl710AND1t1cANDipsechw \
332 --include pdrdiscANDnic_intel-xl710AND2t2cANDipsechw \
334 RETURN_STATUS=$(echo $?)
337 pybot ${PYBOT_ARGS} \
338 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
339 -s "tests.vpp.perf" \
340 --exclude SKIP_PATCH \
343 RETURN_STATUS=$(echo $?)
346 pybot ${PYBOT_ARGS} \
347 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
348 -s "tests.vpp.perf" \
351 RETURN_STATUS=$(echo $?)
354 # run full performance test suite and exit on fail
355 pybot ${PYBOT_ARGS} \
356 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
357 -s "tests.vpp.perf" \
359 RETURN_STATUS=$(echo $?)
362 # Pybot output post-processing
363 echo Post-processing test data...
365 python ${SCRIPT_DIR}/resources/tools/scripts/robot_output_parser.py \
366 -i ${SCRIPT_DIR}/output.xml \
367 -o ${SCRIPT_DIR}/output_perf_data.xml \
369 if [ ! $? -eq 0 ]; then
370 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
375 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
376 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
379 echo Post-processing finished.
381 exit ${RETURN_STATUS}