mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 08:49:58 +00:00
topotests: Add code to ensure routes are as expected
This code just ensures that v4 and v6 routes are as expected in the rib. While this test addition is not that complicated it would have caught some issues while I was attempting to handle the switchover to a different style of rib processing. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
fb85ce1b81
commit
556f76e18f
12
tests/topotests/all-protocol-startup/r1/ipv4_routes.ref
Normal file
12
tests/topotests/all-protocol-startup/r1/ipv4_routes.ref
Normal file
@ -0,0 +1,12 @@
|
||||
C>* 192.168.0.0/24 is directly connected, r1-eth0, XX:XX:XX
|
||||
C>* 192.168.1.0/26 is directly connected, r1-eth1, XX:XX:XX
|
||||
C>* 192.168.2.0/26 is directly connected, r1-eth2, XX:XX:XX
|
||||
C>* 192.168.3.0/26 is directly connected, r1-eth3, XX:XX:XX
|
||||
C>* 192.168.4.0/26 is directly connected, r1-eth4, XX:XX:XX
|
||||
C>* 192.168.5.0/26 is directly connected, r1-eth5, XX:XX:XX
|
||||
C>* 192.168.6.0/26 is directly connected, r1-eth6, XX:XX:XX
|
||||
C>* 192.168.7.0/26 is directly connected, r1-eth7, XX:XX:XX
|
||||
C>* 192.168.8.0/26 is directly connected, r1-eth8, XX:XX:XX
|
||||
C>* 192.168.9.0/26 is directly connected, r1-eth9, XX:XX:XX
|
||||
O 192.168.0.0/24 [110/10] is directly connected, r1-eth0, XX:XX:XX
|
||||
O 192.168.3.0/26 [110/10] is directly connected, r1-eth3, XX:XX:XX
|
22
tests/topotests/all-protocol-startup/r1/ipv6_routes.ref
Normal file
22
tests/topotests/all-protocol-startup/r1/ipv6_routes.ref
Normal file
@ -0,0 +1,22 @@
|
||||
C>* fc00:0:0:1::/64 is directly connected, r1-eth1, XX:XX:XX
|
||||
C>* fc00:0:0:2::/64 is directly connected, r1-eth2, XX:XX:XX
|
||||
C>* fc00:0:0:3::/64 is directly connected, r1-eth3, XX:XX:XX
|
||||
C>* fc00:0:0:4::/64 is directly connected, r1-eth4, XX:XX:XX
|
||||
C>* fc00:0:0:5::/64 is directly connected, r1-eth5, XX:XX:XX
|
||||
C>* fc00:0:0:6::/64 is directly connected, r1-eth6, XX:XX:XX
|
||||
C>* fc00:0:0:7::/64 is directly connected, r1-eth7, XX:XX:XX
|
||||
C>* fc00:0:0:8::/64 is directly connected, r1-eth8, XX:XX:XX
|
||||
C>* fc00:0:0:9::/64 is directly connected, r1-eth9, XX:XX:XX
|
||||
C>* fc00::/64 is directly connected, r1-eth0, XX:XX:XX
|
||||
C>* fe80::/64 is directly connected, lo, XX:XX:XX
|
||||
C * fe80::/64 is directly connected, r1-eth0, XX:XX:XX
|
||||
C * fe80::/64 is directly connected, r1-eth1, XX:XX:XX
|
||||
C * fe80::/64 is directly connected, r1-eth2, XX:XX:XX
|
||||
C * fe80::/64 is directly connected, r1-eth3, XX:XX:XX
|
||||
C * fe80::/64 is directly connected, r1-eth4, XX:XX:XX
|
||||
C * fe80::/64 is directly connected, r1-eth5, XX:XX:XX
|
||||
C * fe80::/64 is directly connected, r1-eth6, XX:XX:XX
|
||||
C * fe80::/64 is directly connected, r1-eth7, XX:XX:XX
|
||||
C * fe80::/64 is directly connected, r1-eth8, XX:XX:XX
|
||||
C * fe80::/64 is directly connected, r1-eth9, XX:XX:XX
|
||||
O fc00:0:0:4::/64 [110/10] is directly connected, r1-eth4, XX:XX:XX
|
@ -296,10 +296,53 @@ def test_converge_protocols():
|
||||
sleep(60)
|
||||
|
||||
# Make sure that all daemons are running
|
||||
failures = 0
|
||||
for i in range(1, 2):
|
||||
fatal_error = net['r%s' % i].checkRouterRunning()
|
||||
assert fatal_error == "", fatal_error
|
||||
|
||||
print("Show that v4 routes are right\n");
|
||||
v4_routesFile = '%s/r%s/ipv4_routes.ref' % (thisDir, i)
|
||||
expected = open(v4_routesFile).read().rstrip()
|
||||
expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1)
|
||||
|
||||
actual = net['r%s' %i].cmd('vtysh -c "show ip route" | /usr/bin/tail -n +7 | sort 2> /dev/null').rstrip()
|
||||
# Drop time in last update
|
||||
actual = re.sub(r" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", " XX:XX:XX", actual)
|
||||
actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1)
|
||||
diff = topotest.get_textdiff(actual, expected,
|
||||
title1="Actual IP Routing Table",
|
||||
title2="Expected IP RoutingTable")
|
||||
if diff:
|
||||
sys.stderr.write('r%s failed IP Routing table check:\n%s\n' % (i, diff))
|
||||
failures += 1
|
||||
else:
|
||||
print("r%s ok" %i)
|
||||
|
||||
assert failures == 0, "IP Routing table failed for r%s\n%s" % (i, diff)
|
||||
|
||||
failures = 0
|
||||
|
||||
print("Show that v6 routes are right\n")
|
||||
v6_routesFile = '%s/r%s/ipv6_routes.ref' % (thisDir, i)
|
||||
expected = open(v6_routesFile).read().rstrip()
|
||||
expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1)
|
||||
|
||||
actual = net['r%s' %i].cmd('vtysh -c "show ipv6 route" | /usr/bin/tail -n +7 | sort 2> /dev/null').rstrip()
|
||||
# Drop time in last update
|
||||
actual = re.sub(r" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", " XX:XX:XX", actual)
|
||||
actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1)
|
||||
diff = topotest.get_textdiff(actual, expected,
|
||||
title1="Actual IPv6 Routing Table",
|
||||
title2="Expected IPv6 RoutingTable")
|
||||
if diff:
|
||||
sys.stderr.write('r%s failed IPv6 Routing table check:\n%s\n' % (i, diff))
|
||||
failures += 1
|
||||
else:
|
||||
print("r%s ok" %i)
|
||||
|
||||
assert failures == 0, "IPv6 Routing table failed for r%s\n%s" % (i, diff)
|
||||
|
||||
# For debugging after starting FRR/Quagga daemons, uncomment the next line
|
||||
## CLI(net)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user