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-* ]] ;
40 mkdir -p vpp/build-root
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 # Temporary disable using dpdk
63 # wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${DPDK_STABLE_VER}/vpp-dpdk-dkms-${DPDK_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
64 wget -q "${VPP_REPO_URL}/vpp-lib/${VPP_STABLE_VER}/vpp-lib-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
65 wget -q "${VPP_REPO_URL}/vpp-plugins/${VPP_STABLE_VER}/vpp-plugins-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
66 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
69 # Temporary workaround as ligato docker file requires specific file name
70 rename -v 's/^(.*)-(\d.*)-deb.deb/$1_$2.deb/' *.deb
73 # If we run this script from vpp project we want to use local build
74 elif [[ ${JOB_NAME} == vpp-* ]] ;
76 mkdir -p vpp/build-root
77 # Use local packages provided as argument list
78 # Jenkins VPP deb paths (convert to full path)
79 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
80 # Take vpp package and get the vpp version
81 VPP_STABLE_VER="$( expr match $1 'vpp-\(.*\)-deb.deb' )"
82 # Move files to build-root for packing
83 for deb in ${VPP_DEBS}; do mv ${deb} vpp/build-root/; done
85 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
89 # Extract VPP API to specific folder
90 dpkg -x vpp/build-root/vpp_${VPP_STABLE_VER}.deb /tmp/vpp
91 # Compress all VPP debs and remove temporary directory
92 tar -zcvf ${SCRIPT_DIR}/vpp.tar.gz vpp/* && rm -R vpp
94 LIGATO_REPO_URL=$(cat ${SCRIPT_DIR}/LIGATO_REPO_URL)
95 VPP_AGENT_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_AGENT_STABLE_VER)
96 DOCKER_DEB="docker-ce_18.03.0~ce-0~ubuntu_amd64.deb"
98 # Clone & checkout stable vnf-agent
99 cd .. && git clone ${LIGATO_REPO_URL}/vpp-agent
100 # If the git clone fails, complain clearly and exit
102 echo "Failed to run: git clone --depth 1 ${LIGATO_REPO_URL}/vpp-agent"
105 cd vpp-agent && git checkout tags/${VPP_AGENT_STABLE_VER}
106 # If the git checkout fails, complain clearly and exit
108 echo "Failed to run: git checkout ${VPP_AGENT_STABLE_VER}"
113 wget -q https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/${DOCKER_DEB}
114 sudo dpkg -i ${DOCKER_DEB}
115 # If installation fails, complain clearly and exit
117 echo "Failed to install Docker"
121 # Pull ligato/dev_vpp_agent docker image and re-tag as local
122 sudo docker pull ligato/dev-vpp-agent:${VPP_AGENT_STABLE_VER}
123 sudo docker tag ligato/dev-vpp-agent:${VPP_AGENT_STABLE_VER}\
126 # Start dev_vpp_agent container as daemon
127 sudo docker run --rm -itd --name agentcnt dev_vpp_agent bash
128 # Copy latest vpp api into running container
129 sudo docker cp /tmp/vpp/usr/share/vpp/api agentcnt:/usr/share/vpp
130 # Recompile vpp-agent
131 sudo docker exec -i agentcnt \
132 script -qec '. ~/.bashrc; cd /root/go/src/github.com/ligato/vpp-agent && make generate && make install'
134 echo "Failed to build vpp-agent in Docker image."
140 sudo docker cp agentcnt:/root/go/bin/vpp-agent agent/
141 sudo docker cp agentcnt:/root/go/bin/vpp-agent-ctl agent/
142 sudo docker cp agentcnt:/root/go/bin/agentctl agent/
143 tar -zcvf ${SCRIPT_DIR}/../vpp-agent/docker/prod_vpp_agent/agent.tar.gz agent
144 # Kill running container
145 sudo docker rm -f agentcnt
147 # Build prod_vpp_agent docker image
148 cd ${SCRIPT_DIR}/../vpp-agent/docker/prod_vpp_agent/ &&\
149 mv ${SCRIPT_DIR}/vpp.tar.gz . &&\
150 sudo docker build -t prod_vpp_agent --no-cache .
151 # Export Docker image
152 sudo docker save prod_vpp_agent | gzip > prod_vpp_agent.tar.gz
153 # If image build fails, complain clearly and exit
155 echo "Failed to build vpp-agent Docker image."
158 DOCKER_IMAGE="$( readlink -f prod_vpp_agent.tar.gz | tr '\n' ' ' )"
163 export PYTHONPATH=${SCRIPT_DIR}
165 sudo apt-get -y update
166 sudo apt-get -y install libpython2.7-dev python-virtualenv
168 virtualenv --system-site-packages env
172 pip install -r requirements.txt
174 # We iterate over available topologies and wait until we reserve topology
176 for TOPOLOGY in ${TOPOLOGIES};
178 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
179 if [ $? -eq 0 ]; then
180 WORKING_TOPOLOGY=${TOPOLOGY}
181 echo "Reserved: ${WORKING_TOPOLOGY}"
186 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
187 # Exit the infinite while loop if we made a reservation
191 # Wait ~3minutes before next try
192 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
193 echo "Sleeping ${SLEEP_TIME}"
197 function cancel_all {
198 python ${SCRIPT_DIR}/resources/tools/scripts/topo_container_copy.py -c -d ${INSTALLATION_DIR} -t $1
199 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
202 # On script exit we cancel the reservation and installation and delete all vpp
204 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
206 python ${SCRIPT_DIR}/resources/tools/scripts/topo_container_copy.py \
207 -t ${WORKING_TOPOLOGY} -d ${INSTALLATION_DIR} -i ${DOCKER_IMAGE}
208 if [ $? -eq 0 ]; then
209 echo "Docker image copied and loaded on hosts from: ${WORKING_TOPOLOGY}"
211 echo "Failed to copy and load Docker image to DUTs"
215 # Based on job we will identify DUT
216 if [[ ${JOB_NAME} == *hc2vpp* ]] ;
219 elif [[ ${JOB_NAME} == *vpp* ]] ;
222 elif [[ ${JOB_NAME} == *ligato* ]] ;
225 elif [[ ${JOB_NAME} == *dpdk* ]] ;
229 echo "Unable to identify dut type based on JOB_NAME variable: ${JOB_NAME}"
234 # run specific performance tests based on jenkins job type variable
236 pybot ${PYBOT_ARGS} \
237 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
238 -s "tests.${DUT}.perf" \
239 --include ndrdiscANDnic_intel-x520-da2AND1t1cORndrdiscANDnic_intel-x520-da2AND2t2c \
240 --include ndrdiscAND1t1cANDipsecORndrdiscAND2t2cANDipsec \
242 RETURN_STATUS=$(echo $?)
244 PERFTEST_SEMI_WEEKLY )
245 pybot ${PYBOT_ARGS} \
246 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
247 -s "tests.${DUT}.perf" \
248 --include ndrdiscANDnic_intel-x710AND1t1cORndrdiscANDnic_intel-x710AND2t2cORndrdiscANDnic_intel-xl710AND1t1cORndrdiscANDnic_intel-xl710AND2t2c \
250 RETURN_STATUS=$(echo $?)
253 pybot ${PYBOT_ARGS} \
254 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
255 -s "tests.${DUT}.perf" \
256 --include mrrAND64bAND1t1c \
257 --include mrrAND64bAND2t2c \
258 --include mrrAND64bAND4t4c \
259 --include mrrAND78bAND1t1c \
260 --include mrrAND78bAND2t2c \
261 --include mrrAND78bAND4t4c \
262 --include mrrANDimixAND1t1cANDvhost \
263 --include mrrANDimixAND2t2cANDvhost \
264 --include mrrANDimixAND4t4cANDvhost \
265 --include mrrANDimixAND1t1cANDmemif \
266 --include mrrANDimixAND2t2cANDmemif \
267 --include mrrANDimixAND4t4cANDmemif \
269 RETURN_STATUS=$(echo $?)
271 VERIFY-PERF-NDRDISC )
272 pybot ${PYBOT_ARGS} \
273 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
274 -s "tests.${DUT}.perf" \
275 --include ndrdiscAND1t1cORndrdiscAND2t2c \
277 RETURN_STATUS=$(echo $?)
279 VERIFY-PERF-PDRDISC )
280 pybot ${PYBOT_ARGS} \
281 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
282 -s "tests.${DUT}.perf" \
283 --include pdrdiscAND1t1cORpdrdiscAND2t2c \
285 RETURN_STATUS=$(echo $?)
288 pybot ${PYBOT_ARGS} \
289 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
290 -s "tests.${DUT}.perf" \
291 --include mrrAND1t1cORmrrAND2t2c \
293 RETURN_STATUS=$(echo $?)
296 pybot ${PYBOT_ARGS} \
297 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
298 -s "tests.${DUT}.perf" \
299 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip4baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
301 RETURN_STATUS=$(echo $?)
304 pybot ${PYBOT_ARGS} \
305 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
306 -s "tests.${DUT}.perf" \
307 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip6baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
309 RETURN_STATUS=$(echo $?)
312 pybot ${PYBOT_ARGS} \
313 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
314 -s "tests.${DUT}.perf" \
315 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDl2xcbaseORndrdiscANDnic_intel-x520-da2AND1t1cANDl2bdbase \
317 RETURN_STATUS=$(echo $?)
320 pybot ${PYBOT_ARGS} \
321 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
322 -s "tests.${DUT}.perf" \
323 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDlisp \
325 RETURN_STATUS=$(echo $?)
328 pybot ${PYBOT_ARGS} \
329 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
330 -s "tests.${DUT}.perf" \
331 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvxlan \
333 RETURN_STATUS=$(echo $?)
336 pybot ${PYBOT_ARGS} \
337 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
338 -s "tests.${DUT}.perf" \
339 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
341 RETURN_STATUS=$(echo $?)
344 pybot ${PYBOT_ARGS} \
345 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
346 -s "tests.${DUT}.perf" \
347 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDmemif \
349 RETURN_STATUS=$(echo $?)
351 VERIFY-PERF-IPSECHW )
352 pybot ${PYBOT_ARGS} \
353 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
354 -s "tests.${DUT}.perf.crypto" \
355 --include ndrdiscANDnic_intel-xl710AND1t1cANDipsechw \
356 --include ndrdiscANDnic_intel-xl710AND2t2cANDipsechw \
357 --include mrrANDnic_intel-xl710AND1t1cANDipsechw \
358 --include mrrANDnic_intel-xl710AND2t2cANDipsechw \
360 RETURN_STATUS=$(echo $?)
362 VPP-VERIFY-PERF-IP4 )
363 pybot ${PYBOT_ARGS} \
364 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
365 -s "tests.${DUT}.perf" \
366 --include mrrANDnic_intel-x520-da2AND1t1cANDip4baseORmrrANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
368 RETURN_STATUS=$(echo $?)
370 VPP-VERIFY-PERF-IP6 )
371 pybot ${PYBOT_ARGS} \
372 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
373 -s "tests.${DUT}.perf" \
374 --include mrrANDnic_intel-x520-da2AND1t1cANDip6baseORmrrANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
376 RETURN_STATUS=$(echo $?)
379 pybot ${PYBOT_ARGS} \
380 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
381 -s "tests.${DUT}.perf" \
382 --include mrrANDnic_intel-x520-da2AND1t1cANDl2xcbaseORmrrANDnic_intel-x520-da2AND1t1cANDl2bdbase \
384 RETURN_STATUS=$(echo $?)
386 VPP-VERIFY-PERF-LISP )
387 pybot ${PYBOT_ARGS} \
388 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
389 -s "tests.${DUT}.perf" \
390 --include pdrchkANDnic_intel-x520-da2AND1t1cANDlisp \
392 RETURN_STATUS=$(echo $?)
394 VPP-VERIFY-PERF-VXLAN )
395 pybot ${PYBOT_ARGS} \
396 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
397 -s "tests.${DUT}.perf" \
398 --include pdrchkANDnic_intel-x520-da2AND1t1cANDvxlan \
400 RETURN_STATUS=$(echo $?)
402 VPP-VERIFY-PERF-VHOST )
403 pybot ${PYBOT_ARGS} \
404 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
405 -s "tests.${DUT}.perf" \
406 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
408 RETURN_STATUS=$(echo $?)
410 VPP-VERIFY-PERF-MEMIF )
411 pybot ${PYBOT_ARGS} \
412 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
413 -s "tests.${DUT}.perf" \
414 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDmemif \
415 --include pdrdiscANDnic_intel-x520-da2AND2t2cANDmemif \
416 --include mrrANDnic_intel-x520-da2AND1t1cANDmemif \
417 --include mrrANDnic_intel-x520-da2AND2t2cANDmemif \
419 RETURN_STATUS=$(echo $?)
421 VPP-VERIFY-PERF-ACL )
422 pybot ${PYBOT_ARGS} \
423 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
424 -s "tests.${DUT}.perf" \
425 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDacl \
426 --include pdrdiscANDnic_intel-x520-da2AND2t2cANDacl \
428 RETURN_STATUS=$(echo $?)
430 VPP-VERIFY-PERF-IPSECHW )
431 pybot ${PYBOT_ARGS} \
432 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
433 -s "tests.${DUT}.perf.crypto" \
434 --include pdrdiscANDnic_intel-xl710AND1t1cANDipsechw \
435 --include pdrdiscANDnic_intel-xl710AND2t2cANDipsechw \
436 --include mrrANDnic_intel-xl710AND1t1cANDipsechw \
437 --include mrrANDnic_intel-xl710AND2t2cANDipsechw \
439 RETURN_STATUS=$(echo $?)
442 # run full performance test suite and exit on fail
443 pybot ${PYBOT_ARGS} \
444 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
445 -s "tests.${DUT}.perf" \
447 RETURN_STATUS=$(echo $?)
450 # Archive JOB artifacts in jenkins
451 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
452 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
454 # Archive JOB artifacts to logs.fd.io
455 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
456 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
459 exit ${RETURN_STATUS}