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} == *NIGHTLY ]] || \
44 [[ ${TEST_TAG} == *DAILY ]] || \
45 [[ ${TEST_TAG} == *WEEKLY ]];
47 # Download the latest VPP build .deb install packages
48 echo Downloading VPP packages...
49 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh --skip-install
51 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
52 # Take vpp package and get the vpp version
53 VPP_STABLE_VER="$( expr match $(ls *.deb | head -n 1) 'vpp-\(.*\)-deb.deb' )"
55 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)_amd64
56 VPP_REPO_URL=$(cat ${SCRIPT_DIR}/VPP_REPO_URL_UBUNTU)
57 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER_UBUNTU)
59 # Download vpp build from nexus and set VPP_DEBS variable
60 wget -q "${VPP_REPO_URL}/vpp/${VPP_STABLE_VER}/vpp-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
61 wget -q "${VPP_REPO_URL}/vpp-dbg/${VPP_STABLE_VER}/vpp-dbg-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
62 wget -q "${VPP_REPO_URL}/vpp-dev/${VPP_STABLE_VER}/vpp-dev-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
63 # Temporary disable using dpdk
64 # wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${DPDK_STABLE_VER}/vpp-dpdk-dkms-${DPDK_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
65 wget -q "${VPP_REPO_URL}/vpp-lib/${VPP_STABLE_VER}/vpp-lib-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
66 wget -q "${VPP_REPO_URL}/vpp-plugins/${VPP_STABLE_VER}/vpp-plugins-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
67 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
70 # Temporary workaround as ligato docker file requires specific file name
71 rename -v 's/^(.*)-(\d.*)-deb.deb/$1_$2.deb/' *.deb
74 # If we run this script from vpp project we want to use local build
75 elif [[ ${JOB_NAME} == vpp-* ]] ;
77 mkdir -p vpp/build-root
78 # Use local packages provided as argument list
79 # Jenkins VPP deb paths (convert to full path)
80 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
81 # Take vpp package and get the vpp version
82 VPP_STABLE_VER="$( expr match $1 'vpp-\(.*\)-deb.deb' )"
83 # Move files to build-root for packing
84 for deb in ${VPP_DEBS}; do mv ${deb} vpp/build-root/; done
86 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
89 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 VPP_AGENT_STABLE_COMMIT="$( expr match `cat VPP_AGENT_STABLE_VER` '.*g\(.*\)' )"
97 DOCKER_DEB="docker-ce_17.09.0~ce-0~ubuntu_amd64.deb"
99 # Clone & checkout stable vnf-agent
100 cd .. && git clone ${LIGATO_REPO_URL}/vpp-agent
101 # If the git clone fails, complain clearly and exit
103 echo "Failed to run: git clone --depth 1 ${LIGATO_REPO_URL}/vpp-agent"
106 cd vpp-agent && git checkout b99e43a
107 # If the git checkout fails, complain clearly and exit
109 echo "Failed to run: git checkout ${VPP_AGENT_STABLE_VER}"
114 wget -q https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/${DOCKER_DEB}
115 sudo dpkg -i ${DOCKER_DEB}
116 # If installation fails, complain clearly and exit
118 echo "Failed to install Docker"
122 # Pull ligato/dev_vpp_agent docker image and re-tag as local
123 if [[ ${VPP_AGENT_STABLE_VER} == g* ]] ;
125 sudo docker pull ligato/dev-vpp-agent:${VPP_AGENT_STABLE_COMMIT}
126 sudo docker tag ligato/dev-vpp-agent:${VPP_AGENT_STABLE_COMMIT}\
129 sudo docker pull ligato/dev-vpp-agent:${VPP_AGENT_STABLE_VER}
130 sudo docker tag ligato/dev-vpp-agent:${VPP_AGENT_STABLE_VER}\
134 # Start dev_vpp_agent container as daemon
135 sudo docker run --rm -itd --name agentcnt dev_vpp_agent bash
136 # Copy latest vpp api into running container
137 sudo docker cp /tmp/vpp/usr/share/vpp/api agentcnt:/usr/share/vpp
138 # Recompile vpp-agent
139 sudo docker exec -i agentcnt \
140 script -qec '. ~/.bashrc; cd /root/go/src/github.com/ligato/vpp-agent && make generate && make install'
142 echo "Failed to build vpp-agent in Docker image."
148 sudo docker cp agentcnt:/root/go/bin/vpp-agent agent/
149 sudo docker cp agentcnt:/root/go/bin/vpp-agent-ctl agent/
150 sudo docker cp agentcnt:/root/go/bin/agentctl agent/
151 tar -zcvf ${SCRIPT_DIR}/../vpp-agent/docker/prod_vpp_agent/agent.tar.gz agent
152 # Kill running container
153 sudo docker rm -f agentcnt
155 # Build prod_vpp_agent docker image
156 cd ${SCRIPT_DIR}/../vpp-agent/docker/prod_vpp_agent/ &&\
157 mv ${SCRIPT_DIR}/vpp.tar.gz . &&\
158 sudo docker build -t prod_vpp_agent --no-cache .
159 # Export Docker image
160 sudo docker save prod_vpp_agent | gzip > prod_vpp_agent.tar.gz
161 # If image build fails, complain clearly and exit
163 echo "Failed to build vpp-agent Docker image."
166 DOCKER_IMAGE="$( readlink -f prod_vpp_agent.tar.gz | tr '\n' ' ' )"
170 sudo apt-get -y update
171 sudo apt-get -y install libpython2.7-dev python-virtualenv
174 export PYTHONPATH=${SCRIPT_DIR}
176 virtualenv --system-site-packages env
180 pip install -r requirements.txt
182 # We iterate over available topologies and wait until we reserve topology
184 for TOPOLOGY in ${TOPOLOGIES};
186 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
187 if [ $? -eq 0 ]; then
188 WORKING_TOPOLOGY=${TOPOLOGY}
189 echo "Reserved: ${WORKING_TOPOLOGY}"
194 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
195 # Exit the infinite while loop if we made a reservation
199 # Wait ~3minutes before next try
200 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
201 echo "Sleeping ${SLEEP_TIME}"
205 function cancel_all {
206 python ${SCRIPT_DIR}/resources/tools/scripts/topo_container_copy.py -c -d ${INSTALLATION_DIR} -t $1
207 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
210 # On script exit we cancel the reservation and installation and delete all vpp
212 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
214 python ${SCRIPT_DIR}/resources/tools/scripts/topo_container_copy.py\
215 -t ${WORKING_TOPOLOGY} -d ${INSTALLATION_DIR} -i ${DOCKER_IMAGE}
216 if [ $? -eq 0 ]; then
217 echo "Docker image copied and loaded on hosts from: ${WORKING_TOPOLOGY}"
219 echo "Failed to copy and load Docker image to DUTs"
224 # run specific performance tests based on jenkins job type variable
226 pybot ${PYBOT_ARGS} \
227 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
229 -s "tests.kubernetes.perf" \
230 --include ndrdiscANDnic_intel-x520-da2AND1t1cORndrdiscANDnic_intel-x520-da2AND2t2c \
231 --include ndrdiscAND1t1cANDipsecORndrdiscAND2t2cANDipsec \
233 RETURN_STATUS=$(echo $?)
235 PERFTEST_SEMI_WEEKLY )
236 pybot ${PYBOT_ARGS} \
237 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
239 -s "tests.kubernetes.perf" \
240 --include ndrdiscANDnic_intel-x710AND1t1cORndrdiscANDnic_intel-x710AND2t2cORndrdiscANDnic_intel-xl710AND1t1cORndrdiscANDnic_intel-xl710AND2t2c \
242 RETURN_STATUS=$(echo $?)
245 pybot ${PYBOT_ARGS} \
246 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
248 -s "tests.kubernetes.perf" \
249 --include mrrAND64bAND1t1c \
250 --include mrrAND64bAND2t2c \
251 --include mrrAND64bAND4t4c \
252 --include mrrAND78bAND1t1c \
253 --include mrrAND78bAND2t2c \
254 --include mrrAND78bAND4t4c \
256 RETURN_STATUS=$(echo $?)
258 VERIFY-PERF-NDRDISC )
259 pybot ${PYBOT_ARGS} \
260 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
262 -s "tests.kubernetes.perf" \
263 --include ndrdiscAND1t1cORndrdiscAND2t2c \
265 RETURN_STATUS=$(echo $?)
267 VERIFY-PERF-PDRDISC )
268 pybot ${PYBOT_ARGS} \
269 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
271 -s "tests.kubernetes.perf" \
272 --include pdrdiscAND1t1cORpdrdiscAND2t2c \
274 RETURN_STATUS=$(echo $?)
277 pybot ${PYBOT_ARGS} \
278 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
280 -s "tests.kubernetes.perf" \
281 --include mrrAND1t1cORmrrAND2t2c \
283 RETURN_STATUS=$(echo $?)
286 pybot ${PYBOT_ARGS} \
287 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
289 -s "tests.kubernetes.perf" \
290 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip4baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
292 RETURN_STATUS=$(echo $?)
295 pybot ${PYBOT_ARGS} \
296 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
298 -s "tests.kubernetes.perf" \
299 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip6baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
301 RETURN_STATUS=$(echo $?)
304 pybot ${PYBOT_ARGS} \
305 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
307 -s "tests.kubernetes.perf" \
308 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDl2xcbaseORndrdiscANDnic_intel-x520-da2AND1t1cANDl2bdbase \
310 RETURN_STATUS=$(echo $?)
313 pybot ${PYBOT_ARGS} \
314 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
316 -s "tests.kubernetes.perf" \
317 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDlisp \
319 RETURN_STATUS=$(echo $?)
322 pybot ${PYBOT_ARGS} \
323 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
325 -s "tests.kubernetes.perf" \
326 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvxlan \
328 RETURN_STATUS=$(echo $?)
331 pybot ${PYBOT_ARGS} \
332 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
334 -s "tests.kubernetes.perf" \
335 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
337 RETURN_STATUS=$(echo $?)
340 pybot ${PYBOT_ARGS} \
341 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
343 -s "tests.kubernetes.perf" \
344 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDmemif \
346 RETURN_STATUS=$(echo $?)
348 VERIFY-PERF-IPSECHW )
349 pybot ${PYBOT_ARGS} \
350 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
352 -s "tests.kubernetes.perf" \
353 --include ndrdiscANDnic_intel-xl710AND1t1cANDipsechw \
354 --include ndrdiscANDnic_intel-xl710AND2t2cANDipsechw \
356 RETURN_STATUS=$(echo $?)
358 VPP-VERIFY-PERF-IP4 )
359 pybot ${PYBOT_ARGS} \
360 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
362 -s "tests.kubernetes.perf" \
363 --include mrrANDnic_intel-x520-da2AND1t1cANDip4baseORmrrANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
365 RETURN_STATUS=$(echo $?)
367 VPP-VERIFY-PERF-IP6 )
368 pybot ${PYBOT_ARGS} \
369 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
371 -s "tests.kubernetes.perf" \
372 --include mrrANDnic_intel-x520-da2AND1t1cANDip6baseORmrrANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
374 RETURN_STATUS=$(echo $?)
377 pybot ${PYBOT_ARGS} \
378 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
380 -s "tests.kubernetes.perf" \
381 --include mrrANDnic_intel-x520-da2AND1t1cANDl2xcbaseORmrrANDnic_intel-x520-da2AND1t1cANDl2bdbase \
383 RETURN_STATUS=$(echo $?)
385 VPP-VERIFY-PERF-LISP )
386 pybot ${PYBOT_ARGS} \
387 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
389 -s "tests.kubernetes.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} \
398 -s "tests.kubernetes.perf" \
399 --include pdrchkANDnic_intel-x520-da2AND1t1cANDvxlan \
401 RETURN_STATUS=$(echo $?)
403 VPP-VERIFY-PERF-VHOST )
404 pybot ${PYBOT_ARGS} \
405 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
407 -s "tests.kubernetes.perf" \
408 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
410 RETURN_STATUS=$(echo $?)
412 VPP-VERIFY-PERF-MEMIF )
413 pybot ${PYBOT_ARGS} \
414 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
416 -s "tests.kubernetes.perf" \
417 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDmemif \
418 --include pdrdiscANDnic_intel-x520-da2AND2t2cANDmemif \
419 --include mrrANDnic_intel-x520-da2AND1t1cANDmemif \
420 --include mrrANDnic_intel-x520-da2AND2t2cANDmemif \
422 RETURN_STATUS=$(echo $?)
424 VPP-VERIFY-PERF-ACL )
425 pybot ${PYBOT_ARGS} \
426 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
428 -s "tests.kubernetes.perf" \
429 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDacl \
430 --include pdrdiscANDnic_intel-x520-da2AND2t2cANDacl \
432 RETURN_STATUS=$(echo $?)
434 VPP-VERIFY-PERF-IPSECHW )
435 pybot ${PYBOT_ARGS} \
436 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
438 -s "tests.kubernetes.perf" \
439 --include pdrdiscANDnic_intel-xl710AND1t1cANDipsechw \
440 --include pdrdiscANDnic_intel-xl710AND2t2cANDipsechw \
442 RETURN_STATUS=$(echo $?)
445 # run full performance test suite and exit on fail
446 pybot ${PYBOT_ARGS} \
447 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
449 -s "tests.kubernetes.perf" \
451 RETURN_STATUS=$(echo $?)
454 # Archive JOB artifacts in jenkins
455 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
456 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
458 # Archive JOB artifacts to logs.fd.io
459 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
460 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
463 exit ${RETURN_STATUS}