summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-02-11 18:54:31 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-02-11 18:54:31 +0100
commit556f76e18f0e729a5a5ce7c02f2c7a001fa1de06 (patch)
treec8039d2e1ac6c226b76128439bff721b6ecb9da9 /tests
parentMerge pull request #3770 from donaldsharp/detailed_debugs (diff)
downloadfrr-556f76e18f0e729a5a5ce7c02f2c7a001fa1de06.tar.xz
frr-556f76e18f0e729a5a5ce7c02f2c7a001fa1de06.zip
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/topotests/all-protocol-startup/r1/ipv4_routes.ref12
-rw-r--r--tests/topotests/all-protocol-startup/r1/ipv6_routes.ref22
-rwxr-xr-xtests/topotests/all-protocol-startup/test_all_protocol_startup.py43
3 files changed, 77 insertions, 0 deletions
diff --git a/tests/topotests/all-protocol-startup/r1/ipv4_routes.ref b/tests/topotests/all-protocol-startup/r1/ipv4_routes.ref
new file mode 100644
index 000000000..e75d89672
--- /dev/null
+++ b/tests/topotests/all-protocol-startup/r1/ipv4_routes.ref
@@ -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
diff --git a/tests/topotests/all-protocol-startup/r1/ipv6_routes.ref b/tests/topotests/all-protocol-startup/r1/ipv6_routes.ref
new file mode 100644
index 000000000..88cee964d
--- /dev/null
+++ b/tests/topotests/all-protocol-startup/r1/ipv6_routes.ref
@@ -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
diff --git a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
index fb2100e03..239de55bd 100755
--- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
+++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
@@ -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)