Matteo Scandolo | c060545 | 2019-10-22 10:23:39 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Joey Armstrong | 2c03936 | 2024-02-04 18:51:52 -0500 | [diff] [blame^] | 3 | # Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Matteo Scandolo | c060545 | 2019-10-22 10:23:39 -0700 | [diff] [blame] | 4 | |
| 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 | |
| 17 | usage() |
| 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 | |
| 33 | run() |
| 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 | |
| 49 | ONU=1 |
| 50 | PON=1 |
| 51 | RUN=10 |
| 52 | |
| 53 | while [ "$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 |
| 71 | done |
| 72 | |
| 73 | run |
| 74 | |
Joey Armstrong | a7ef8d2 | 2023-12-11 18:11:53 -0500 | [diff] [blame] | 75 | # [EOF] |