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 #run all available tests
101 pybot ${PYBOT_ARGS} \
103 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
105 -s "dpdk-tests.perf" \
107 RETURN_STATUS=$(echo $?)
110 # run full performance test suite and exit on fail
111 pybot ${PYBOT_ARGS} \
113 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
115 -s "dpdk-tests.perf" \
117 RETURN_STATUS=$(echo $?)
120 # Pybot output post-processing
121 echo Post-processing test data...
123 python ${SCRIPT_DIR}/resources/tools/robot_output_parser.py \
124 -i ${SCRIPT_DIR}/output.xml \
125 -o ${SCRIPT_DIR}/output_perf_data.xml
126 if [ ! $? -eq 0 ]; then
127 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
132 for i in ${ARCHIVE_ARTIFACTS[@]}; do
133 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
136 echo Post-processing finished.
138 exit ${RETURN_STATUS}