summaryrefslogtreecommitdiffstats
path: root/tests/channel.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/channel.sh')
-rwxr-xr-xtests/channel.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/channel.sh b/tests/channel.sh
new file mode 100755
index 000000000..28a187e72
--- /dev/null
+++ b/tests/channel.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -e
+
+DEV=$2
+RATE=$3mbit
+DELAY=$4ms
+JITTER=$5ms
+LOSS=$6
+
+if [[ $1 -eq "set" ]]; then
+ tc qdisc add dev "$DEV" root handle 1:0 htb default 1
+ tc class add dev "$DEV" parent 1:0 classid 1:1 htb rate "$RATE"
+ tc qdisc add dev "$DEV" parent 1:1 handle 2:0 netem delay "$DELAY"
+ "$JITTER" loss random "$LOSS"
+ echo "Dev: $DEV, rate: $RATE, delay: $DELAY, jitter: $JITTER, loss: $LOSS%"
+elif [[ $1 -eq "change" ]]; then
+ tc qdisc change dev "$DEV" parent 1:1 handle 2:0 netem delay "$DELAY" "$JITTER" loss random "$LOSS"
+ echo "Dev: $DEV, rate: $RATE, delay: $DELAY, jitter: $JITTER, loss: $LOSS%"
+else
+ echo "set or change"
+fi