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-X710-X520.yaml \
19 topologies/available/lf_testbed2-X710-X520.yaml \
20 topologies/available/lf_testbed3-X710-X520.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"
31 PYBOT_ARGS="-W 150 --noncritical PERFTEST --exclude SKIP_PATCH"
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 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
50 # If we run this script from vpp project we want to use local build
51 elif [[ ${JOB_NAME} == vpp-* ]] ;
53 #use local packages provided as argument list
54 # Jenkins VPP deb paths (convert to full path)
55 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
57 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
62 export PYTHONPATH=${SCRIPT_DIR}
64 sudo apt-get -y update
65 sudo apt-get -y install libpython2.7-dev python-virtualenv
67 virtualenv --system-site-packages env
71 pip install -r requirements.txt
73 # We iterate over available topologies and wait until we reserve topology
75 for TOPOLOGY in ${TOPOLOGIES};
77 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
79 WORKING_TOPOLOGY=${TOPOLOGY}
80 echo "Reserved: ${WORKING_TOPOLOGY}"
85 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
86 # Exit the infinite while loop if we made a reservation
90 # Wait ~3minutes before next try
91 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
92 echo "Sleeping ${SLEEP_TIME}"
97 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
98 python ${SCRIPT_DIR}/resources/tools/topo_reservation.py -c -t $1
101 # On script exit we cancel the reservation and installation and delete all vpp
103 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
105 python ${SCRIPT_DIR}/resources/tools/topo_installation.py -t ${WORKING_TOPOLOGY} \
106 -d ${INSTALLATION_DIR} \
108 if [ $? -eq 0 ]; then
109 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
111 echo "Failed to copy vpp deb files to DUTs"
116 # run specific performance tests based on jenkins job type variable
118 pybot ${PYBOT_ARGS} \
120 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
124 RETURN_STATUS=$(echo $?)
127 pybot ${PYBOT_ARGS} \
129 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
133 RETURN_STATUS=$(echo $?)
135 PERFTEST_LONG_BRIDGE )
136 pybot ${PYBOT_ARGS} \
138 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
139 -s "tests.perf.Long_Bridge_Domain*" \
141 RETURN_STATUS=$(echo $?)
144 pybot ${PYBOT_ARGS} \
146 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
147 -s "tests.perf.Long_IPv4*" \
149 RETURN_STATUS=$(echo $?)
152 pybot ${PYBOT_ARGS} \
154 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
155 -s "tests.perf.Long_IPv6*" \
157 RETURN_STATUS=$(echo $?)
159 PERFTEST_LONG_XCONNECT )
160 pybot ${PYBOT_ARGS} \
162 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
163 -s "tests.perf.Long_Xconnect*" \
165 RETURN_STATUS=$(echo $?)
167 PERFTEST_LONG_XCONNECT_DOT1Q )
168 pybot ${PYBOT_ARGS} \
170 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
171 -s "tests.perf.Long_Xconnect_Dot1q*" \
172 RETURN_STATUS=$(echo $?)
175 pybot ${PYBOT_ARGS} \
177 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
178 -s "tests.perf" -i NDR \
180 RETURN_STATUS=$(echo $?)
183 pybot ${PYBOT_ARGS} \
185 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
186 -s "tests.perf" -i PDR \
188 RETURN_STATUS=$(echo $?)
191 # run full performance test suite and exit on fail
192 pybot ${PYBOT_ARGS} \
194 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
197 RETURN_STATUS=$(echo $?)
200 # Pybot output post-processing
201 echo Post-processing test data...
203 python ${SCRIPT_DIR}/resources/tools/robot_output_parser.py \
204 -i ${SCRIPT_DIR}/output.xml \
205 -o ${SCRIPT_DIR}/output_perf_data.xml \
207 if [ ! $? -eq 0 ]; then
208 echo "Parsing ${SCRIPT_DIR}/output.xml failed"
213 for i in ${ARCHIVE_ARTIFACTS[@]}; do
214 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
217 echo Post-processing finished.
219 exit ${RETURN_STATUS}