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-* ]] ;
40 #download vpp build from nexus and set VPP_DEBS variable
41 wget -q "${VPP_REPO_URL}/vpp/${VPP_STABLE_VER}/vpp-${VPP_STABLE_VER}.deb" || exit
42 wget -q "${VPP_REPO_URL}/vpp-dbg/${VPP_STABLE_VER}/vpp-dbg-${VPP_STABLE_VER}.deb" || exit
43 wget -q "${VPP_REPO_URL}/vpp-dev/${VPP_STABLE_VER}/vpp-dev-${VPP_STABLE_VER}.deb" || exit
44 wget -q "${VPP_REPO_URL}/vpp-dpdk-dev/${VPP_STABLE_VER}/vpp-dpdk-dev-${VPP_STABLE_VER}.deb" || exit
45 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${VPP_STABLE_VER}/vpp-dpdk-dkms-${VPP_STABLE_VER}.deb" || exit
46 wget -q "${VPP_REPO_URL}/vpp-lib/${VPP_STABLE_VER}/vpp-lib-${VPP_STABLE_VER}.deb" || exit
47 wget -q "${VPP_REPO_URL}/vpp-plugins/${VPP_STABLE_VER}/vpp-plugins-${VPP_STABLE_VER}.deb" || exit
48 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
51 # If we run this script from vpp project we want to use local build
52 elif [[ ${JOB_NAME} == vpp-* ]] ;
54 #use local packages provided as argument list
55 # Jenkins VPP deb paths (convert to full path)
56 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
58 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
63 export PYTHONPATH=${SCRIPT_DIR}
65 sudo apt-get -y update
66 sudo apt-get -y install libpython2.7-dev python-virtualenv
68 virtualenv --system-site-packages env
72 pip install -r requirements.txt
74 # We iterate over available topologies and wait until we reserve topology
76 for TOPOLOGY in ${TOPOLOGIES};
78 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
80 WORKING_TOPOLOGY=${TOPOLOGY}
81 echo "Reserved: ${WORKING_TOPOLOGY}"
86 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
87 # Exit the infinite while loop if we made a reservation
91 # Wait ~3minutes before next try
92 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
93 echo "Sleeping ${SLEEP_TIME}"
98 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
99 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -c -t $1
102 # On script exit we cancel the reservation and installation and delete all vpp
104 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
106 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -t ${WORKING_TOPOLOGY} \
107 -d ${INSTALLATION_DIR} \
109 if [ $? -eq 0 ]; then
110 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
112 echo "Failed to copy vpp deb files to DUTs"
117 # run specific performance tests based on jenkins job type variable
119 pybot ${PYBOT_ARGS} \
121 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
123 --exclude SKIP_PATCH \
126 RETURN_STATUS=$(echo $?)
129 pybot ${PYBOT_ARGS} \
131 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
135 RETURN_STATUS=$(echo $?)
137 PERFTEST_LONG_BRIDGE )
138 pybot ${PYBOT_ARGS} \
140 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
141 -s "tests.perf.Long_Bridge_Domain*" \
143 RETURN_STATUS=$(echo $?)
146 pybot ${PYBOT_ARGS} \
148 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
149 -s "tests.perf.Long_IPv4*" \
151 RETURN_STATUS=$(echo $?)
154 pybot ${PYBOT_ARGS} \
156 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
157 -s "tests.perf.Long_IPv6*" \
159 RETURN_STATUS=$(echo $?)
161 PERFTEST_LONG_XCONNECT )
162 pybot ${PYBOT_ARGS} \
164 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
165 -s "tests.perf.Long_Xconnect*" \
167 RETURN_STATUS=$(echo $?)
169 PERFTEST_LONG_XCONNECT_DOT1Q )
170 pybot ${PYBOT_ARGS} \
172 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
173 -s "tests.perf.Long_Xconnect_Dot1q*" \
174 RETURN_STATUS=$(echo $?)
177 pybot ${PYBOT_ARGS} \
179 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
180 -s "tests.perf" -i NDR \
182 RETURN_STATUS=$(echo $?)
185 pybot ${PYBOT_ARGS} \
187 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
188 -s "tests.perf" -i PDR \
190 RETURN_STATUS=$(echo $?)
193 #run all available tests
194 pybot ${PYBOT_ARGS} \
196 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
199 RETURN_STATUS=$(echo $?)
202 # run full performance test suite and exit on fail
203 pybot ${PYBOT_ARGS} \
205 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
208 RETURN_STATUS=$(echo $?)
211 # Pybot output post-processing
212 echo Post-processing test data...
214 python ${SCRIPT_DIR}/resources/tools/robot_output_parser.py \
215 -i ${SCRIPT_DIR}/output.xml \
216 -o ${SCRIPT_DIR}/output_perf_data.xml \
218 if [ ! $? -eq 0 ]; then
219 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
224 for i in ${ARCHIVE_ARTIFACTS[@]}; do
225 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
228 echo Post-processing finished.
230 exit ${RETURN_STATUS}