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)
32 LIGATO_REPO_URL=$(cat ${SCRIPT_DIR}/LIGATO_REPO_URL)
33 LIGATO_STABLE_VER=$(cat ${SCRIPT_DIR}/LIGATO_STABLE_VER)
36 DOCKER_DEB="docker-ce_17.06.2~ce-0~ubuntu_amd64.deb"
38 # Clone & checkout stable vnf-agent
39 cd .. && git clone ${LIGATO_REPO_URL}/vpp-agent
40 # If the git clone fails, complain clearly and exit
42 echo "Failed to run: git clone --depth 1 ${LIGATO_REPO_URL}/vpp-agent"
45 cd vpp-agent && git checkout ${LIGATO_STABLE_VER}
46 # If the git checkout fails, complain clearly and exit
48 echo "Failed to run: git checkout ${LIGATO_STABLE_VER}"
53 wget -q https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/${DOCKER_DEB}
54 sudo dpkg -i ${DOCKER_DEB}
55 # If installation fails, complain clearly and exit
57 echo "Failed to install Docker"
61 # Compile vnf-agent docker image
62 cd ${SCRIPT_DIR}/../vpp-agent/docker/dev_vpp_agent/ &&\
63 ./build.sh --agent ${LIGATO_STABLE_VER} --vpp ${VPP_COMMIT} &&\
65 cd ${SCRIPT_DIR}/../vpp-agent/docker/prod_vpp_agent/ &&\
69 sudo docker save prod_vpp_agent_shrink | gzip > prod_vpp_agent_shrink.tar.gz
70 # If image build fails, complain clearly and exit
72 echo "Failed to build vpp-agent Docker image."
75 DOCKER_IMAGE="$( readlink -f prod_vpp_agent_shrink.tar.gz | tr '\n' ' ' )"
79 sudo apt-get -y update
80 sudo apt-get -y install libpython2.7-dev python-virtualenv
83 export PYTHONPATH=${SCRIPT_DIR}
85 virtualenv --system-site-packages env
89 pip install -r requirements.txt
91 # We iterate over available topologies and wait until we reserve topology
93 for TOPOLOGY in ${TOPOLOGIES};
95 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
97 WORKING_TOPOLOGY=${TOPOLOGY}
98 echo "Reserved: ${WORKING_TOPOLOGY}"
103 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
104 # Exit the infinite while loop if we made a reservation
108 # Wait ~3minutes before next try
109 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
110 echo "Sleeping ${SLEEP_TIME}"
114 function cancel_all {
115 python ${SCRIPT_DIR}/resources/tools/scripts/topo_container_copy.py -c -d ${INSTALLATION_DIR} -t $1
116 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
119 # On script exit we cancel the reservation and installation and delete all vpp
121 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
123 python ${SCRIPT_DIR}/resources/tools/scripts/topo_container_copy.py\
124 -t ${WORKING_TOPOLOGY} -d ${INSTALLATION_DIR} -i ${DOCKER_IMAGE}
125 if [ $? -eq 0 ]; then
126 echo "Docker image copied and loaded on hosts from: ${WORKING_TOPOLOGY}"
128 echo "Failed to copy and load Docker image to DUTs"
133 # run specific performance tests based on jenkins job type variable
135 pybot ${PYBOT_ARGS} \
136 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
138 -s "tests.ligato.perf" \
139 --include ndrdiscANDnic_intel-x520-da2AND1t1cORndrdiscANDnic_intel-x520-da2AND2t2c \
141 RETURN_STATUS=$(echo $?)
143 PERFTEST_SEMI_WEEKLY )
144 pybot ${PYBOT_ARGS} \
145 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
147 -s "tests.ligato.perf" \
148 --include ndrdiscANDnic_intel-x710AND1t1cORndrdiscANDnic_intel-x710AND2t2cORndrdiscANDnic_intel-xl710AND1t1cORndrdiscANDnic_intel-xl710AND2t2c \
150 RETURN_STATUS=$(echo $?)
152 VERIFY-PERF-NDRDISC )
153 pybot ${PYBOT_ARGS} \
154 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
156 -s "tests.ligato.perf" \
157 --include ndrdiscAND1t1cORndrdiscAND2t2c \
159 RETURN_STATUS=$(echo $?)
161 VERIFY-PERF-PDRDISC )
162 pybot ${PYBOT_ARGS} \
163 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
165 -s "tests.ligato.perf" \
166 --include pdrdiscAND1t1cORpdrdiscAND2t2c \
168 RETURN_STATUS=$(echo $?)
171 pybot ${PYBOT_ARGS} \
172 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
174 -s "tests.ligato.perf" \
175 --include ndrchkAND1t1cORndrchkAND2t2c \
177 RETURN_STATUS=$(echo $?)
179 PERFTEST_NDRCHK_DAILY )
180 pybot ${PYBOT_ARGS} \
181 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
183 -s "tests.ligato.perf" \
184 --include ndrchkAND1t1cORndrchkAND2t2c \
186 RETURN_STATUS=$(echo $?)
189 pybot ${PYBOT_ARGS} \
190 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
192 -s "tests.ligato.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} \
201 -s "tests.ligato.perf" \
202 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDip6baseORndrdiscANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
204 RETURN_STATUS=$(echo $?)
207 pybot ${PYBOT_ARGS} \
208 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
210 -s "tests.ligato.perf" \
211 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDl2xcbaseORndrdiscANDnic_intel-x520-da2AND1t1cANDl2bdbase \
213 RETURN_STATUS=$(echo $?)
216 pybot ${PYBOT_ARGS} \
217 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
219 -s "tests.ligato.perf" \
220 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDlisp \
222 RETURN_STATUS=$(echo $?)
225 pybot ${PYBOT_ARGS} \
226 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
228 -s "tests.ligato.perf" \
229 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvxlan \
231 RETURN_STATUS=$(echo $?)
234 pybot ${PYBOT_ARGS} \
235 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
237 -s "tests.ligato.perf" \
238 --include ndrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
240 RETURN_STATUS=$(echo $?)
242 VPP-VERIFY-PERF-IP4 )
243 pybot ${PYBOT_ARGS} \
244 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
246 -s "tests.ligato.perf" \
247 --include pdrchkANDnic_intel-x520-da2AND1t1cANDip4baseORpdrchkANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m \
249 RETURN_STATUS=$(echo $?)
251 VPP-VERIFY-PERF-IP6 )
252 pybot ${PYBOT_ARGS} \
253 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
255 -s "tests.ligato.perf" \
256 --include pdrchkANDnic_intel-x520-da2AND1t1cANDip6baseORpdrchkANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m \
258 RETURN_STATUS=$(echo $?)
261 pybot ${PYBOT_ARGS} \
262 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
264 -s "tests.ligato.perf" \
265 --include pdrchkANDnic_intel-x520-da2AND1t1cANDl2xcbaseORpdrchkANDnic_intel-x520-da2AND1t1cANDl2bdbase \
267 RETURN_STATUS=$(echo $?)
269 VPP-VERIFY-PERF-LISP )
270 pybot ${PYBOT_ARGS} \
271 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
273 -s "tests.ligato.perf" \
274 --include pdrchkANDnic_intel-x520-da2AND1t1cANDlisp \
276 RETURN_STATUS=$(echo $?)
278 VPP-VERIFY-PERF-VXLAN )
279 pybot ${PYBOT_ARGS} \
280 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
282 -s "tests.ligato.perf" \
283 --include pdrchkANDnic_intel-x520-da2AND1t1cANDvxlan \
285 RETURN_STATUS=$(echo $?)
287 VPP-VERIFY-PERF-VHOST )
288 pybot ${PYBOT_ARGS} \
289 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
291 -s "tests.ligato.perf" \
292 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDvhost \
294 RETURN_STATUS=$(echo $?)
296 VPP-VERIFY-PERF-ACL )
297 pybot ${PYBOT_ARGS} \
298 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
300 -s "tests.ligato.perf" \
301 --include pdrdiscANDnic_intel-x520-da2AND1t1cANDacl \
302 --include pdrdiscANDnic_intel-x520-da2AND2t2cANDacl \
304 RETURN_STATUS=$(echo $?)
307 pybot ${PYBOT_ARGS} \
308 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
310 -s "tests.ligato.perf" \
311 --exclude SKIP_PATCH \
314 RETURN_STATUS=$(echo $?)
317 pybot ${PYBOT_ARGS} \
318 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
320 -s "tests.ligato.perf" \
323 RETURN_STATUS=$(echo $?)
326 #run all available tests
327 pybot ${PYBOT_ARGS} \
328 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
330 -s "tests.ligato.perf" \
332 RETURN_STATUS=$(echo $?)
335 # run full performance test suite and exit on fail
336 pybot ${PYBOT_ARGS} \
337 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
339 -s "tests.ligato.perf" \
341 RETURN_STATUS=$(echo $?)
344 # Pybot output post-processing
345 echo Post-processing test data...
347 python ${SCRIPT_DIR}/resources/tools/scripts/robot_output_parser.py \
348 -i ${SCRIPT_DIR}/output.xml \
349 -o ${SCRIPT_DIR}/output_perf_data.xml \
351 if [ ! $? -eq 0 ]; then
352 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
357 for i in ${ARCHIVE_ARTIFACTS[@]}; do
358 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
361 echo Post-processing finished.
363 exit ${RETURN_STATUS}