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_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)
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-* ]] ;
43 if [[ ${TEST_TAG} == *DAILY ]] || \
44 [[ ${TEST_TAG} == *WEEKLY ]];
46 # Download the latest VPP build .deb install packages
47 echo Downloading VPP packages...
48 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh --skip-install
50 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
51 # Take vpp package and get the vpp version
52 VPP_STABLE_VER="$( expr match $(ls *.deb | head -n 1) 'vpp-\(.*\)-deb.deb' )"
54 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)_amd64
55 VPP_REPO_URL=$(cat ${SCRIPT_DIR}/VPP_REPO_URL_UBUNTU)
56 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER_UBUNTU)
58 # Download vpp build from nexus and set VPP_DEBS variable
59 wget -q "${VPP_REPO_URL}/vpp/${VPP_STABLE_VER}/vpp-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
60 wget -q "${VPP_REPO_URL}/vpp-dbg/${VPP_STABLE_VER}/vpp-dbg-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
61 wget -q "${VPP_REPO_URL}/vpp-dev/${VPP_STABLE_VER}/vpp-dev-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
62 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${DPDK_STABLE_VER}/vpp-dpdk-dkms-${DPDK_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
63 wget -q "${VPP_REPO_URL}/vpp-lib/${VPP_STABLE_VER}/vpp-lib-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
64 wget -q "${VPP_REPO_URL}/vpp-plugins/${VPP_STABLE_VER}/vpp-plugins-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
65 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
70 # If we run this script from vpp project we want to use local build
71 elif [[ ${JOB_NAME} == vpp-* ]] ;
73 # Use local packages provided as argument list
74 # Jenkins VPP deb paths (convert to full path)
75 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
76 # Take vpp package and get the vpp version
77 VPP_STABLE_VER="$( expr match $1 'vpp-\(.*\)-deb.deb' )"
79 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
84 export PYTHONPATH=${SCRIPT_DIR}
86 sudo apt-get -y update
87 sudo apt-get -y install libpython2.7-dev python-virtualenv
89 virtualenv --system-site-packages env
93 pip install -r requirements.txt
95 # We iterate over available topologies and wait until we reserve topology
97 for TOPOLOGY in ${TOPOLOGIES};
99 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
100 if [ $? -eq 0 ]; then
101 WORKING_TOPOLOGY=${TOPOLOGY}
102 echo "Reserved: ${WORKING_TOPOLOGY}"
107 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
108 # Exit the infinite while loop if we made a reservation
112 # Wait ~3minutes before next try
113 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
114 echo "Sleeping ${SLEEP_TIME}"
118 function cancel_all {
119 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
120 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
123 # On script exit we cancel the reservation and installation and delete all vpp
125 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
127 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -t ${WORKING_TOPOLOGY} \
128 -d ${INSTALLATION_DIR} \
130 if [ $? -eq 0 ]; then
131 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
133 echo "Failed to copy vpp deb files to DUTs"
138 # run specific performance tests based on jenkins job type variable
140 pybot ${PYBOT_ARGS} \
141 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
142 -s "tests.vpp.perf" \
143 --include ndrdiscANDnic_intel-x520-da2AND1t1cORndrdiscANDnic_intel-x520-da2AND2t2c \
144 --include ndrdiscAND1t1cANDipsecORndrdiscAND2t2cANDipsec \
146 RETURN_STATUS=$(echo $?)
148 PERFTEST_SEMI_WEEKLY )
149 pybot ${PYBOT_ARGS} \
150 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
151 -s "tests.vpp.perf" \
152 --include ndrdiscANDnic_intel-x710AND1t1cORndrdiscANDnic_intel-x710AND2t2cORndrdiscANDnic_intel-xl710AND1t1cORndrdiscANDnic_intel-xl710AND2t2c \
154 RETURN_STATUS=$(echo $?)
157 pybot ${PYBOT_ARGS} \
158 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
159 -s "tests.vpp.perf" \
160 --include mrrAND64bAND1t1c \
161 --include mrrAND64bAND2t2c \
162 --include mrrAND64bAND4t4c \
163 --include mrrAND78bAND1t1c \
164 --include mrrAND78bAND2t2c \
165 --include mrrAND78bAND4t4c \
167 RETURN_STATUS=$(echo $?)
169 VERIFY-PERF-NDRDISC )
170 pybot ${PYBOT_ARGS} \
171 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
172 -s "tests.vpp.perf" \
173 --include ndrdiscAND1t1cORndrdiscAND2t2c \
175 RETURN_STATUS=$(echo $?)
177 VERIFY-PERF-PDRDISC )
178 pybot ${PYBOT_ARGS} \
179 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
180 -s "tests.vpp.perf" \
181 --include pdrdiscAND1t1cORpdrdiscAND2t2c \
183 RETURN_STATUS=$(echo $?)
186 pybot ${PYBOT_ARGS} \
187 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
188 -s "tests.vpp.perf" \
189 --include mrrAND1t1cORmrrAND2t2c \
191 RETURN_STATUS=$(echo $?)
194 pybot ${PYBOT_ARGS} \
195 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
196 -s "tests.vpp.perf" \
197 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip4baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
199 RETURN_STATUS=$(echo $?)
202 pybot ${PYBOT_ARGS} \
203 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
204 -s "tests.vpp.perf" \
205 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip6baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
207 RETURN_STATUS=$(echo $?)
210 pybot ${PYBOT_ARGS} \
211 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
212 -s "tests.vpp.perf" \
213 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDl2xcbaseORndrdiscANDnic_intel-x520-da2AND1t1cANDl2bdbase \
215 RETURN_STATUS=$(echo $?)
218 pybot ${PYBOT_ARGS} \
219 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
220 -s "tests.vpp.perf" \
221 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDlisp \
223 RETURN_STATUS=$(echo $?)
226 pybot ${PYBOT_ARGS} \
227 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
228 -s "tests.vpp.perf" \
229 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvxlan \
231 RETURN_STATUS=$(echo $?)
234 pybot ${PYBOT_ARGS} \
235 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
236 -s "tests.vpp.perf" \
237 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
239 RETURN_STATUS=$(echo $?)
242 pybot ${PYBOT_ARGS} \
243 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
244 -s "tests.vpp.perf" \
245 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDmemif \
247 RETURN_STATUS=$(echo $?)
249 VERIFY-PERF-IPSECHW )
250 pybot ${PYBOT_ARGS} \
251 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
252 -s "tests.vpp.perf.crypto" \
253 --include ndrdiscANDnic_intel-xl710AND1t1cANDipsechw \
254 --include ndrdiscANDnic_intel-xl710AND2t2cANDipsechw \
256 RETURN_STATUS=$(echo $?)
258 VPP-VERIFY-PERF-IP4 )
259 pybot ${PYBOT_ARGS} \
260 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
261 -s "tests.vpp.perf" \
262 --include mrrANDnic_intel-x520-da2AND1t1cANDip4baseORmrrANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
264 RETURN_STATUS=$(echo $?)
266 VPP-VERIFY-PERF-IP6 )
267 pybot ${PYBOT_ARGS} \
268 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
269 -s "tests.vpp.perf" \
270 --include mrrANDnic_intel-x520-da2AND1t1cANDip6baseORmrrANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
272 RETURN_STATUS=$(echo $?)
275 pybot ${PYBOT_ARGS} \
276 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
277 -s "tests.vpp.perf" \
278 --include mrrANDnic_intel-x520-da2AND1t1cANDl2xcbaseORmrrANDnic_intel-x520-da2AND1t1cANDl2bdbase \
280 RETURN_STATUS=$(echo $?)
282 VPP-VERIFY-PERF-LISP )
283 pybot ${PYBOT_ARGS} \
284 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
285 -s "tests.vpp.perf" \
286 --include pdrchkANDnic_intel-x520-da2AND1t1cANDlisp \
288 RETURN_STATUS=$(echo $?)
290 VPP-VERIFY-PERF-VXLAN )
291 pybot ${PYBOT_ARGS} \
292 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
293 -s "tests.vpp.perf" \
294 --include pdrchkANDnic_intel-x520-da2AND1t1cANDvxlan \
296 RETURN_STATUS=$(echo $?)
298 VPP-VERIFY-PERF-VHOST )
299 pybot ${PYBOT_ARGS} \
300 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
301 -s "tests.vpp.perf" \
302 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
304 RETURN_STATUS=$(echo $?)
306 VPP-VERIFY-PERF-MEMIF )
307 pybot ${PYBOT_ARGS} \
308 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
309 -s "tests.vpp.perf" \
310 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDmemif \
311 --include pdrdiscANDnic_intel-x520-da2AND2t2cANDmemif \
312 --include mrrANDnic_intel-x520-da2AND1t1cANDmemif \
313 --include mrrANDnic_intel-x520-da2AND2t2cANDmemif \
315 RETURN_STATUS=$(echo $?)
317 VPP-VERIFY-PERF-ACL )
318 pybot ${PYBOT_ARGS} \
319 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
320 -s "tests.vpp.perf" \
321 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDacl \
322 --include pdrdiscANDnic_intel-x520-da2AND2t2cANDacl \
324 RETURN_STATUS=$(echo $?)
326 VPP-VERIFY-PERF-IPSECHW )
327 pybot ${PYBOT_ARGS} \
328 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
329 -s "tests.vpp.perf.crypto" \
330 --include pdrdiscANDnic_intel-xl710AND1t1cANDipsechw \
331 --include pdrdiscANDnic_intel-xl710AND2t2cANDipsechw \
333 RETURN_STATUS=$(echo $?)
336 # run full performance test suite and exit on fail
337 pybot ${PYBOT_ARGS} \
338 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
339 -s "tests.vpp.perf" \
341 RETURN_STATUS=$(echo $?)
344 # Archive JOB artifacts in jenkins
345 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
346 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
348 # Archive JOB artifacts to logs.fd.io
349 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
350 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
353 exit ${RETURN_STATUS}