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.
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"
28 PYBOT_ARGS="-W 150 -L TRACE"
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 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)_amd64
49 VPP_REPO_URL=$(cat ${SCRIPT_DIR}/VPP_REPO_URL_UBUNTU)
50 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER_UBUNTU)
52 # Download vpp build from nexus and set VPP_DEBS variable
53 wget -q "${VPP_REPO_URL}/vpp/${VPP_STABLE_VER}/vpp-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
54 wget -q "${VPP_REPO_URL}/vpp-dbg/${VPP_STABLE_VER}/vpp-dbg-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
55 wget -q "${VPP_REPO_URL}/vpp-dev/${VPP_STABLE_VER}/vpp-dev-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
56 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${DPDK_STABLE_VER}/vpp-dpdk-dkms-${DPDK_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' )"
72 # Download DPDK parts not included in dpdk plugin of vpp build
73 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)_amd64
74 VPP_REPO_URL=$(cat ${SCRIPT_DIR}/VPP_REPO_URL_UBUNTU)
76 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${DPDK_STABLE_VER}/vpp-dpdk-dkms-${DPDK_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
77 VPP_DEBS+=($( readlink -f vpp-dpdk-dkms-${DPDK_STABLE_VER}${VPP_CLASSIFIER}.deb ))
79 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
84 export PYTHONPATH=${SCRIPT_DIR}
86 sudo apt-get -y update
87 sudo apt-get -y install libpython2.7-dev python-virtualenv
89 virtualenv --system-site-packages env
93 pip install -r requirements.txt
95 # We iterate over available topologies and wait until we reserve topology
97 for TOPOLOGY in ${TOPOLOGIES};
99 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
100 if [ $? -eq 0 ]; then
101 WORKING_TOPOLOGY=${TOPOLOGY}
102 echo "Reserved: ${WORKING_TOPOLOGY}"
107 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
108 # Exit the infinite while loop if we made a reservation
112 # Wait ~3minutes before next try
113 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
114 echo "Sleeping ${SLEEP_TIME}"
118 function cancel_all {
119 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
120 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -c -t $1
123 # On script exit we cancel the reservation and installation and delete all vpp
125 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
127 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -t ${WORKING_TOPOLOGY} \
128 -d ${INSTALLATION_DIR} \
130 if [ $? -eq 0 ]; then
131 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
133 echo "Failed to copy vpp deb files to DUTs"
138 # run specific performance tests based on jenkins job type variable
140 pybot ${PYBOT_ARGS} \
141 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
143 --include ndrdiscANDnic_intel-x520-da2AND1t1cORndrdiscANDnic_intel-x520-da2AND2t2c \
145 RETURN_STATUS=$(echo $?)
147 PERFTEST_SEMI_WEEKLY )
148 pybot ${PYBOT_ARGS} \
149 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
151 --include ndrdiscANDnic_intel-x710AND1t1cORndrdiscANDnic_intel-x710AND2t2cORndrdiscANDnic_intel-xl710AND1t1cORndrdiscANDnic_intel-xl710AND2t2c \
153 RETURN_STATUS=$(echo $?)
155 VERIFY-PERF-NDRDISC )
156 pybot ${PYBOT_ARGS} \
157 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
159 --include ndrdiscAND1t1cORndrdiscAND2t2c \
161 RETURN_STATUS=$(echo $?)
163 VERIFY-PERF-PDRDISC )
164 pybot ${PYBOT_ARGS} \
165 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
167 --include pdrdiscAND1t1cORpdrdiscAND2t2c \
169 RETURN_STATUS=$(echo $?)
172 pybot ${PYBOT_ARGS} \
173 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
175 --include ndrchkAND1t1cORndrchkAND2t2c \
177 RETURN_STATUS=$(echo $?)
179 PERFTEST_NDRCHK_DAILY )
180 pybot ${PYBOT_ARGS} \
181 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
183 --include ndrchkAND1t1cORndrchkAND2t2c \
185 RETURN_STATUS=$(echo $?)
188 pybot ${PYBOT_ARGS} \
189 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
191 --exclude SKIP_PATCH \
194 RETURN_STATUS=$(echo $?)
197 pybot ${PYBOT_ARGS} \
198 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
202 RETURN_STATUS=$(echo $?)
205 #run all available tests
206 pybot ${PYBOT_ARGS} \
207 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
210 RETURN_STATUS=$(echo $?)
213 # run full performance test suite and exit on fail
214 pybot ${PYBOT_ARGS} \
215 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
218 RETURN_STATUS=$(echo $?)
221 # Pybot output post-processing
222 echo Post-processing test data...
224 python ${SCRIPT_DIR}/resources/tools/robot_output_parser.py \
225 -i ${SCRIPT_DIR}/output.xml \
226 -o ${SCRIPT_DIR}/output_perf_data.xml \
228 if [ ! $? -eq 0 ]; then
229 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
234 for i in ${ARCHIVE_ARTIFACTS[@]}; do
235 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
238 echo Post-processing finished.
240 exit ${RETURN_STATUS}