From: Rafael Zalamena Date: Thu, 14 Dec 2017 16:16:10 +0000 (-0200) Subject: isis-topo1: check ISIS kernel route installation X-Git-Tag: frr-7.1-dev~151^2~167 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=2d013cdabc662f3b6ef59c8728cf9a7ff726bd8e;p=mirror%2Ffrr.git isis-topo1: check ISIS kernel route installation Check if the ISIS learned routes are being installed in the underlying OS. Signed-off-by: Rafael Zalamena --- diff --git a/tests/topotests/isis-topo1/r1/r1_route_linux.json b/tests/topotests/isis-topo1/r1/r1_route_linux.json new file mode 100644 index 0000000000..6420dec5d7 --- /dev/null +++ b/tests/topotests/isis-topo1/r1/r1_route_linux.json @@ -0,0 +1,14 @@ +{ + "10.0.10.0/24": { + "dev": "r1-eth0", + "metric": "20", + "proto": "187", + "via": "10.0.20.1" + }, + "10.254.0.3": { + "dev": "r1-eth0", + "metric": "20", + "proto": "187", + "via": "10.0.20.1" + } +} diff --git a/tests/topotests/isis-topo1/r2/r2_route_linux.json b/tests/topotests/isis-topo1/r2/r2_route_linux.json new file mode 100644 index 0000000000..dd3035a1ac --- /dev/null +++ b/tests/topotests/isis-topo1/r2/r2_route_linux.json @@ -0,0 +1,14 @@ +{ + "10.0.11.0/24": { + "dev": "r2-eth0", + "metric": "20", + "proto": "187", + "via": "10.0.21.1" + }, + "10.254.0.4": { + "dev": "r2-eth0", + "metric": "20", + "proto": "187", + "via": "10.0.21.1" + } +} diff --git a/tests/topotests/isis-topo1/r3/r3_route_linux.json b/tests/topotests/isis-topo1/r3/r3_route_linux.json new file mode 100644 index 0000000000..04a2418d00 --- /dev/null +++ b/tests/topotests/isis-topo1/r3/r3_route_linux.json @@ -0,0 +1,32 @@ +{ + "10.0.11.0/24": { + "dev": "r3-eth1", + "metric": "20", + "proto": "187", + "via": "10.0.10.1" + }, + "10.0.21.0/24": { + "dev": "r3-eth1", + "metric": "20", + "proto": "187", + "via": "10.0.10.1" + }, + "10.254.0.1": { + "dev": "r3-eth0", + "metric": "20", + "proto": "187", + "via": "10.0.20.2" + }, + "10.254.0.4": { + "dev": "r3-eth1", + "metric": "20", + "proto": "187", + "via": "10.0.10.1" + }, + "10.254.0.5": { + "dev": "r3-eth1", + "metric": "20", + "proto": "187", + "via": "10.0.10.1" + } +} diff --git a/tests/topotests/isis-topo1/r4/r4_route_linux.json b/tests/topotests/isis-topo1/r4/r4_route_linux.json new file mode 100644 index 0000000000..5d6553f70d --- /dev/null +++ b/tests/topotests/isis-topo1/r4/r4_route_linux.json @@ -0,0 +1,32 @@ +{ + "10.0.10.0/24": { + "dev": "r4-eth1", + "metric": "20", + "proto": "187", + "via": "10.0.11.1" + }, + "10.0.20.0/24": { + "dev": "r4-eth1", + "metric": "20", + "proto": "187", + "via": "10.0.11.1" + }, + "10.254.0.2": { + "dev": "r4-eth0", + "metric": "20", + "proto": "187", + "via": "10.0.21.2" + }, + "10.254.0.3": { + "dev": "r4-eth1", + "metric": "20", + "proto": "187", + "via": "10.0.11.1" + }, + "10.254.0.5": { + "dev": "r4-eth1", + "metric": "20", + "proto": "187", + "via": "10.0.11.1" + } +} diff --git a/tests/topotests/isis-topo1/r5/r5_route_linux.json b/tests/topotests/isis-topo1/r5/r5_route_linux.json new file mode 100644 index 0000000000..b809896468 --- /dev/null +++ b/tests/topotests/isis-topo1/r5/r5_route_linux.json @@ -0,0 +1,26 @@ +{ + "10.0.20.0/24": { + "dev": "r5-eth0", + "metric": "20", + "proto": "187", + "via": "10.0.10.2" + }, + "10.0.21.0/24": { + "dev": "r5-eth1", + "metric": "20", + "proto": "187", + "via": "10.0.11.2" + }, + "10.254.0.3": { + "dev": "r5-eth0", + "metric": "20", + "proto": "187", + "via": "10.0.10.2" + }, + "10.254.0.4": { + "dev": "r5-eth1", + "metric": "20", + "proto": "187", + "via": "10.0.11.2" + } +} diff --git a/tests/topotests/isis-topo1/test_isis_topo1.py b/tests/topotests/isis-topo1/test_isis_topo1.py index 1b03a8b26f..1faff2c01c 100644 --- a/tests/topotests/isis-topo1/test_isis_topo1.py +++ b/tests/topotests/isis-topo1/test_isis_topo1.py @@ -151,6 +151,24 @@ def test_isis_route_installation(): assert topotest.json_cmp(actual, expected) is None, assertmsg +def test_isis_linux_route_installation(): + "Check whether all expected routes are present and installed in the OS" + tgen = get_topogen() + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info('Checking routers for installed ISIS routes in OS') + + # Check for routes in `ip route` + for rname, router in tgen.routers().iteritems(): + filename = '{0}/{1}/{1}_route_linux.json'.format(CWD, rname) + expected = json.loads(open(filename, 'r').read()) + actual = topotest.ip4_route(router) + assertmsg = "Router '{}' OS routes mismatch".format(rname) + assert topotest.json_cmp(actual, expected) is None, assertmsg + + def test_memory_leak(): "Run the memory leak test and report results." tgen = get_topogen()