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_testbed1.yaml \
19 topologies/available/lf_testbed2.yaml \
20 topologies/available/lf_testbed3.yaml"
22 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
25 RESERVATION_DIR="/tmp/reservation_dir"
26 INSTALLATION_DIR="/tmp/install_dir"
30 ARCHIVE_ARTIFACTS=(log.html output.xml report.html output_perf_data.xml)
32 # If we run this script from CSIT jobs we want to use stable vpp version
33 if [[ ${JOB_NAME} == csit-* ]] ;
38 if [[ ${TEST_TAG} == "PERFTEST_NIGHTLY" ]] ;
40 # Download the latest VPP build .deb install packages
41 echo Downloading VPP packages...
42 bash ${SCRIPT_DIR}/resources/tools/download_install_vpp_pkgs.sh --skip-install
44 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
45 # Take vpp package and get the vpp version
46 VPP_STABLE_VER="$( expr match $(ls *.deb | head -n 1) 'vpp-\(.*\)-deb.deb' )"
48 VPP_REPO_URL=$(cat ${SCRIPT_DIR}/VPP_REPO_URL)
49 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER)
51 # Download vpp build from nexus and set VPP_DEBS variable
52 wget -q "${VPP_REPO_URL}/vpp/${VPP_STABLE_VER}/vpp-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
53 wget -q "${VPP_REPO_URL}/vpp-dbg/${VPP_STABLE_VER}/vpp-dbg-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
54 wget -q "${VPP_REPO_URL}/vpp-dev/${VPP_STABLE_VER}/vpp-dev-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
55 wget -q "${VPP_REPO_URL}/vpp-dpdk-dev/${VPP_STABLE_VER}/vpp-dpdk-dev-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
56 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${VPP_STABLE_VER}/vpp-dpdk-dkms-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
57 wget -q "${VPP_REPO_URL}/vpp-lib/${VPP_STABLE_VER}/vpp-lib-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
58 wget -q "${VPP_REPO_URL}/vpp-plugins/${VPP_STABLE_VER}/vpp-plugins-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
59 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
64 # If we run this script from vpp project we want to use local build
65 elif [[ ${JOB_NAME} == vpp-* ]] ;
67 # Use local packages provided as argument list
68 # Jenkins VPP deb paths (convert to full path)
69 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
70 # Take vpp package and get the vpp version
71 VPP_STABLE_VER="$( expr match $1 'vpp-\(.*\)-deb.deb' )"
73 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
78 export PYTHONPATH=${SCRIPT_DIR}
80 sudo apt-get -y update
81 sudo apt-get -y install libpython2.7-dev python-virtualenv
83 virtualenv --system-site-packages env
87 pip install -r requirements.txt
89 # We iterate over available topologies and wait until we reserve topology
91 for TOPOLOGY in ${TOPOLOGIES};
93 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
95 WORKING_TOPOLOGY=${TOPOLOGY}
96 echo "Reserved: ${WORKING_TOPOLOGY}"
101 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
102 # Exit the infinite while loop if we made a reservation
106 # Wait ~3minutes before next try
107 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
108 echo "Sleeping ${SLEEP_TIME}"
112 function cancel_all {
113 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
114 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -c -t $1
117 # On script exit we cancel the reservation and installation and delete all vpp
119 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
121 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -t ${WORKING_TOPOLOGY} \
122 -d ${INSTALLATION_DIR} \
124 if [ $? -eq 0 ]; then
125 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
127 echo "Failed to copy vpp deb files to DUTs"
132 # run specific performance tests based on jenkins job type variable
134 pybot ${PYBOT_ARGS} \
136 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
138 --exclude SKIP_PATCH \
141 RETURN_STATUS=$(echo $?)
144 pybot ${PYBOT_ARGS} \
146 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
150 RETURN_STATUS=$(echo $?)
152 PERFTEST_LONG_BRIDGE )
153 pybot ${PYBOT_ARGS} \
155 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
156 -s "tests.perf.Long_Bridge_Domain*" \
158 RETURN_STATUS=$(echo $?)
161 pybot ${PYBOT_ARGS} \
163 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
164 -s "tests.perf.Long_IPv4*" \
166 RETURN_STATUS=$(echo $?)
169 pybot ${PYBOT_ARGS} \
171 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
172 -s "tests.perf.Long_IPv6*" \
174 RETURN_STATUS=$(echo $?)
176 PERFTEST_LONG_XCONNECT )
177 pybot ${PYBOT_ARGS} \
179 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
180 -s "tests.perf.Long_Xconnect*" \
182 RETURN_STATUS=$(echo $?)
184 PERFTEST_LONG_XCONNECT_DOT1Q )
185 pybot ${PYBOT_ARGS} \
187 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
188 -s "tests.perf.Long_Xconnect_Dot1q*" \
189 RETURN_STATUS=$(echo $?)
192 pybot ${PYBOT_ARGS} \
194 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
195 -s "tests.perf" -i NDR \
197 RETURN_STATUS=$(echo $?)
200 pybot ${PYBOT_ARGS} \
202 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
203 -s "tests.perf" -i PDR \
205 RETURN_STATUS=$(echo $?)
208 #run all available tests
209 pybot ${PYBOT_ARGS} \
211 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
214 RETURN_STATUS=$(echo $?)
217 # run full performance test suite and exit on fail
218 pybot ${PYBOT_ARGS} \
220 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
223 RETURN_STATUS=$(echo $?)
226 # Pybot output post-processing
227 echo Post-processing test data...
229 python ${SCRIPT_DIR}/resources/tools/robot_output_parser.py \
230 -i ${SCRIPT_DIR}/output.xml \
231 -o ${SCRIPT_DIR}/output_perf_data.xml \
233 if [ ! $? -eq 0 ]; then
234 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
239 for i in ${ARCHIVE_ARTIFACTS[@]}; do
240 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
243 echo Post-processing finished.
245 exit ${RETURN_STATUS}