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' ' ' )"
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' ' ' )"
71 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
76 export PYTHONPATH=${SCRIPT_DIR}
78 sudo apt-get -y update
79 sudo apt-get -y install libpython2.7-dev python-virtualenv
81 virtualenv --system-site-packages env
85 pip install -r requirements.txt
87 # We iterate over available topologies and wait until we reserve topology
89 for TOPOLOGY in ${TOPOLOGIES};
91 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
93 WORKING_TOPOLOGY=${TOPOLOGY}
94 echo "Reserved: ${WORKING_TOPOLOGY}"
99 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
100 # Exit the infinite while loop if we made a reservation
104 # Wait ~3minutes before next try
105 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
106 echo "Sleeping ${SLEEP_TIME}"
110 function cancel_all {
111 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
112 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -c -t $1
115 # On script exit we cancel the reservation and installation and delete all vpp
117 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
119 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -t ${WORKING_TOPOLOGY} \
120 -d ${INSTALLATION_DIR} \
122 if [ $? -eq 0 ]; then
123 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
125 echo "Failed to copy vpp deb files to DUTs"
130 # run specific performance tests based on jenkins job type variable
132 pybot ${PYBOT_ARGS} \
134 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
136 --exclude SKIP_PATCH \
139 RETURN_STATUS=$(echo $?)
142 pybot ${PYBOT_ARGS} \
144 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
148 RETURN_STATUS=$(echo $?)
150 PERFTEST_LONG_BRIDGE )
151 pybot ${PYBOT_ARGS} \
153 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
154 -s "tests.perf.Long_Bridge_Domain*" \
156 RETURN_STATUS=$(echo $?)
159 pybot ${PYBOT_ARGS} \
161 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
162 -s "tests.perf.Long_IPv4*" \
164 RETURN_STATUS=$(echo $?)
167 pybot ${PYBOT_ARGS} \
169 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
170 -s "tests.perf.Long_IPv6*" \
172 RETURN_STATUS=$(echo $?)
174 PERFTEST_LONG_XCONNECT )
175 pybot ${PYBOT_ARGS} \
177 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
178 -s "tests.perf.Long_Xconnect*" \
180 RETURN_STATUS=$(echo $?)
182 PERFTEST_LONG_XCONNECT_DOT1Q )
183 pybot ${PYBOT_ARGS} \
185 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
186 -s "tests.perf.Long_Xconnect_Dot1q*" \
187 RETURN_STATUS=$(echo $?)
190 pybot ${PYBOT_ARGS} \
192 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
193 -s "tests.perf" -i NDR \
195 RETURN_STATUS=$(echo $?)
198 pybot ${PYBOT_ARGS} \
200 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
201 -s "tests.perf" -i PDR \
203 RETURN_STATUS=$(echo $?)
206 #run all available tests
207 pybot ${PYBOT_ARGS} \
209 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
212 RETURN_STATUS=$(echo $?)
215 # run full performance test suite and exit on fail
216 pybot ${PYBOT_ARGS} \
218 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
221 RETURN_STATUS=$(echo $?)
224 # Pybot output post-processing
225 echo Post-processing test data...
227 python ${SCRIPT_DIR}/resources/tools/robot_output_parser.py \
228 -i ${SCRIPT_DIR}/output.xml \
229 -o ${SCRIPT_DIR}/output_perf_data.xml \
231 if [ ! $? -eq 0 ]; then
232 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
237 for i in ${ARCHIVE_ARTIFACTS[@]}; do
238 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
241 echo Post-processing finished.
243 exit ${RETURN_STATUS}