blob: b33be3b8d86e4052c1f0de1e89f4d38cbef6f689 [file] [log] [blame]
Matteo Scandoloc0605452019-10-22 10:23:39 -07001#!/bin/bash
2
Joey Armstrong2c039362024-02-04 18:51:52 -05003# Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors
Matteo Scandoloc0605452019-10-22 10:23:39 -07004
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8
9# http://www.apache.org/licenses/LICENSE-2.0
10
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17usage()
18{
19 echo " "
20 echo "Runs BBR against BBSim a number of times and output the results in a file name results.logs"
21 echo " "
22 echo "Usage: $0 [--onus|--pons|--runs]" >&2
23 echo " "
24 echo " -o, --onus Number of ONUs to emulate on each PON"
25 echo " -p, --pons Number of PONs to emulate"
26 echo " -r, --runs Number of runs to perform"
27 echo " "
28 echo "Example usages:"
29 echo " ./$0 -i -p 2 -o 32 -r 10"
30 echo " "
31}
32
33run()
34{
35 echo "Running with: ${ONU} Onus ${PON} Pons for ${RUN} times" >> results.logs
36 for i in {0..10}
37 do
38 echo "RUN Number: $i"
39 docker rm -f bbsim
40 DOCKER_RUN_ARGS="-pon ${PON} -onu ${ONU}" make docker-run
41 sleep 5
42 ./bbr -pon $PON -onu $ONU 2>&1 | tee bbr.logs
43 docker logs bbsim 2>&1 | tee bbsim.logs
44 echo "RUN Number: $i" >> results.logs
45 cat bbr.logs | grep Duration | awk '{print $5}' >> results.logs
46 done
47}
48
49ONU=1
50PON=1
51RUN=10
52
53while [ "$1" != "" ]; do
54 case $1 in
55 -h | --help)
56 usage
57 exit 0
58 ;;
59 -o | --onus ) ONU=$2
60 ;;
61 -p | --pons ) PON=$2
62 ;;
63 -r | --runs ) RUN=$2
64 ;;
65 --) # End of all options
66 shift
67 break
68 ;;
69 esac
70 shift
71done
72
73run
74
Joey Armstronga7ef8d22023-12-11 18:11:53 -050075# [EOF]