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 )"
25 RESERVATION_DIR="/tmp/reservation_dir"
26 INSTALLATION_DIR="/tmp/install_dir"
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} \
142 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
144 --exclude SKIP_PATCH \
147 RETURN_STATUS=$(echo $?)
150 pybot ${PYBOT_ARGS} \
152 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
156 RETURN_STATUS=$(echo $?)
159 #run all available tests
160 pybot ${PYBOT_ARGS} \
162 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
165 RETURN_STATUS=$(echo $?)
168 # run full performance test suite and exit on fail
169 pybot ${PYBOT_ARGS} \
171 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
174 RETURN_STATUS=$(echo $?)
177 # Pybot output post-processing
178 echo Post-processing test data...
180 python ${SCRIPT_DIR}/resources/tools/robot_output_parser.py \
181 -i ${SCRIPT_DIR}/output.xml \
182 -o ${SCRIPT_DIR}/output_perf_data.xml \
184 if [ ! $? -eq 0 ]; then
185 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
190 for i in ${ARCHIVE_ARTIFACTS[@]}; do
191 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
194 echo Post-processing finished.
196 exit ${RETURN_STATUS}