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"
19 VPP_STABLE_VER="1.0.0-437~g8f15e92_amd64"
20 VPP_REPO_URL="https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp"
23 RESERVATION_DIR="/tmp/reservation_dir"
24 INSTALLATION_DIR="/tmp/install_dir"
26 PYBOT_ARGS="--noncritical MULTI_THREAD"
28 ARCHIVE_ARTIFACTS=(log.html output.xml report.html output_perf_data.json)
30 # If we run this script from CSIT jobs we want to use stable vpp version
31 if [[ ${JOB_NAME} == csit-* ]] ;
35 #download vpp build from nexus and set VPP_DEBS variable
36 wget -q "${VPP_REPO_URL}/vpp/${VPP_STABLE_VER}/vpp-${VPP_STABLE_VER}.deb" || exit
37 wget -q "${VPP_REPO_URL}/vpp-dbg/${VPP_STABLE_VER}/vpp-dbg-${VPP_STABLE_VER}.deb" || exit
38 wget -q "${VPP_REPO_URL}/vpp-dev/${VPP_STABLE_VER}/vpp-dev-${VPP_STABLE_VER}.deb" || exit
39 wget -q "${VPP_REPO_URL}/vpp-dpdk-dev/${VPP_STABLE_VER}/vpp-dpdk-dev-${VPP_STABLE_VER}.deb" || exit
40 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${VPP_STABLE_VER}/vpp-dpdk-dkms-${VPP_STABLE_VER}.deb" || exit
41 wget -q "${VPP_REPO_URL}/vpp-lib/${VPP_STABLE_VER}/vpp-lib-${VPP_STABLE_VER}.deb" || exit
42 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
43 PYBOT_ARGS="${PYBOT_ARGS} --exitonfailure"
46 # If we run this script from vpp project we want to use local build
47 elif [[ ${JOB_NAME} == vpp-* ]] ;
49 #use local packages provided as argument list
50 # Jenkins VPP deb paths (convert to full path)
51 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
53 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
57 CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
59 export PYTHONPATH=${CUR_DIR}
61 sudo apt-get -y update
62 sudo apt-get -y install libpython2.7-dev python-virtualenv
68 pip install -r requirements.txt
70 # We iterate over available topologies and wait until we reserve topology
72 for TOPOLOGY in ${TOPOLOGIES};
74 python ${CUR_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
76 WORKING_TOPOLOGY=${TOPOLOGY}
77 echo "Reserved: ${WORKING_TOPOLOGY}"
82 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
83 # Exit the infinite while loop if we made a reservation
87 # Wait ~3minutes before next try
88 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
89 echo "Sleeping ${SLEEP_TIME}"
94 python ${CUR_DIR}/resources/tools/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
95 python ${CUR_DIR}/resources/tools/topo_reservation.py -c -t $1
98 # On script exit we cancel the reservation and installation and delete all vpp
100 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
102 python ${CUR_DIR}/resources/tools/topo_installation.py -t ${WORKING_TOPOLOGY} \
103 -d ${INSTALLATION_DIR} \
105 if [ $? -eq 0 ]; then
106 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
108 echo "Failed to copy vpp deb files to DUTs"
113 # run specific performance tests based on jenkins job type variable
115 pybot ${PYBOT_ARGS} \
117 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
122 pybot ${PYBOT_ARGS} \
124 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
128 PERFTEST_LONG_BRIDGE )
129 pybot ${PYBOT_ARGS} \
131 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
132 -s "performance.Long_Bridge_Domain*" \
136 pybot ${PYBOT_ARGS} \
138 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
139 -s "performance.Long_IPv4*" \
143 pybot ${PYBOT_ARGS} \
145 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
146 -s "performance.Long_IPv6*" \
149 PERFTEST_LONG_XCONNECT )
150 pybot ${PYBOT_ARGS} \
152 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
153 -s "performance.Long_Xconnect*" \
157 # run full performance test suite and exit on fail
158 pybot ${PYBOT_ARGS} \
160 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
165 # Pybot output post-processing
166 python ${CUR_DIR}/resources/tools/robot_output_parser.py \
167 -i ${CUR_DIR}/output.xml \
168 -o ${CUR_DIR}/output_perf_data.json \
170 if [ ! $? -eq 0 ]; then
171 echo "Parsing ${CUR_DIR}/output.xml failed"
176 for i in ${ARCHIVE_ARTIFACTS[@]}; do
177 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/