2 # Copyright (c) 2016 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"
29 ARCHIVE_ARTIFACTS=(log.html output.xml report.html output_perf_data.xml)
31 # we will download the DPDK in the robot
34 export PYTHONPATH=${SCRIPT_DIR}
36 sudo apt-get -y update
37 sudo apt-get -y install libpython2.7-dev python-virtualenv
39 virtualenv --system-site-packages env
43 pip install -r requirements.txt
45 # We iterate over available topologies and wait until we reserve topology
47 for TOPOLOGY in ${TOPOLOGIES};
49 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
51 WORKING_TOPOLOGY=${TOPOLOGY}
52 echo "Reserved: ${WORKING_TOPOLOGY}"
57 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
58 # Exit the infinite while loop if we made a reservation
62 # Wait ~3minutes before next try
63 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
64 echo "Sleeping ${SLEEP_TIME}"
68 #for DPDK test, we don't need to install the VPP deb
70 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -c -t $1
73 # On script exit we cancel the reservation
74 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
77 # run specific performance tests based on jenkins job type variable
81 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
83 -s "dpdk-tests.perf" \
84 --exclude SKIP_PATCH \
87 RETURN_STATUS=$(echo $?)
92 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
94 -s "dpdk-tests.perf" \
97 RETURN_STATUS=$(echo $?)
100 pybot ${PYBOT_ARGS} \
102 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
104 -s "dpdk-tests.perf" -i NDR \
106 RETURN_STATUS=$(echo $?)
109 pybot ${PYBOT_ARGS} \
111 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
113 -s "dpdk-tests.perf" -i PDR \
115 RETURN_STATUS=$(echo $?)
118 #run all available tests
119 pybot ${PYBOT_ARGS} \
121 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
123 -s "dpdk-tests.perf" \
125 RETURN_STATUS=$(echo $?)
128 # run full performance test suite and exit on fail
129 pybot ${PYBOT_ARGS} \
131 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
133 -s "dpdk-tests.perf" \
135 RETURN_STATUS=$(echo $?)
138 # Pybot output post-processing
139 echo Post-processing test data...
141 python ${SCRIPT_DIR}/resources/tools/robot_output_parser.py \
142 -i ${SCRIPT_DIR}/output.xml \
143 -o ${SCRIPT_DIR}/output_perf_data.xml \
145 if [ ! $? -eq 0 ]; then
146 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
151 for i in ${ARCHIVE_ARTIFACTS[@]}; do
152 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
155 echo Post-processing finished.
157 exit ${RETURN_STATUS}