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 ARCHIVE_ARTIFACTS=(log.html output.xml report.html output_perf_data.xml output_perf_data.json)
32 # If we run this script from CSIT jobs we want to use stable vpp version
33 if [[ ${JOB_NAME} == csit-* ]] ;
38 if [[ ${TEST_TAG} == *NIGHTLY ]] || \
39 [[ ${TEST_TAG} == *DAILY ]] || \
40 [[ ${TEST_TAG} == *WEEKLY ]];
42 # Download the latest VPP build .deb install packages
43 echo Downloading VPP packages...
44 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh --skip-install
46 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
47 # Take vpp package and get the vpp version
48 VPP_STABLE_VER="$( expr match $(ls *.deb | head -n 1) 'vpp-\(.*\)-deb.deb' )"
50 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)_amd64
51 VPP_REPO_URL=$(cat ${SCRIPT_DIR}/VPP_REPO_URL_UBUNTU)
52 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER_UBUNTU)
54 # Download vpp build from nexus and set VPP_DEBS variable
55 wget -q "${VPP_REPO_URL}/vpp/${VPP_STABLE_VER}/vpp-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
56 wget -q "${VPP_REPO_URL}/vpp-dbg/${VPP_STABLE_VER}/vpp-dbg-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
57 wget -q "${VPP_REPO_URL}/vpp-dev/${VPP_STABLE_VER}/vpp-dev-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
58 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${DPDK_STABLE_VER}/vpp-dpdk-dkms-${DPDK_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
59 wget -q "${VPP_REPO_URL}/vpp-lib/${VPP_STABLE_VER}/vpp-lib-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
60 wget -q "${VPP_REPO_URL}/vpp-plugins/${VPP_STABLE_VER}/vpp-plugins-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
61 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
66 # If we run this script from vpp project we want to use local build
67 elif [[ ${JOB_NAME} == vpp-* ]] ;
69 # Use local packages provided as argument list
70 # Jenkins VPP deb paths (convert to full path)
71 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
72 # Take vpp package and get the vpp version
73 VPP_STABLE_VER="$( expr match $1 'vpp-\(.*\)-deb.deb' )"
74 # Download DPDK parts not included in dpdk plugin of vpp build
75 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)_amd64
76 VPP_REPO_URL=$(cat ${SCRIPT_DIR}/VPP_REPO_URL_UBUNTU)
78 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${DPDK_STABLE_VER}/vpp-dpdk-dkms-${DPDK_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
79 VPP_DEBS+=($( readlink -f vpp-dpdk-dkms-${DPDK_STABLE_VER}${VPP_CLASSIFIER}.deb ))
81 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
86 export PYTHONPATH=${SCRIPT_DIR}
88 sudo apt-get -y update
89 sudo apt-get -y install libpython2.7-dev python-virtualenv
91 virtualenv --system-site-packages env
95 pip install -r requirements.txt
97 # We iterate over available topologies and wait until we reserve topology
99 for TOPOLOGY in ${TOPOLOGIES};
101 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
102 if [ $? -eq 0 ]; then
103 WORKING_TOPOLOGY=${TOPOLOGY}
104 echo "Reserved: ${WORKING_TOPOLOGY}"
109 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
110 # Exit the infinite while loop if we made a reservation
114 # Wait ~3minutes before next try
115 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
116 echo "Sleeping ${SLEEP_TIME}"
120 function cancel_all {
121 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
122 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
125 # On script exit we cancel the reservation and installation and delete all vpp
127 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
129 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -t ${WORKING_TOPOLOGY} \
130 -d ${INSTALLATION_DIR} \
132 if [ $? -eq 0 ]; then
133 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
135 echo "Failed to copy vpp deb files to DUTs"
140 # run specific performance tests based on jenkins job type variable
142 pybot ${PYBOT_ARGS} \
143 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
144 -s "tests.vpp.perf" \
145 --include ndrdiscANDnic_intel-x520-da2AND1t1cORndrdiscANDnic_intel-x520-da2AND2t2c \
147 RETURN_STATUS=$(echo $?)
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 $?)
157 VERIFY-PERF-NDRDISC )
158 pybot ${PYBOT_ARGS} \
159 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
160 -s "tests.vpp.perf" \
161 --include ndrdiscAND1t1cORndrdiscAND2t2c \
163 RETURN_STATUS=$(echo $?)
165 VERIFY-PERF-PDRDISC )
166 pybot ${PYBOT_ARGS} \
167 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
168 -s "tests.vpp.perf" \
169 --include pdrdiscAND1t1cORpdrdiscAND2t2c \
171 RETURN_STATUS=$(echo $?)
174 pybot ${PYBOT_ARGS} \
175 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
176 -s "tests.vpp.perf" \
177 --include ndrchkAND1t1cORndrchkAND2t2c \
179 RETURN_STATUS=$(echo $?)
181 PERFTEST_NDRCHK_DAILY )
182 pybot ${PYBOT_ARGS} \
183 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
184 -s "tests.vpp.perf" \
185 --include ndrchkAND1t1cORndrchkAND2t2c \
187 RETURN_STATUS=$(echo $?)
190 pybot ${PYBOT_ARGS} \
191 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
192 -s "tests.vpp.perf" \
193 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip4baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
195 RETURN_STATUS=$(echo $?)
198 pybot ${PYBOT_ARGS} \
199 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
200 -s "tests.vpp.perf" \
201 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip6baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_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-da2AND1t1cANDl2xcbaseORndrdiscANDnic_intel-x520-da2AND1t1cANDl2bdbase \
211 RETURN_STATUS=$(echo $?)
214 pybot ${PYBOT_ARGS} \
215 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
216 -s "tests.vpp.perf" \
217 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDlisp \
219 RETURN_STATUS=$(echo $?)
222 pybot ${PYBOT_ARGS} \
223 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
224 -s "tests.vpp.perf" \
225 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvxlan \
227 RETURN_STATUS=$(echo $?)
230 pybot ${PYBOT_ARGS} \
231 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
232 -s "tests.vpp.perf" \
233 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
235 RETURN_STATUS=$(echo $?)
237 VPP-VERIFY-PERF-IP4 )
238 pybot ${PYBOT_ARGS} \
239 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
240 -s "tests.vpp.perf" \
241 --include pdrchkANDnic_intel-x520-da2AND1t1cANDip4baseORpdrchkANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
243 RETURN_STATUS=$(echo $?)
245 VPP-VERIFY-PERF-IP6 )
246 pybot ${PYBOT_ARGS} \
247 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
248 -s "tests.vpp.perf" \
249 --include pdrchkANDnic_intel-x520-da2AND1t1cANDip6baseORpdrchkANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
251 RETURN_STATUS=$(echo $?)
254 pybot ${PYBOT_ARGS} \
255 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
256 -s "tests.vpp.perf" \
257 --include pdrchkANDnic_intel-x520-da2AND1t1cANDl2xcbaseORpdrchkANDnic_intel-x520-da2AND1t1cANDl2bdbase \
259 RETURN_STATUS=$(echo $?)
261 VPP-VERIFY-PERF-LISP )
262 pybot ${PYBOT_ARGS} \
263 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
264 -s "tests.vpp.perf" \
265 --include pdrchkANDnic_intel-x520-da2AND1t1cANDlisp \
267 RETURN_STATUS=$(echo $?)
269 VPP-VERIFY-PERF-VXLAN )
270 pybot ${PYBOT_ARGS} \
271 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
272 -s "tests.vpp.perf" \
273 --include pdrchkANDnic_intel-x520-da2AND1t1cANDvxlan \
275 RETURN_STATUS=$(echo $?)
277 VPP-VERIFY-PERF-VHOST )
278 pybot ${PYBOT_ARGS} \
279 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
280 -s "tests.vpp.perf" \
281 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
283 RETURN_STATUS=$(echo $?)
286 pybot ${PYBOT_ARGS} \
287 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
288 -s "tests.vpp.perf" \
289 --exclude SKIP_PATCH \
292 RETURN_STATUS=$(echo $?)
295 pybot ${PYBOT_ARGS} \
296 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
297 -s "tests.vpp.perf" \
300 RETURN_STATUS=$(echo $?)
303 #run all available tests
304 pybot ${PYBOT_ARGS} \
305 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
306 -s "tests.vpp.perf" \
308 RETURN_STATUS=$(echo $?)
311 # run full performance test suite and exit on fail
312 pybot ${PYBOT_ARGS} \
313 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
314 -s "tests.vpp.perf" \
316 RETURN_STATUS=$(echo $?)
319 # Pybot output post-processing
320 echo Post-processing test data...
322 python ${SCRIPT_DIR}/resources/tools/scripts/robot_output_parser.py \
323 -i ${SCRIPT_DIR}/output.xml \
324 -o ${SCRIPT_DIR}/output_perf_data.xml \
326 if [ ! $? -eq 0 ]; then
327 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
330 python ${SCRIPT_DIR}/resources/tools/report_gen/run_robot_json_data.py \
331 --input ${SCRIPT_DIR}/output.xml \
332 --output ${SCRIPT_DIR}/output_perf_data.json \
333 --vdevice ${VPP_STABLE_VER}
334 if [ ! $? -eq 0 ]; then
335 echo "Generating JSON data for report from ${SCRIPT_DIR}/output.xml failed"
340 for i in ${ARCHIVE_ARTIFACTS[@]}; do
341 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
344 echo Post-processing finished.
346 exit ${RETURN_STATUS}