Commit 3f6b04ef authored by Andreas Schmidt's avatar Andreas Schmidt

Update Dockers entrypoint to use named parameters.

parent ececaef2
Pipeline #1548 passed with stages
in 1 minute and 23 seconds
......@@ -47,6 +47,6 @@ The following shows how to run the PRRT sender and receiver on a host with Openv
bridge=$(docker network create --subnet="10.5.1.0/24" prrt | cut -c1-12)
ovs-vsctl add-port of-switch br-$bridge
docker run --rm --name=prrt_recv --network="prrt" -v=/opt/prrt:/output --ip=10.5.1.52 --cap-add NET_ADMIN docker.nt.uni-saarland.de/larn/prrt:develop receiver 5000 127
docker run --rm --name=prrt_send --network="prrt" -v=/opt/prrt:/output --ip=10.5.1.51 --cap-add NET_ADMIN docker.nt.uni-saarland.de/larn/prrt:develop sender 10.50.1.52 5000 127 rate 1mbit
docker run --rm --name=prrt_recv --network="prrt" -v=/opt/prrt:/output --ip=10.5.1.52 --cap-add NET_ADMIN docker.nt.uni-saarland.de/larn/prrt:develop receiver -p 5000 -r 127
docker run --rm --name=prrt_send --network="prrt" -v=/opt/prrt:/output --ip=10.5.1.51 --cap-add NET_ADMIN docker.nt.uni-saarland.de/larn/prrt:develop sender -t 10.50.1.52 -p 5000 -r 127 rate 1mbit
```
\ No newline at end of file
......@@ -5,21 +5,37 @@ dev=eth0
command=$1
shift
if [[ "$command" == "sender" ]]; then
params=$1; shift # Add Host
elif [[ "$command" == "receiver" ]]; then
if [[ "$command" == "sender" || "$command" == "receiver" ]]; then
:
else
echo "Command should be either sender or receiver."
exit 0;
fi
params=$(echo $params $1); shift # Add Port
params=$(echo $params $1); shift # Add Rounds
NETEM=()
PRRT=()
while [[ $# -gt 0 ]]
do
key="$1"
netem_params="$@"
case $key in
-t|--target|-p|--port|-r|--rounds)
PRRT+=("$1 $2")
shift
shift
;;
*) # unknown option
NETEM+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
echo "Running PRRT with command" $command $params "with link params:" $netem_params
PRRT_PARAMS="${PRRT[@]}"
NETEM_PARAMS="${NETEM[@]}"
tc qdisc add dev $dev root netem $netem_params
/prrt/bin/$command $params /output/log.csv
echo "Running PRRT with command: \"$command $PRRT_PARAMS\" and link parameters: \"$NETEM_PARAMS\""
tc qdisc add dev $dev root netem $NETEM_PARAMS
/prrt/bin/$command $PRRT_PARAMS -o /output/log.csv
tc qdisc del dev $dev root
......@@ -8,7 +8,7 @@
PrrtSocket *s = NULL;
static volatile int keepRunning = true;
static char doc[] = "PRRT Sender";
static char doc[] = "PRRT Receiver";
static struct argp_option options[] = {
{"port", 'p', "PORT", 0, "Target Port" },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment