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_testbed2-710-520.yaml"
21 RESERVATION_DIR="/tmp/reservation_dir"
22 INSTALLATION_DIR="/tmp/install_dir"
24 # Jenkins VPP deb paths (convert to full path)
25 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
27 CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
29 export PYTHONPATH=${CUR_DIR}
31 sudo apt-get -y update
32 sudo apt-get -y install libpython2.7-dev python-virtualenv
38 pip install -r requirements.txt
40 # We iterate over available topologies and wait until we reserve topology
42 for TOPOLOGY in ${TOPOLOGIES};
44 python ${CUR_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
46 WORKING_TOPOLOGY=${TOPOLOGY}
47 echo "Reserved: ${WORKING_TOPOLOGY}"
52 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
53 # Exit the infinite while loop if we made a reservation
57 # Wait 10 - 30 sec. before next try
58 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 10 ]s
59 echo "Sleeping ${SLEEP_TIME}"
64 python ${CUR_DIR}/resources/tools/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
65 python ${CUR_DIR}/resources/tools/topo_reservation.py -c -t $1
68 # On script exit we cancel the reservation and installation and delete all vpp
70 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
72 python ${CUR_DIR}/resources/tools/topo_installation.py -t ${WORKING_TOPOLOGY} \
73 -d ${INSTALLATION_DIR} \
76 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
78 echo "Failed to copy vpp deb files to DUTs"
82 if [ ! -z "$TEST_TAG" ]; then
83 # run specific performance tests by tag if variable is set
85 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
86 -i "${TEST_TAG,,}" tests/
88 # run full performance test suite
90 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \