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_3n_hsw_testbed1.yaml \
19 topologies/available/lf_3n_hsw_testbed2.yaml \
20 topologies/available/lf_3n_hsw_testbed3.yaml"
22 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
23 export PYTHONPATH=${SCRIPT_DIR}
24 export DEBIAN_FRONTEND=noninteractive
27 RESERVATION_DIR="/tmp/reservation_dir"
28 INSTALLATION_DIR="/tmp/install_dir"
30 JOB_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
31 LOG_ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
32 JOB_ARCHIVE_DIR="archive"
33 LOG_ARCHIVE_DIR="$WORKSPACE/archives"
34 mkdir -p ${JOB_ARCHIVE_DIR}
35 mkdir -p ${LOG_ARCHIVE_DIR}
37 # If we run this script from CSIT jobs we want to use stable vpp version
38 if [[ ${JOB_NAME} == csit-* ]] ;
40 if [[ ${TEST_TAG} == *DAILY ]] || \
41 [[ ${TEST_TAG} == *WEEKLY ]];
43 echo Downloading latest VPP packages from NEXUS...
44 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh \
47 echo Downloading VPP packages of specific version from NEXUS...
48 DPDK_STABLE_VER=$(cat ${SCRIPT_DIR}/DPDK_STABLE_VER)
49 VPP_STABLE_VER=$(cat ${SCRIPT_DIR}/VPP_STABLE_VER_UBUNTU)
50 #Temporary if arch will not be removed from VPP_STABLE_VER_UBUNTU
51 #VPP_STABLE_VER=${VPP_STABLE_VER%_amd64}
52 bash ${SCRIPT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh \
53 --skip-install --vpp ${VPP_STABLE_VER} --dkms ${DPDK_STABLE_VER}
55 # Jenkins VPP deb paths (convert to full path)
56 VPP_DEBS="$( readlink -f vpp*.deb | tr '\n' ' ' )"
58 # If we run this script from vpp project we want to use local build
59 elif [[ ${JOB_NAME} == vpp-* ]] ;
61 # Use local packages provided as argument list
62 # Jenkins VPP deb paths (convert to full path)
63 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
65 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
71 sudo apt-get -y update
72 sudo apt-get -y install libpython2.7-dev python-virtualenv
74 virtualenv --system-site-packages env
78 pip install -r requirements.txt
80 # We iterate over available topologies and wait until we reserve topology
82 for TOPOLOGY in ${TOPOLOGIES};
84 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -t ${TOPOLOGY}
86 WORKING_TOPOLOGY=${TOPOLOGY}
87 echo "Reserved: ${WORKING_TOPOLOGY}"
92 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
93 # Exit the infinite while loop if we made a reservation
97 # Wait ~3minutes before next try
98 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
99 echo "Sleeping ${SLEEP_TIME}"
103 function cancel_all {
104 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
105 python ${SCRIPT_DIR}/resources/tools/scripts/topo_reservation.py -c -t $1
108 # On script exit we cancel the reservation and installation and delete all vpp
110 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
112 python ${SCRIPT_DIR}/resources/tools/scripts/topo_installation.py \
113 -t ${WORKING_TOPOLOGY} -d ${INSTALLATION_DIR} -p ${VPP_DEBS}
114 if [ $? -eq 0 ]; then
115 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
117 echo "Failed to copy vpp deb files to DUTs"
121 # Based on job we will identify DUT
122 if [[ ${JOB_NAME} == *hc2vpp* ]] ;
125 elif [[ ${JOB_NAME} == *vpp* ]] ;
128 elif [[ ${JOB_NAME} == *ligato* ]] ;
131 elif [[ ${JOB_NAME} == *dpdk* ]] ;
135 echo "Unable to identify dut type based on JOB_NAME variable: ${JOB_NAME}"
139 PYBOT_ARGS="--consolewidth 100 --loglevel TRACE --variable TOPOLOGY_PATH:${WORKING_TOPOLOGY} --suite tests.${DUT}.perf"
142 # select specific performance tests based on jenkins job type variable
144 TAGS=('ndrdiscANDnic_intel-x520-da2AND1c'
145 'ndrdiscANDnic_intel-x520-da2AND2c'
146 'ndrpdrANDnic_intel-x520-da2AND1c'
147 'ndrpdrANDnic_intel-x520-da2AND2c'
148 'ndrdiscAND1cANDipsec'
149 'ndrdiscAND2cANDipsec')
151 PERFTEST_SEMI_WEEKLY )
152 TAGS=('ndrdiscANDnic_intel-x710AND1c'
153 'ndrdiscANDnic_intel-x710AND2c'
154 'ndrdiscANDnic_intel-xl710AND1c'
155 'ndrdiscANDnic_intel-xl710AND2c')
158 TAGS=('mrrAND64bAND1c'
164 'mrrANDimixAND1cANDvhost'
165 'mrrANDimixAND2cANDvhost'
166 'mrrANDimixAND4cANDvhost'
167 'mrrANDimixAND1cANDmemif'
168 'mrrANDimixAND2cANDmemif'
169 'mrrANDimixAND4cANDmemif')
172 if [[ -z "$TEST_TAG_STRING" ]]; then
173 # If nothing is specified, we will run pre-selected tests by
174 # following tags. Items of array will be concatenated by OR in Robot
176 TEST_TAG_ARRAY=('mrrANDnic_intel-x710AND1cAND64bANDip4base'
177 'mrrANDnic_intel-x710AND1cAND78bANDip6base'
178 'mrrANDnic_intel-x710AND1cAND64bANDl2bdbase')
180 # If trigger contains tags, split them into array.
181 TEST_TAG_ARRAY=(${TEST_TAG_STRING//:/ })
186 for TAG in "${TEST_TAG_ARRAY[@]}"; do
187 if [[ ${TAG} == "!"* ]]; then
188 # Exclude tags are not prefixed.
191 # We will prefix with perftest to prevent running other tests
194 if [[ ${JOB_NAME} == vpp-* ]] ; then
195 # Automatic prefixing for VPP jobs to limit the NIC used and
196 # traffic evaluation to MRR.
197 prefix="${prefix}mrrANDnic_intel-x710AND"
199 TAGS+=("$prefix${TAG}")
207 # Catenate TAG selections
209 for TAG in "${TAGS[@]}"; do
210 if [[ ${TAG} == "!"* ]]; then
211 EXPANDED_TAGS+=(" --exclude ${TAG#$"!"} ")
213 EXPANDED_TAGS+=(" --include ${TAG} ")
218 pybot ${PYBOT_ARGS}${EXPANDED_TAGS[@]} tests/
219 RETURN_STATUS=$(echo $?)
221 # Archive JOB artifacts in jenkins
222 for i in ${JOB_ARCHIVE_ARTIFACTS[@]}; do
223 cp $( readlink -f ${i} | tr '\n' ' ' ) ${JOB_ARCHIVE_DIR}/
225 # Archive JOB artifacts to logs.fd.io
226 for i in ${LOG_ARCHIVE_ARTIFACTS[@]}; do
227 cp $( readlink -f ${i} | tr '\n' ' ' ) ${LOG_ARCHIVE_DIR}/
230 exit ${RETURN_STATUS}