summaryrefslogtreecommitdiffstats
path: root/tests/network-setup.sh
diff options
context:
space:
mode:
authortiptorrent development team <tiptorrent@soleta.eu>2021-09-14 14:39:29 +0200
committertiptorrent development team <tiptorrent@soleta.eu>2021-09-29 15:48:30 +0200
commit6d1828c375390c055c5f11312757b34a7d670eb4 (patch)
treea6e3cf1d49fe4bdec831b72629b5a1b1ebb8c410 /tests/network-setup.sh
parent94c45d5d36ddb236c0d988ff6d8b2e2d9b23c466 (diff)
extend tests
a bit of copy and paste, generalize it later.
Diffstat (limited to 'tests/network-setup.sh')
-rwxr-xr-xtests/network-setup.sh140
1 files changed, 135 insertions, 5 deletions
diff --git a/tests/network-setup.sh b/tests/network-setup.sh
index 3e28c96..4a19ead 100755
--- a/tests/network-setup.sh
+++ b/tests/network-setup.sh
@@ -12,51 +12,167 @@ fi
# \- c4
start () {
+ NUM_CLIENTS=3
+
ip netns add srv
ip netns add br
ip netns add c1
ip netns add c2
ip netns add c3
ip netns add c4
+ ip netns add c5
+ ip netns add c6
+ ip netns add c7
+ ip netns add c8
+ ip netns add c9
+ ip netns add c10
+ ip netns add c11
+ ip netns add c12
+ ip netns add c13
+ ip netns add c14
+ ip netns add c15
+ ip netns add c16
+ ip netns add c17
+ ip netns add c18
ip link add veth0 netns srv type veth peer name veth0 netns br
ip link add veth1 netns br type veth peer name veth0 netns c1
ip link add veth2 netns br type veth peer name veth0 netns c2
ip link add veth3 netns br type veth peer name veth0 netns c3
ip link add veth4 netns br type veth peer name veth0 netns c4
+ ip link add veth5 netns br type veth peer name veth0 netns c5
+ ip link add veth6 netns br type veth peer name veth0 netns c6
+ ip link add veth7 netns br type veth peer name veth0 netns c7
+ ip link add veth8 netns br type veth peer name veth0 netns c8
+ ip link add veth9 netns br type veth peer name veth0 netns c9
+ ip link add veth10 netns br type veth peer name veth0 netns c10
+ ip link add veth11 netns br type veth peer name veth0 netns c11
+ ip link add veth12 netns br type veth peer name veth0 netns c12
+ ip link add veth13 netns br type veth peer name veth0 netns c13
+ ip link add veth14 netns br type veth peer name veth0 netns c14
+ ip link add veth15 netns br type veth peer name veth0 netns c15
+ ip link add veth16 netns br type veth peer name veth0 netns c16
+ ip link add veth17 netns br type veth peer name veth0 netns c17
+ ip link add veth18 netns br type veth peer name veth0 netns c18
ip -net br link set up dev veth0
ip -net br link set up dev veth1
ip -net br link set up dev veth2
ip -net br link set up dev veth3
ip -net br link set up dev veth4
+ ip -net br link set up dev veth5
+ ip -net br link set up dev veth6
+ ip -net br link set up dev veth7
+ ip -net br link set up dev veth8
+ ip -net br link set up dev veth9
+ ip -net br link set up dev veth10
+ ip -net br link set up dev veth11
+ ip -net br link set up dev veth12
+ ip -net br link set up dev veth13
+ ip -net br link set up dev veth14
+ ip -net br link set up dev veth15
+ ip -net br link set up dev veth16
+ ip -net br link set up dev veth17
+ ip -net br link set up dev veth18
+
ip -net br link add name br0 type bridge
ip -net br link set dev veth0 master br0
ip -net br link set dev veth1 master br0
ip -net br link set dev veth2 master br0
ip -net br link set dev veth3 master br0
ip -net br link set dev veth4 master br0
+ ip -net br link set dev veth5 master br0
+ ip -net br link set dev veth6 master br0
+ ip -net br link set dev veth7 master br0
+ ip -net br link set dev veth8 master br0
+ ip -net br link set dev veth9 master br0
+ ip -net br link set dev veth10 master br0
+ ip -net br link set dev veth11 master br0
+ ip -net br link set dev veth12 master br0
+ ip -net br link set dev veth13 master br0
+ ip -net br link set dev veth14 master br0
+ ip -net br link set dev veth15 master br0
+ ip -net br link set dev veth16 master br0
+ ip -net br link set dev veth17 master br0
+ ip -net br link set dev veth18 master br0
+
ip -net br link set up dev br0
ip -net srv addr add 10.141.10.1/24 dev veth0
ip -net srv link set up dev veth0
- ip netns exec srv .././tiptorrent --max-clients 1 --redirect --root . &
+ ip netns exec srv .././tiptorrent --max-clients $NUM_CLIENTS --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 .././tiptorrent --max-clients 1 &
+ 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 .././tiptorrent --max-clients 1 &
+ 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 .././tiptorrent --max-clients 1 &
+ 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 .././tiptorrent --max-clients 1 &
+ 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 .././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 .././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 .././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 .././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 .././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 .././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 .././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 .././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 .././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 .././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 .././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 .././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 .././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 .././tiptorrent --max-clients $NUM_CLIENTS &
}
stop () {
@@ -66,6 +182,20 @@ stop () {
ip netns del c2
ip netns del c3
ip netns del c4
+ ip netns del c5
+ ip netns del c6
+ ip netns del c7
+ ip netns del c8
+ ip netns del c9
+ ip netns del c10
+ ip netns del c11
+ ip netns del c12
+ ip netns del c13
+ ip netns del c14
+ ip netns del c15
+ ip netns del c16
+ ip netns del c17
+ ip netns del c18
killall -15 tiptorrent
}