summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortiptorrent development team <tiptorrent@soleta.eu>2022-02-10 22:43:07 +0100
committertiptorrent development team <tiptorrent@soleta.eu>2022-02-10 23:19:09 +0100
commitfe463612aeda019bd6b24fd88beeb4b81bd12282 (patch)
tree5e1ab60e2991e4baa7ab7fa8d3fa37ad5140c074
parent95a6724e1dd5e8aae69fee30ecdae42b16c3f600 (diff)
limit server and client bandwidth in tests
-rwxr-xr-xtests/network-setup.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/network-setup.sh b/tests/network-setup.sh
index c8bf18f..27a6bd0 100755
--- a/tests/network-setup.sh
+++ b/tests/network-setup.sh
@@ -14,6 +14,9 @@ fi
start () {
NUM_CLIENTS=3
NUM_REDIRECT=3
+ SERVER_LINK=1000
+ CLIENT_LINK=1000
+ LATENCY=20
ip netns add srv
ip netns add br
@@ -101,78 +104,116 @@ start () {
ip -net srv addr add 10.141.10.1/24 dev veth0
ip -net srv link set up dev veth0
+ ip netns exec srv tc qdisc add dev veth0 handle 10: root tbf rate "$SERVER_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec srv tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec srv .././tiptorrent --max-clients $NUM_CLIENTS --redirect $NUM_REDIRECT --root . &
ip -net c1 addr add 10.141.10.2/24 dev veth0
ip -net c1 link set up dev veth0
+ ip netns exec c1 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c1 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c1 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c2 addr add 10.141.10.3/24 dev veth0
ip -net c2 link set up dev veth0
+ ip netns exec c2 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c2 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c2 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c3 addr add 10.141.10.4/24 dev veth0
ip -net c3 link set up dev veth0
+ ip netns exec c3 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c3 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c3 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c4 addr add 10.141.10.5/24 dev veth0
ip -net c4 link set up dev veth0
+ ip netns exec c4 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c4 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c4 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c5 addr add 10.141.10.6/24 dev veth0
ip -net c5 link set up dev veth0
+ ip netns exec c5 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c5 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c5 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c6 addr add 10.141.10.7/24 dev veth0
ip -net c6 link set up dev veth0
+ ip netns exec c6 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c6 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c6 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c7 addr add 10.141.10.8/24 dev veth0
ip -net c7 link set up dev veth0
+ ip netns exec c7 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c7 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c7 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c8 addr add 10.141.10.9/24 dev veth0
ip -net c8 link set up dev veth0
+ ip netns exec c8 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c8 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c8 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c9 addr add 10.141.10.10/24 dev veth0
ip -net c9 link set up dev veth0
+ ip netns exec c9 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c9 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c9 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c10 addr add 10.141.10.11/24 dev veth0
ip -net c10 link set up dev veth0
+ ip netns exec c10 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c10 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c10 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c11 addr add 10.141.10.12/24 dev veth0
ip -net c11 link set up dev veth0
+ ip netns exec c11 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c11 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c11 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c12 addr add 10.141.10.13/24 dev veth0
ip -net c12 link set up dev veth0
+ ip netns exec c12 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c12 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c12 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c13 addr add 10.141.10.14/24 dev veth0
ip -net c13 link set up dev veth0
+ ip netns exec c13 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c13 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c13 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c14 addr add 10.141.10.15/24 dev veth0
ip -net c14 link set up dev veth0
+ ip netns exec c14 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c14 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c14 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c15 addr add 10.141.10.16/24 dev veth0
ip -net c15 link set up dev veth0
+ ip netns exec c15 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c15 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c15 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c16 addr add 10.141.10.17/24 dev veth0
ip -net c16 link set up dev veth0
+ ip netns exec c16 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c16 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c16 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c17 addr add 10.141.10.18/24 dev veth0
ip -net c17 link set up dev veth0
+ ip netns exec c17 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c17 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c17 .././tiptorrent --max-clients $NUM_CLIENTS &
ip -net c18 addr add 10.141.10.19/24 dev veth0
ip -net c18 link set up dev veth0
+ ip netns exec c18 tc qdisc add dev veth0 handle 10: root tbf rate "$CLIENT_LINK"mbit burst 5kb latency "$LATENCY"ms
+ ip netns exec c18 tc qdisc add dev veth0 parent 10:1 handle 100: sfq
ip netns exec c18 .././tiptorrent --max-clients $NUM_CLIENTS &
}