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"
23 # Jenkins VPP deb paths (convert to full path)
24 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
26 CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
28 export PYTHONPATH=${CUR_DIR}
30 sudo apt-get -y update
31 sudo apt-get -y install libpython2.7-dev python-virtualenv
37 pip install -r requirements.txt
39 # We iterate over available topologies and wait until we reserve topology
41 for TOPOLOGY in ${TOPOLOGIES};
43 python ${CUR_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
45 WORKING_TOPOLOGY=${TOPOLOGY}
46 echo "Reserved: ${WORKING_TOPOLOGY}"
51 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
52 # Exit the infinite while loop if we made a reservation
56 # Wait 10 - 30 sec. before next try
57 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 10 ]s
58 echo "Sleeping ${SLEEP_TIME}"
62 python ${CUR_DIR}/resources/tools/topo_installation.py -t ${WORKING_TOPOLOGY} \
63 -d ${RESERVATION_DIR} \
66 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
68 echo "Failed to copy vpp deb files to DUTs"
72 function cancel_reservation {
73 python ${CUR_DIR}/resources/tools/topo_reservation.py -c -t $1
76 # On script exit we cancel the reservation and delete all vpp packages
77 trap "cancel_reservation ${WORKING_TOPOLOGY}" EXIT
79 # run performance test suite
81 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \