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-710-520.yaml \
19 topologies/available/lf_testbed2-710-520.yaml"
21 VPP_STABLE_VER="1.0.0-437~g8f15e92_amd64"
22 VPP_REPO_URL="https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp"
25 RESERVATION_DIR="/tmp/reservation_dir"
26 INSTALLATION_DIR="/tmp/install_dir"
28 PYBOT_ARGS="--noncritical MULTI_THREAD"
30 ARCHIVE_ARTIFACTS=(log.html output.xml report.html output_perf_data.json)
32 # If we run this script from CSIT jobs we want to use stable vpp version
33 if [[ ${JOB_NAME} == csit-* ]] ;
37 #download vpp build from nexus and set VPP_DEBS variable
38 wget -q "${VPP_REPO_URL}/vpp/${VPP_STABLE_VER}/vpp-${VPP_STABLE_VER}.deb" || exit
39 wget -q "${VPP_REPO_URL}/vpp-dbg/${VPP_STABLE_VER}/vpp-dbg-${VPP_STABLE_VER}.deb" || exit
40 wget -q "${VPP_REPO_URL}/vpp-dev/${VPP_STABLE_VER}/vpp-dev-${VPP_STABLE_VER}.deb" || exit
41 wget -q "${VPP_REPO_URL}/vpp-dpdk-dev/${VPP_STABLE_VER}/vpp-dpdk-dev-${VPP_STABLE_VER}.deb" || exit
42 wget -q "${VPP_REPO_URL}/vpp-dpdk-dkms/${VPP_STABLE_VER}/vpp-dpdk-dkms-${VPP_STABLE_VER}.deb" || exit
43 wget -q "${VPP_REPO_URL}/vpp-lib/${VPP_STABLE_VER}/vpp-lib-${VPP_STABLE_VER}.deb" || exit
44 VPP_DEBS="$( readlink -f *.deb | tr '\n' ' ' )"
45 PYBOT_ARGS="${PYBOT_ARGS} --exitonfailure"
48 # If we run this script from vpp project we want to use local build
49 elif [[ ${JOB_NAME} == vpp-* ]] ;
51 #use local packages provided as argument list
52 # Jenkins VPP deb paths (convert to full path)
53 VPP_DEBS="$( readlink -f $@ | tr '\n' ' ' )"
55 echo "Unable to identify job type based on JOB_NAME variable: ${JOB_NAME}"
59 CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
61 export PYTHONPATH=${CUR_DIR}
63 sudo apt-get -y update
64 sudo apt-get -y install libpython2.7-dev python-virtualenv
70 pip install -r requirements.txt
72 # We iterate over available topologies and wait until we reserve topology
74 for TOPOLOGY in ${TOPOLOGIES};
76 python ${CUR_DIR}/resources/tools/topo_reservation.py -t ${TOPOLOGY}
78 WORKING_TOPOLOGY=${TOPOLOGY}
79 echo "Reserved: ${WORKING_TOPOLOGY}"
84 if [ ! -z "${WORKING_TOPOLOGY}" ]; then
85 # Exit the infinite while loop if we made a reservation
89 # Wait ~3minutes before next try
90 SLEEP_TIME=$[ ( $RANDOM % 20 ) + 180 ]s
91 echo "Sleeping ${SLEEP_TIME}"
96 python ${CUR_DIR}/resources/tools/topo_installation.py -c -d ${INSTALLATION_DIR} -t $1
97 python ${CUR_DIR}/resources/tools/topo_reservation.py -c -t $1
100 # On script exit we cancel the reservation and installation and delete all vpp
102 trap "cancel_all ${WORKING_TOPOLOGY}" EXIT
104 python ${CUR_DIR}/resources/tools/topo_installation.py -t ${WORKING_TOPOLOGY} \
105 -d ${INSTALLATION_DIR} \
107 if [ $? -eq 0 ]; then
108 echo "VPP Installed on hosts from: ${WORKING_TOPOLOGY}"
110 echo "Failed to copy vpp deb files to DUTs"
115 # run specific performance tests based on jenkins job type variable
117 pybot ${PYBOT_ARGS} \
119 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
124 pybot ${PYBOT_ARGS} \
126 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
130 PERFTEST_LONG_BRIDGE )
131 pybot ${PYBOT_ARGS} \
133 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
134 -s "performance.Long_Bridge_Domain*" \
138 pybot ${PYBOT_ARGS} \
140 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
141 -s "performance.Long_IPv4*" \
145 pybot ${PYBOT_ARGS} \
147 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
148 -s "performance.Long_IPv6*" \
151 PERFTEST_LONG_XCONNECT )
152 pybot ${PYBOT_ARGS} \
154 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
155 -s "performance.Long_Xconnect*" \
159 # run full performance test suite and exit on fail
160 pybot ${PYBOT_ARGS} \
162 -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \
167 # Pybot output post-processing
168 python ${CUR_DIR}/resources/tools/robot_output_parser.py \
169 -i ${CUR_DIR}/output.xml \
170 -o ${CUR_DIR}/output_perf_data.json \
172 if [ ! $? -eq 0 ]; then
173 echo "Parsing ${CUR_DIR}/output.xml failed"
178 for i in ${ARCHIVE_ARTIFACTS[@]}; do
179 cp $( readlink -f ${i} | tr '\n' ' ' ) archive/