2 # Copyright (c) 2018 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 JOB_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
29 LOG_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
30 JOB_ARCHIVE_DIR="archive"
31 LOG_ARCHIVE_DIR="$WORKSPACE/archives"
32 mkdir -p ${JOB_ARCHIVE_DIR}
33 mkdir -p ${LOG_ARCHIVE_DIR}
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} == *DAILY ]] || \
42 [[ ${TEST_TAG} == *WEEKLY ]];
44 # Download the latest VPP build .deb install packages
45 echo Downloading VPP packages...
46 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh --skip-install
48 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
49 # Take vpp package and get the vpp version
50 VPP_STABLE_VER="$( expr match $(ls *.deb | head -n 1) 'vpp-\(.*\)-deb.deb' )"
52 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)_amd64
53 VPP_REPO_URL=$(cat ${SCRIPT_DIR}/VPP_REPO_URL_UBUNTU)
54 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER_UBUNTU)
56 # Download vpp build from nexus and set VPP_DEBS variable
57 wget -q "${VPP_REPO_URL}/vpp/${VPP_STABLE_VER}/vpp-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
58 wget -q "${VPP_REPO_URL}/vpp-dbg/${VPP_STABLE_VER}/vpp-dbg-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
59 wget -q "${VPP_REPO_URL}/vpp-dev/${VPP_STABLE_VER}/vpp-dev-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
60 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${DPDK_STABLE_VER}/vpp-dpdk-dkms-${DPDK_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
61 wget -q "${VPP_REPO_URL}/vpp-lib/${VPP_STABLE_VER}/vpp-lib-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
62 wget -q "${VPP_REPO_URL}/vpp-plugins/${VPP_STABLE_VER}/vpp-plugins-${VPP_STABLE_VER}${VPP_CLASSIFIER}.deb" || exit
63 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
68 # If we run this script from vpp project we want to use local build
69 elif [[ ${JOB_NAME} == vpp-* ]] ;
71 # Use local packages provided as argument list
72 # Jenkins VPP deb paths (convert to full path)
73 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
74 # Take vpp package and get the vpp version
75 VPP_STABLE_VER="$( expr match $1 'vpp-\(.*\)-deb.deb' )"
77 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
82 export PYTHONPATH=${SCRIPT_DIR}
84 sudo apt-get -y update
85 sudo apt-get -y install libpython2.7-dev python-virtualenv
87 virtualenv --system-site-packages env
91 pip install -r requirements.txt
93 # We iterate over available topologies and wait until we reserve topology
95 for TOPOLOGY in ${TOPOLOGIES};
97 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
99 WORKING_TOPOLOGY=${TOPOLOGY}
100 echo "Reserved: ${WORKING_TOPOLOGY}"
105 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
106 # Exit the infinite while loop if we made a reservation
110 # Wait ~3minutes before next try
111 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
112 echo "Sleeping ${SLEEP_TIME}"
116 function cancel_all {
117 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
118 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
121 # On script exit we cancel the reservation and installation and delete all vpp
123 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
125 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py \
126 -t ${WORKING_TOPOLOGY} -d ${INSTALLATION_DIR} -p ${VPP_DEBS}
127 if [ $? -eq 0 ]; then
128 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
130 echo "Failed to copy vpp deb files to DUTs"
134 # Based on job we will identify DUT
135 if [[ ${JOB_NAME} == *hc2vpp* ]] ;
138 elif [[ ${JOB_NAME} == *vpp* ]] ;
141 elif [[ ${JOB_NAME} == *ligato* ]] ;
144 elif [[ ${JOB_NAME} == *dpdk* ]] ;
148 echo "Unable to identify dut type based on JOB_NAME variable: ${JOB_NAME}"
152 PYBOT_ARGS="--consolewidth 120 --loglevel TRACE --variable TOPOLOGY_PATH:${WORKING_TOPOLOGY} --suite tests.${DUT}.perf"
155 # select specific performance tests based on jenkins job type variable
157 TAGS=('ndrdiscANDnic_intel-x520-da2AND1t1c'
158 'ndrdiscANDnic_intel-x520-da2AND2t2c'
159 'ndrpdrANDnic_intel-x520-da2AND1t1c'
160 'ndrpdrANDnic_intel-x520-da2AND2t2c'
161 'ndrdiscAND1t1cANDipsec'
162 'ndrdiscAND2t2cANDipsec')
164 PERFTEST_SEMI_WEEKLY )
165 TAGS=('ndrdiscANDnic_intel-x710AND1t1c'
166 'ndrdiscANDnic_intel-x710AND2t2c'
167 'ndrdiscANDnic_intel-xl710AND1t1c'
168 'ndrdiscANDnic_intel-xl710AND2t2c')
171 TAGS=('mrrAND64bAND1t1c'
177 'mrrANDimixAND1t1cANDvhost'
178 'mrrANDimixAND2t2cANDvhost'
179 'mrrANDimixAND4t4cANDvhost'
180 'mrrANDimixAND1t1cANDmemif'
181 'mrrANDimixAND2t2cANDmemif'
182 'mrrANDimixAND4t4cANDmemif')
184 VERIFY-PERF-NDRDISC )
185 TAGS=('ndrdiscAND1t1c'
188 VERIFY-PERF-PDRDISC )
189 TAGS=('pdrdiscAND1t1c'
197 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDip4base'
198 'mrrANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m')
201 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDip6base'
202 'mrrANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m')
205 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDl2xcbase'
206 'mrrANDnic_intel-x520-da2AND1t1cANDl2bdbase')
209 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDlisp')
212 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDvxlan')
215 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDvhost')
218 TAGS=('pdrdiscANDnic_intel-x520-da2AND1t1cANDmemif'
219 'pdrdiscANDnic_intel-x520-da2AND2t2cANDmemif'
220 'mrrANDnic_intel-x520-da2AND1t1cANDmemif'
221 'mrrANDnic_intel-x520-da2AND2t2cANDmemif')
223 VERIFY-PERF-IPSECHW )
224 TAGS=('pdrdiscANDnic_intel-xl710AND1t1cANDipsechw'
225 'pdrdiscANDnic_intel-xl710AND2t2cANDipsechw'
226 'mrrANDnic_intel-xl710AND1t1cANDipsechw'
227 'mrrANDnic_intel-xl710AND2t2cANDipsechw')
230 TAGS=('mrrANDsrv6AND1t1c'
233 VPP-VERIFY-PERF-IP4 )
234 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDip4base'
235 'mrrANDnic_intel-x520-da2AND1t1cANDip4fwdANDfib_2m')
237 VPP-VERIFY-PERF-IP6 )
238 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDip6base'
239 'mrrANDnic_intel-x520-da2AND1t1cANDip6fwdANDfib_2m')
242 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDl2xcbase'
243 'mrrANDnic_intel-x520-da2AND1t1cANDl2bdbase'
244 'mrrANDnic_intel-x520-da2AND1t1cANDdot1q')
246 VPP-VERIFY-PERF-LISP )
247 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDlisp')
249 VPP-VERIFY-PERF-VXLAN )
250 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDvxlan')
252 VPP-VERIFY-PERF-VHOST )
253 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDvhost')
255 VPP-VERIFY-PERF-MEMIF )
256 TAGS=('pdrdiscANDnic_intel-x520-da2AND1t1cANDmemif'
257 'pdrdiscANDnic_intel-x520-da2AND2t2cANDmemif'
258 'mrrANDnic_intel-x520-da2AND1t1cANDmemif'
259 'mrrANDnic_intel-x520-da2AND2t2cANDmemif')
261 VPP-VERIFY-PERF-ACL )
262 TAGS=('mrrANDnic_intel-x520-da2AND1t1cANDacl'
263 'mrrANDnic_intel-x520-da2AND2t2cANDacl')
265 VPP-VERIFY-PERF-IPSECHW )
266 TAGS=('pdrdiscANDnic_intel-xl710AND1t1cANDipsechw'
267 'pdrdiscANDnic_intel-xl710AND2t2cANDipsechw'
268 'mrrANDnic_intel-xl710AND1t1cANDipsechw'
269 'mrrANDnic_intel-xl710AND2t2cANDipsechw')
271 VPP-VERIFY-PERF-SRV6 )
272 TAGS=('mrrANDsrv6AND1t1c'
279 # Catenate TAG selections by 'OR'
280 printf -v INCLUDES " --include %s " "${TAGS[@]}"
283 pybot ${PYBOT_ARGS}${INCLUDES} tests/
284 RETURN_STATUS=$(echo $?)
286 # Archive JOB artifacts in jenkins
287 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
288 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
290 # Archive JOB artifacts to logs.fd.io
291 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
292 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
295 exit ${RETURN_STATUS}