From 72ba5f76a5e3988cf77d46b4ab10104b83f5327c Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 27 Oct 2024 12:54:07 +0100 Subject: [PATCH] test: reduce sleep and logging, not needed anymore With the recent speedup in peering, we can drop most of the extra sleep and debug messages used to track this issue down. However, extend the deadline timeout for the mping receiver to match the one of the sender. This to handle delays on loaded cloud servers. Signed-off-by: Joachim Wiberg --- test/pod.sh | 44 +++++++++++++------------- test/shared.sh | 67 +++++++++++++++++++-------------------- test/single.sh | 3 +- test/three.sh | 86 +++++++++++++++++++++++++++++++++++++------------- test/tunnel.sh | 47 +++++++++++++-------------- 5 files changed, 144 insertions(+), 103 deletions(-) diff --git a/test/pod.sh b/test/pod.sh index ddc7f33..2747c60 100755 --- a/test/pod.sh +++ b/test/pod.sh @@ -370,27 +370,27 @@ dprint "R1 <-> R4" tenacious 30 nsenter --net="$R2" -- ping -qc 1 -W 1 10.0.3.2 >/dev/null dprint "OK" -dprint "DVMRP Status $R1" -nsenter --net="$R1" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail -dprint "DVMRP Status $R2" -nsenter --net="$R2" -- ../src/mroutectl -u "/tmp/$NM/r2.sock" show compat detail -dprint "DVMRP Status $R3" -nsenter --net="$R3" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail -dprint "DVMRP Status $R4" -nsenter --net="$R4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail -echo -echo -print "Sleeping 10 sec to allow mrouted instances to peer ..." -sleep 10 -dprint "DVMRP Status $R1" -nsenter --net="$R1" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail -dprint "DVMRP Status $R2" -nsenter --net="$R2" -- ../src/mroutectl -u "/tmp/$NM/r2.sock" show compat detail -dprint "DVMRP Status $R3" -nsenter --net="$R3" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail -dprint "DVMRP Status $R4" -nsenter --net="$R4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail -dprint "OK" +# dprint "DVMRP Status $R1" +# nsenter --net="$R1" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail +# dprint "DVMRP Status $R2" +# nsenter --net="$R2" -- ../src/mroutectl -u "/tmp/$NM/r2.sock" show compat detail +# dprint "DVMRP Status $R3" +# nsenter --net="$R3" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail +# dprint "DVMRP Status $R4" +# nsenter --net="$R4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail +# echo +# echo +# print "Sleeping 10 sec to allow mrouted instances to peer ..." +# sleep 10 +# dprint "DVMRP Status $R1" +# nsenter --net="$R1" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail +# dprint "DVMRP Status $R2" +# nsenter --net="$R2" -- ../src/mroutectl -u "/tmp/$NM/r2.sock" show compat detail +# dprint "DVMRP Status $R3" +# nsenter --net="$R3" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail +# dprint "DVMRP Status $R4" +# nsenter --net="$R4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail +# dprint "OK" # dprint "OSPF State & Routing Table $R1:" # nsenter --net="$R1" -- echo "show ospf state" | birdc -s "/tmp/$NM/r1-bird.sock" @@ -431,7 +431,7 @@ nsenter --net="$ED2" -- ./mping -qr -i eth0 -t 5 -W 30 225.1.2.3 & echo $! >> "/tmp/$NM/PIDs" sleep 1 -if ! nsenter --net="$ED1" -- ./mping -s -i eth0 -t 5 -c 10 -w 15 225.1.2.3; then +if ! nsenter --net="$ED1" -- ./mping -s -i eth0 -t 5 -c 10 -w 30 225.1.2.3; then dprint "PIM Status $R1" nsenter --net="$R1" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail dprint "PIM Status $R2" diff --git a/test/shared.sh b/test/shared.sh index a76e143..ce83a93 100755 --- a/test/shared.sh +++ b/test/shared.sh @@ -278,48 +278,47 @@ nsenter --net="$R1" -- bird -c "/tmp/$NM/bird.conf" -d -s "/tmp/$NM/r1-bird.sock echo $! >> "/tmp/$NM/PIDs" nsenter --net="$R2" -- bird -c "/tmp/$NM/bird.conf" -d -s "/tmp/$NM/r2-bird.sock" & echo $! >> "/tmp/$NM/PIDs" -sleep 1 +# sleep 1 print "Starting mrouted ..." nsenter --net="$R1" -- ../src/mrouted -i R1 -n -p "/tmp/$NM/r1.pid" -l debug -u "/tmp/$NM/r1.sock" & echo $! >> "/tmp/$NM/PIDs" nsenter --net="$R2" -- ../src/mrouted -i R2 -n -p "/tmp/$NM/r2.pid" -l debug -u "/tmp/$NM/r2.sock" & echo $! >> "/tmp/$NM/PIDs" -sleep 1 - -print "Router link states" -dprint "$ED1" -nsenter --net="$ED1" -- ip -br l -nsenter --net="$ED1" -- ip -br a -nsenter --net="$ED1" -- bridge link -dprint "$R1" -nsenter --net="$R1" -- ip -br l -nsenter --net="$R1" -- ip -br a -dprint "$R2" -nsenter --net="$R2" -- ip -br l -nsenter --net="$R2" -- ip -br a -dprint "$ED2" -nsenter --net="$ED2" -- ip -br l -nsenter --net="$ED2" -- ip -br a -nsenter --net="$ED2" -- bridge link - -print "Routing tables on end-devices" -dprint "$ED1" -nsenter --net="$ED1" -- ip -br r -nsenter --net="$ED1" -- bridge fdb show -nsenter --net="$ED1" -- ping -c 10 -W 1 10.0.0.1 -nsenter --net="$ED1" -- ip neigh -dprint "$ED2" -nsenter --net="$ED2" -- ip -br r -nsenter --net="$ED2" -- bridge fdb show -nsenter --net="$ED2" -- ping -c 10 -W 1 10.0.1.1 -nsenter --net="$ED2" -- ip neigh +# sleep 1 + +# print "Router link states" +# dprint "$ED1" +# nsenter --net="$ED1" -- ip -br l +# nsenter --net="$ED1" -- ip -br a +# nsenter --net="$ED1" -- bridge link +# dprint "$R1" +# nsenter --net="$R1" -- ip -br l +# nsenter --net="$R1" -- ip -br a +# dprint "$R2" +# nsenter --net="$R2" -- ip -br l +# nsenter --net="$R2" -- ip -br a +# dprint "$ED2" +# nsenter --net="$ED2" -- ip -br l +# nsenter --net="$ED2" -- ip -br a +# nsenter --net="$ED2" -- bridge link + +# print "Routing tables on end-devices" +# dprint "$ED1" +# nsenter --net="$ED1" -- ip -br r +# nsenter --net="$ED1" -- bridge fdb show +# nsenter --net="$ED1" -- ping -c 10 -W 1 10.0.0.1 +# nsenter --net="$ED1" -- ip neigh +# dprint "$ED2" +# nsenter --net="$ED2" -- ip -br r +# nsenter --net="$ED2" -- bridge fdb show +# nsenter --net="$ED2" -- ping -c 10 -W 1 10.0.1.1 +# nsenter --net="$ED2" -- ip neigh # Wait for routers to peer print "Waiting for OSPF routers to peer (30 sec) ..." -sleep 10 - -dprint "R1 <-> R2" +# sleep 10 +# dprint "R1 <-> R2" tenacious 30 nsenter --net="$R1" -- ping -qc 1 -W 1 10.0.1.2 >/dev/null dprint "OK" @@ -332,7 +331,7 @@ nsenter --net="$ED2" -- ./mping -qr -i eth0 -t 5 -W 30 225.1.2.3 & echo $! >> "/tmp/$NM/PIDs" sleep 1 -if ! nsenter --net="$ED1" -- ./mping -s -i eth0 -t 5 -c 10 -w 15 225.1.2.3; then +if ! nsenter --net="$ED1" -- ./mping -s -i eth0 -t 5 -c 10 -w 30 225.1.2.3; then dprint "DVMRP Status $R1" nsenter --net="$R1" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail dprint "DVMRP Status $R2" diff --git a/test/single.sh b/test/single.sh index 576fa48..53b1958 100755 --- a/test/single.sh +++ b/test/single.sh @@ -73,14 +73,13 @@ sleep 1 print "Starting mrouted ..." ../src/mrouted -i solo -f "/tmp/$NM/conf" -n -p "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & -sleep 1 print "Starting emitter ..." nsenter --net="$right" -- ./mping -qr -i eth0 -t 3 -W 30 225.1.2.3 & echo $! >> "/tmp/$NM/PIDs" sleep 1 -if ! nsenter --net="$left" -- ./mping -s -i eth0 -t 3 -c 10 -w 15 225.1.2.3; then +if ! nsenter --net="$left" -- ./mping -s -i eth0 -t 3 -c 10 -w 30 225.1.2.3; then show_mroute ../src/mroutectl -u "/tmp/$NM/sock" echo "Failed routing, expected at least 10 multicast ping replies" diff --git a/test/three.sh b/test/three.sh index f3a3436..9ab1af5 100755 --- a/test/three.sh +++ b/test/three.sh @@ -121,6 +121,62 @@ creater() nsenter --net="$1" -- ip addr add "$5" broadcast + dev "$a" } +dvmrp_routes() +{ + dprint "R1 DVMRP Routes" + nsenter --net="$NS2" -- ../src/mroutectl -pt -u "/tmp/$NM/r1.sock" -d show routes + dprint "R2 DVMRP Routes" + nsenter --net="$NS3" -- ../src/mroutectl -pt -u "/tmp/$NM/r2.sock" -d show routes + dprint "R3 DVMRP Routes" + nsenter --net="$NS4" -- ../src/mroutectl -pt -u "/tmp/$NM/r3.sock" -d show routes +} + +dvmrp_status() +{ + dprint "DVMRP Status $NS2" + nsenter --net="$NS2" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail + dprint "DVMRP Status $NS3" + nsenter --net="$NS3" -- ../src/mroutectl -u "/tmp/$NM/r2.sock" show compat detail + dprint "DVMRP Status $NS4" + nsenter --net="$NS4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail +} + +dvmrp_neigh() +{ + dprint "R1 DVMRP Neighbors" + nsenter --net="$NS2" -- ../src/mroutectl -pt -u "/tmp/$NM/r1.sock" -d show neighbor + dprint "R2 DVMRP Neighbors" + nsenter --net="$NS3" -- ../src/mroutectl -pt -u "/tmp/$NM/r2.sock" -d show neighbor + dprint "R3 DVMRP Neighbors" + nsenter --net="$NS4" -- ../src/mroutectl -pt -u "/tmp/$NM/r3.sock" -d show neighbor +} + +has_neigh() +{ + nm=$(basename "$2" .sock) + neighbors=$(nsenter --net="$1" -- \ + ../src/mroutectl -pt -u "$2" -d show neighbor \ + | awk 'NF && $4 == "G" { print $1 }') + shift 2 + + while [ $# -gt 0 ]; do + if ! echo "$neighbors" | grep -wq "$1"; then + echo "$nm: missing neighbor $1" + return 1 + fi + shift + done + + return 0 +} + +dvmrp_peer() +{ + has_neigh "$NS2" "/tmp/$NM/r1.sock" 10.0.1.2 || return 1 + has_neigh "$NS3" "/tmp/$NM/r2.sock" 10.0.1.1 10.0.2.2 || return 1 + has_neigh "$NS4" "/tmp/$NM/r3.sock" 10.0.2.1 || return 1 +} + dprint "Creating $NS2 router ..." nsenter --net="$NS2" -- sleep 5 & pid2=$! @@ -192,37 +248,23 @@ nsenter --net="$NS3" -- bird -c "/tmp/$NM/bird.conf" -d -s "/tmp/$NM/r2-bird.soc echo $! >> "/tmp/$NM/PIDs" nsenter --net="$NS4" -- bird -c "/tmp/$NM/bird.conf" -d -s "/tmp/$NM/r3-bird.sock" & echo $! >> "/tmp/$NM/PIDs" -sleep 1 print "Starting mrouted ..." -nsenter --net="$NS2" -- ../src/mrouted -i NS2 -n -p "/tmp/$NM/r1.pid" -l debug -d all -u "/tmp/$NM/r1.sock" & +LVL=info +nsenter --net="$NS2" -- ../src/mrouted -i NS2 -n -p "/tmp/$NM/r1.pid" -l $LVL -d all -u "/tmp/$NM/r1.sock" & echo $! >> "/tmp/$NM/PIDs" -nsenter --net="$NS3" -- ../src/mrouted -i NS3 -n -p "/tmp/$NM/r2.pid" -l debug -d all -u "/tmp/$NM/r2.sock" & +nsenter --net="$NS3" -- ../src/mrouted -i NS3 -n -p "/tmp/$NM/r2.pid" -l $LVL -d all -u "/tmp/$NM/r2.sock" & echo $! >> "/tmp/$NM/PIDs" -nsenter --net="$NS4" -- ../src/mrouted -i NS4 -n -p "/tmp/$NM/r3.pid" -l debug -d all -u "/tmp/$NM/r3.sock" & +nsenter --net="$NS4" -- ../src/mrouted -i NS4 -n -p "/tmp/$NM/r3.pid" -l $LVL -d all -u "/tmp/$NM/r3.sock" & echo $! >> "/tmp/$NM/PIDs" -sleep 1 # Wait for routers to peer print "Waiting for OSPF routers to peer (30 sec) ..." tenacious 30 nsenter --net="$NS1" -- ping -qc 1 -W 1 10.0.3.10 >/dev/null +dprint "OK" -dprint "DVMRP Status $NS2" -nsenter --net="$NS2" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail -dprint "DVMRP Status $NS3" -nsenter --net="$NS3" -- ../src/mroutectl -u "/tmp/$NM/r2.sock" show compat detail -dprint "DVMRP Status $NS4" -nsenter --net="$NS4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail -echo -echo -print "Sleeping 10 sec to allow mrouted instances to peer ..." -sleep 10 -dprint "DVMRP Status $NS2" -nsenter --net="$NS2" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail -dprint "DVMRP Status $NS3" -nsenter --net="$NS3" -- ../src/mroutectl -u "/tmp/$NM/r2.sock" show compat detail -dprint "DVMRP Status $NS4" -nsenter --net="$NS4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail +print "Waiting for DVMRP routers to peer (30 sec) ..." +tenacious 30 dvmrp_peer dprint "OK" # dprint "OSPF State & Routing Table $NS2:" @@ -248,7 +290,7 @@ nsenter --net="$NS5" -- ./mping -qr -i eth0 -t 5 -W 30 225.1.2.3 & echo $! >> "/tmp/$NM/PIDs" sleep 1 -if ! nsenter --net="$NS1" -- ./mping -s -i eth0 -t 5 -c 10 -w 15 225.1.2.3; then +if ! nsenter --net="$NS1" -- ./mping -s -i eth0 -t 5 -c 10 -w 30 225.1.2.3; then dprint "DVMRP Status $NS2" nsenter --net="$NS2" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail dprint "DVMRP Status $NS3" diff --git a/test/tunnel.sh b/test/tunnel.sh index b98b581..8b41c32 100755 --- a/test/tunnel.sh +++ b/test/tunnel.sh @@ -193,7 +193,7 @@ nsenter --net="$NS3" -- bird -c "/tmp/$NM/bird.conf" -d -s "/tmp/$NM/r2-bird.soc echo $! >> "/tmp/$NM/PIDs" nsenter --net="$NS4" -- bird -c "/tmp/$NM/bird.conf" -d -s "/tmp/$NM/r3-bird.sock" & echo $! >> "/tmp/$NM/PIDs" -sleep 1 +# sleep 1 print "Disabling rp_filter on routers ..." nsenter --net="$NS2" -- sysctl -w net.ipv4.conf.all.rp_filter=0 @@ -223,31 +223,32 @@ nsenter --net="$NS2" -- ../src/mrouted -i NS2 -n -p "/tmp/$NM/r1.pid" -f "/tmp/$ echo $! >> "/tmp/$NM/PIDs" nsenter --net="$NS4" -- ../src/mrouted -i NS4 -n -p "/tmp/$NM/r3.pid" -f "/tmp/$NM/r3.conf" -l debug -d all -u "/tmp/$NM/r3.sock" & echo $! >> "/tmp/$NM/PIDs" -sleep 1 +# sleep 1 # Wait for routers to peer print "Waiting for OSPF routers to peer (30 sec) ..." tenacious 30 nsenter --net="$NS1" -- ping -qc 1 -W 1 10.0.3.10 >/dev/null +dprint "OK" #dprint "DVMRP Status $NS2" #nsenter --net="$NS2" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail #dprint "DVMRP Status $NS4" #nsenter --net="$NS4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail -echo -echo -print "Sleeping 10 sec to allow mrouted instances to peer ..." -sleep 10 -dprint "DVMRP Status $NS2" -nsenter --net="$NS2" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail -nsenter --net="$NS2" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show routes -dprint "DVMRP Status $NS4" -nsenter --net="$NS4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail -nsenter --net="$NS4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show routes -dprint "OK" - -print "Checking VIFs ..." -nsenter --net="$NS2" -- cat /proc/net/ip_mr_vif -nsenter --net="$NS4" -- cat /proc/net/ip_mr_vif +# echo +# echo +# print "Sleeping 10 sec to allow mrouted instances to peer ..." +# sleep 10 +# dprint "DVMRP Status $NS2" +# nsenter --net="$NS2" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show compat detail +# nsenter --net="$NS2" -- ../src/mroutectl -u "/tmp/$NM/r1.sock" show routes +# dprint "DVMRP Status $NS4" +# nsenter --net="$NS4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show compat detail +# nsenter --net="$NS4" -- ../src/mroutectl -u "/tmp/$NM/r3.sock" show routes +# dprint "OK" + +# print "Checking VIFs ..." +# nsenter --net="$NS2" -- cat /proc/net/ip_mr_vif +# nsenter --net="$NS4" -- cat /proc/net/ip_mr_vif # dprint "OSPF State & Routing Table $NS2:" @@ -262,11 +263,11 @@ nsenter --net="$NS4" -- cat /proc/net/ip_mr_vif # nsenter --net="$NS3" -- echo "show ospf neigh" | birdc -s "/tmp/$NM/r2-bird.sock" # nsenter --net="$NS3" -- ip route -dprint "OSPF State & Routing Table $NS4:" -nsenter --net="$NS4" -- echo "show ospf state" | birdc -s "/tmp/$NM/r3-bird.sock" -nsenter --net="$NS4" -- echo "show ospf int" | birdc -s "/tmp/$NM/r3-bird.sock" -nsenter --net="$NS4" -- echo "show ospf neigh" | birdc -s "/tmp/$NM/r3-bird.sock" -nsenter --net="$NS4" -- ip route +# dprint "OSPF State & Routing Table $NS4:" +# nsenter --net="$NS4" -- echo "show ospf state" | birdc -s "/tmp/$NM/r3-bird.sock" +# nsenter --net="$NS4" -- echo "show ospf int" | birdc -s "/tmp/$NM/r3-bird.sock" +# nsenter --net="$NS4" -- echo "show ospf neigh" | birdc -s "/tmp/$NM/r3-bird.sock" +# nsenter --net="$NS4" -- ip route # For debugging nsenter --net="$NS2" -- tshark -lni eth2 -w "/tmp/$NM/r1.pcap" 2>/dev/null & @@ -283,7 +284,7 @@ nsenter --net="$NS5" -- ./mping -qr -i eth0 -t 5 -W 30 225.1.2.3 & echo $! >> "/tmp/$NM/PIDs" sleep 1 -if ! nsenter --net="$NS1" -- ./mping -s -i eth0 -t 5 -c 10 -w 15 225.1.2.3; then +if ! nsenter --net="$NS1" -- ./mping -s -i eth0 -t 5 -c 10 -w 30 225.1.2.3; then dprint "DVMRP Status $NS2" nsenter --net="$NS2" -- cat /proc/net/ip_mr_vif nsenter --net="$NS2" -- cat /proc/net/ip_mr_cache