organize rita.sh integration test
@@ -91,9 +91,20 @@ source $network_lab << EOF
}
EOF
-ip netns exec netlab-1 sysctl -w net.ipv4.ip_forward=1
-ip netns exec netlab-1 sysctl -w net.ipv6.conf.all.forwarding=1
-ip netns exec netlab-1 ip link set up lo
+prep_netns () {
+ ip netns exec "$1" sysctl -w net.ipv4.ip_forward=1
+ ip netns exec "$1" sysctl -w net.ipv6.conf.all.forwarding=1
+ ip netns exec "$1" ip link set up lo
+}
+
+create_bridge () {
+ ip netns exec "$1" brctl addbr "br-$2"
+ ip netns exec "$1" brctl addif "br-$2" "veth-$2"
+ ip netns exec "$1" ip link set up "br-$2"
+ ip netns exec "$1" ip addr add 2001::2 dev "br-$2"
+}
+
+prep_netns netlab-1
ip netns exec netlab-1 $babeld -I babeld-n1.pid -d 1 -L babeld-n1.log -h 1 -P 5 -w veth-1-2 -G 8080 &
ip netns exec netlab-1 bash -c 'failed=1
while [ $failed -ne 0 ]
@@ -104,24 +115,14 @@ ip netns exec netlab-1 bash -c 'failed=1
done' &
ip netns exec netlab-1 echo $! > ping_retry.pid
-ip netns exec netlab-2 sysctl -w net.ipv4.ip_forward=1
-ip netns exec netlab-2 sysctl -w net.ipv6.conf.all.forwarding=1
-ip netns exec netlab-2 ip link set up lo
-ip netns exec netlab-2 brctl addbr br-2-1
-ip netns exec netlab-2 brctl addif br-2-1 veth-2-1
-ip netns exec netlab-2 brctl addbr br-2-3
-ip netns exec netlab-2 brctl addif br-2-3 veth-2-3
-ip netns exec netlab-2 ip link set up br-2-1
-ip netns exec netlab-2 ip link set up br-2-3
-ip netns exec netlab-2 ip addr add 2001::2 dev br-2-1
-ip netns exec netlab-2 ip addr add 2001::2 dev br-2-3
+prep_netns netlab-2
+create_bridge netlab-2 2-1 2001::2
+create_bridge netlab-2 2-3 2001::2
ip netns exec netlab-2 $babeld -I babeld-n2.pid -d 1 -L babeld-n2.log -h 1 -P 10 -w br-2-1 br-2-3 -G 8080 &
RUST_BACKTRACE=full ip netns exec netlab-2 $rita --pid rita-n2.pid &> rita-n2.log &
ip netns exec netlab-2 brctl show
-ip netns exec netlab-3 sysctl -w net.ipv4.ip_forward=1
-ip netns exec netlab-3 sysctl -w net.ipv6.conf.all.forwarding=1
-ip netns exec netlab-3 ip link set up lo
+prep_netns netlab-3
ip netns exec netlab-3 $babeld -I babeld-n3.pid -d 1 -L babeld-n3.log -h 1 -P 1 -w veth-3-2 -G 8080 &
sleep 20
