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 )"
24 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER)
25 VPP_REPO_URL=$(cat ${SCRIPT_DIR}/VPP_REPO_URL)
28 RESERVATION_DIR="/tmp/reservation_dir"
29 INSTALLATION_DIR="/tmp/install_dir"
33 ARCHIVE_ARTIFACTS=(log.html output.xml report.html output_perf_data.xml)
35 # If we run this script from CSIT jobs we want to use stable vpp version
36 if [[ ${JOB_NAME} == csit-* ]] ;
41 if [[ ${TEST_TAG} == "PERFTEST_NIGHTLY" ]] ;
43 # Download the latest VPP build .deb install packages
44 echo Downloading VPP packages...
45 bash ${SCRIPT_DIR}/resources/tools/download_install_vpp_pkgs.sh --skip-install
47 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
50 #download vpp build from nexus and set VPP_DEBS variable
51 wget -q "${VPP_REPO_URL}/vpp/${VPP_STABLE_VER}/vpp-${VPP_STABLE_VER}.deb" || exit
52 wget -q "${VPP_REPO_URL}/vpp-dbg/${VPP_STABLE_VER}/vpp-dbg-${VPP_STABLE_VER}.deb" || exit
53 wget -q "${VPP_REPO_URL}/vpp-dev/${VPP_STABLE_VER}/vpp-dev-${VPP_STABLE_VER}.deb" || exit
54 wget -q "${VPP_REPO_URL}/vpp-dpdk-dev/${VPP_STABLE_VER}/vpp-dpdk-dev-${VPP_STABLE_VER}.deb" || exit
55 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${VPP_STABLE_VER}/vpp-dpdk-dkms-${VPP_STABLE_VER}.deb" || exit
56 wget -q "${VPP_REPO_URL}/vpp-lib/${VPP_STABLE_VER}/vpp-lib-${VPP_STABLE_VER}.deb" || exit
57 wget -q "${VPP_REPO_URL}/vpp-plugins/${VPP_STABLE_VER}/vpp-plugins-${VPP_STABLE_VER}.deb" || exit
58 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
63 # If we run this script from vpp project we want to use local build
64 elif [[ ${JOB_NAME} == vpp-* ]] ;
66 #use local packages provided as argument list
67 # Jenkins VPP deb paths (convert to full path)
68 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
70 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
75 export PYTHONPATH=${SCRIPT_DIR}
77 sudo apt-get -y update
78 sudo apt-get -y install libpython2.7-dev python-virtualenv
80 virtualenv --system-site-packages env
84 pip install -r requirements.txt
86 # We iterate over available topologies and wait until we reserve topology
88 for TOPOLOGY in ${TOPOLOGIES};
90 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
92 WORKING_TOPOLOGY=${TOPOLOGY}
93 echo "Reserved: ${WORKING_TOPOLOGY}"
98 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
99 # Exit the infinite while loop if we made a reservation
103 # Wait ~3minutes before next try
104 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
105 echo "Sleeping ${SLEEP_TIME}"
109 function cancel_all {
110 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
111 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -c -t $1
114 # On script exit we cancel the reservation and installation and delete all vpp
116 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
118 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -t ${WORKING_TOPOLOGY} \
119 -d ${INSTALLATION_DIR} \
121 if [ $? -eq 0 ]; then
122 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
124 echo "Failed to copy vpp deb files to DUTs"
129 # run specific performance tests based on jenkins job type variable
131 pybot ${PYBOT_ARGS} \
133 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
135 --exclude SKIP_PATCH \
138 RETURN_STATUS=$(echo $?)
141 pybot ${PYBOT_ARGS} \
143 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
147 RETURN_STATUS=$(echo $?)
149 PERFTEST_LONG_BRIDGE )
150 pybot ${PYBOT_ARGS} \
152 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
153 -s "tests.perf.Long_Bridge_Domain*" \
155 RETURN_STATUS=$(echo $?)
158 pybot ${PYBOT_ARGS} \
160 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
161 -s "tests.perf.Long_IPv4*" \
163 RETURN_STATUS=$(echo $?)
166 pybot ${PYBOT_ARGS} \
168 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
169 -s "tests.perf.Long_IPv6*" \
171 RETURN_STATUS=$(echo $?)
173 PERFTEST_LONG_XCONNECT )
174 pybot ${PYBOT_ARGS} \
176 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
177 -s "tests.perf.Long_Xconnect*" \
179 RETURN_STATUS=$(echo $?)
181 PERFTEST_LONG_XCONNECT_DOT1Q )
182 pybot ${PYBOT_ARGS} \
184 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
185 -s "tests.perf.Long_Xconnect_Dot1q*" \
186 RETURN_STATUS=$(echo $?)
189 pybot ${PYBOT_ARGS} \
191 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
192 -s "tests.perf" -i NDR \
194 RETURN_STATUS=$(echo $?)
197 pybot ${PYBOT_ARGS} \
199 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
200 -s "tests.perf" -i PDR \
202 RETURN_STATUS=$(echo $?)
205 #run all available tests
206 pybot ${PYBOT_ARGS} \
208 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
211 RETURN_STATUS=$(echo $?)
214 # run full performance test suite and exit on fail
215 pybot ${PYBOT_ARGS} \
217 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
220 RETURN_STATUS=$(echo $?)
223 # Pybot output post-processing
224 echo Post-processing test data...
226 python ${SCRIPT_DIR}/resources/tools/robot_output_parser.py \
227 -i ${SCRIPT_DIR}/output.xml \
228 -o ${SCRIPT_DIR}/output_perf_data.xml \
230 if [ ! $? -eq 0 ]; then
231 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
236 for i in ${ARCHIVE_ARTIFACTS[@]}; do
237 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
240 echo Post-processing finished.
242 exit ${RETURN_STATUS}