Skip to content

Commit

Permalink
test: reduce sleep and logging, not needed anymore
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
troglobit committed Oct 27, 2024
1 parent b0a1cab commit 72ba5f7
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 103 deletions.
44 changes: 22 additions & 22 deletions test/pod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
67 changes: 33 additions & 34 deletions test/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions test/single.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
86 changes: 64 additions & 22 deletions test/three.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=$!
Expand Down Expand Up @@ -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:"
Expand All @@ -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"
Expand Down
47 changes: 24 additions & 23 deletions test/tunnel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:"
Expand All @@ -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 &
Expand All @@ -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
Expand Down

0 comments on commit 72ba5f7

Please sign in to comment.