2 # Copyright (c) 2017 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.
21 # Space separated list of available testbeds, described by topology files
22 TOPOLOGIES="topologies/available/lf_testbed1.yaml \
23 topologies/available/lf_testbed2.yaml \
24 topologies/available/lf_testbed3.yaml"
26 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
29 RESERVATION_DIR="/tmp/reservation_dir"
30 INSTALLATION_DIR="/tmp/install_dir"
32 PYBOT_ARGS="-W 150 -L TRACE"
34 ARCHIVE_ARTIFACTS=(log.html output.xml report.html honeycomb.log)
37 export PYTHONPATH=${SCRIPT_DIR}
39 sudo apt-get -y update
40 sudo apt-get -y install libpython2.7-dev python-virtualenv
42 virtualenv --system-site-packages env
46 pip install -r requirements.txt
48 # We iterate over available topologies and wait until we reserve topology
50 for TOPOLOGY in ${TOPOLOGIES};
52 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
54 WORKING_TOPOLOGY=${TOPOLOGY}
55 echo "Reserved: ${WORKING_TOPOLOGY}"
60 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
61 # Exit the infinite while loop if we made a reservation
65 # Wait ~3minutes before next try
66 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
67 echo "Sleeping ${SLEEP_TIME}"
72 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1 -hc True
73 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
76 # On script exit we cancel the reservation and installation and delete all vpp
78 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
80 # Download VPP and HC packages from the current branch
81 echo Downloading packages...
82 bash ${SCRIPT_DIR}/resources/tools/scripts/download_hc_pkgs.sh ${STREAM} 'ubuntu1604'
84 if [ "${OS}" == "centos7" ]; then
92 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -t ${WORKING_TOPOLOGY} \
93 -d ${INSTALLATION_DIR} \
97 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
99 echo "Failed to copy vpp deb files to DUTs"
103 # run full performance test suite and exit on fail
104 pybot ${PYBOT_ARGS} \
105 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
106 -s "tests.vpp.perf.honeycomb" \
107 --variable install_dir:${INSTALLATION_DIR} \
109 RETURN_STATUS=$(echo $?)
113 for i in ${ARCHIVE_ARTIFACTS[@]}; do
114 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
117 exit ${RETURN_STATUS}