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"
20 CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
22 export PYTHONPATH=${CUR_DIR}
24 sudo apt-get -y update
25 sudo apt-get -y install libpython2.7-dev python-virtualenv
31 pip install -r requirements.txt
33 #we iterate over available topologies and wait until we reserve topology
35 for TOPOLOGY in ${TOPOLOGIES};
37 python ${CUR_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
39 WORKING_TOPOLOGY=${TOPOLOGY}
40 echo "Reserved: ${WORKING_TOPOLOGY}"
45 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
46 #exit the infinite while loop if we made a reservation
50 #wait 10 - 30 sec. before next try
51 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 10 ]s
52 echo "Sleeping ${SLEEP_TIME}"
56 function cancel_reservation {
57 python ${CUR_DIR}/resources/tools/topo_reservation.py -c -t $1
60 #on script exit we cancel the reservation
61 trap "cancel_reservation ${WORKING_TOPOLOGY}" EXIT
63 #run performance test suite
65 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \