From 88f83773d9303fc9e45b20ecbe9881fca11009bf Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Wed, 20 Dec 2017 10:05:04 -0200 Subject: [PATCH] isis-topo1: check ipv6 zebra route installation Signed-off-by: Rafael Zalamena --- tests/topotests/isis-topo1/r1/r1_route6.json | 70 ++++++++ tests/topotests/isis-topo1/r2/r2_route6.json | 70 ++++++++ tests/topotests/isis-topo1/r3/r3_route6.json | 154 ++++++++++++++++++ tests/topotests/isis-topo1/r4/r4_route6.json | 153 +++++++++++++++++ tests/topotests/isis-topo1/r5/r5_route6.json | 122 ++++++++++++++ tests/topotests/isis-topo1/test_isis_topo1.py | 33 ++++ 6 files changed, 602 insertions(+) create mode 100644 tests/topotests/isis-topo1/r1/r1_route6.json create mode 100644 tests/topotests/isis-topo1/r2/r2_route6.json create mode 100644 tests/topotests/isis-topo1/r3/r3_route6.json create mode 100644 tests/topotests/isis-topo1/r4/r4_route6.json create mode 100644 tests/topotests/isis-topo1/r5/r5_route6.json diff --git a/tests/topotests/isis-topo1/r1/r1_route6.json b/tests/topotests/isis-topo1/r1/r1_route6.json new file mode 100644 index 0000000000..1060150a59 --- /dev/null +++ b/tests/topotests/isis-topo1/r1/r1_route6.json @@ -0,0 +1,70 @@ +{ + "2001:db8:1:1::/64": [ + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r1-eth0" + } + ], + "prefix": "2001:db8:1:1::/64", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:2:1::/64": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r1-eth0" + } + ], + "prefix": "2001:db8:2:1::/64", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:f::1/128": [ + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 1, + "interfaceName": "lo" + } + ], + "prefix": "2001:db8:f::1/128", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:f::3/128": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r1-eth0" + } + ], + "prefix": "2001:db8:f::3/128", + "protocol": "isis", + "selected": true + } + ] +} diff --git a/tests/topotests/isis-topo1/r2/r2_route6.json b/tests/topotests/isis-topo1/r2/r2_route6.json new file mode 100644 index 0000000000..49477a7ad3 --- /dev/null +++ b/tests/topotests/isis-topo1/r2/r2_route6.json @@ -0,0 +1,70 @@ +{ + "2001:db8:1:2::/64": [ + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r2-eth0" + } + ], + "prefix": "2001:db8:1:2::/64", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:2:2::/64": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r2-eth0" + } + ], + "prefix": "2001:db8:2:2::/64", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:f::2/128": [ + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 1, + "interfaceName": "lo" + } + ], + "prefix": "2001:db8:f::2/128", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:f::4/128": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r2-eth0" + } + ], + "prefix": "2001:db8:f::4/128", + "protocol": "isis", + "selected": true + } + ] +} diff --git a/tests/topotests/isis-topo1/r3/r3_route6.json b/tests/topotests/isis-topo1/r3/r3_route6.json new file mode 100644 index 0000000000..3b9605bd24 --- /dev/null +++ b/tests/topotests/isis-topo1/r3/r3_route6.json @@ -0,0 +1,154 @@ +{ + "2001:db8:1:1::/64": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "interfaceIndex": 2, + "interfaceName": "r3-eth0" + } + ], + "prefix": "2001:db8:1:1::/64", + "protocol": "isis" + }, + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r3-eth1" + } + ], + "prefix": "2001:db8:1:1::/64", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:1:2::/64": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r3-eth1" + } + ], + "prefix": "2001:db8:1:2::/64", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:2:1::/64": [ + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r3-eth0" + } + ], + "prefix": "2001:db8:2:1::/64", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:2:2::/64": [ + { + "distance": 115, + "metric": 20, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r3-eth1" + } + ], + "prefix": "2001:db8:2:2::/64", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:f::1/128": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r3-eth0" + } + ], + "prefix": "2001:db8:f::1/128", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:f::3/128": [ + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 1, + "interfaceName": "lo" + } + ], + "prefix": "2001:db8:f::3/128", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:f::4/128": [ + { + "distance": 115, + "metric": 20, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r3-eth1" + } + ], + "prefix": "2001:db8:f::4/128", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:f::5/128": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r3-eth1" + } + ], + "prefix": "2001:db8:f::5/128", + "protocol": "isis", + "selected": true + } + ] +} diff --git a/tests/topotests/isis-topo1/r4/r4_route6.json b/tests/topotests/isis-topo1/r4/r4_route6.json new file mode 100644 index 0000000000..8107b50753 --- /dev/null +++ b/tests/topotests/isis-topo1/r4/r4_route6.json @@ -0,0 +1,153 @@ +{ + "2001:db8:1:1::/64": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r4-eth1" + } + ], + "prefix": "2001:db8:1:1::/64", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:1:2::/64": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "interfaceIndex": 3, + "interfaceName": "r4-eth1" + } + ], + "prefix": "2001:db8:1:2::/64", + "protocol": "isis" + }, + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r4-eth0" + } + ], + "prefix": "2001:db8:1:2::/64", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:2:1::/64": [ + { + "distance": 115, + "metric": 20, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r4-eth1" + } + ], + "prefix": "2001:db8:2:1::/64", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:2:2::/64": [ + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r4-eth1" + } + ], + "prefix": "2001:db8:2:2::/64", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:f::2/128": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r4-eth0" + } + ], + "prefix": "2001:db8:f::2/128", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:f::3/128": [ + { + "distance": 115, + "metric": 20, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r4-eth1" + } + ], + "prefix": "2001:db8:f::3/128", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:f::4/128": [ + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 1, + "interfaceName": "lo" + } + ], + "prefix": "2001:db8:f::4/128", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:f::5/128": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r4-eth1" + } + ], + "prefix": "2001:db8:f::5/128", + "protocol": "isis", + "selected": true + } + ]} diff --git a/tests/topotests/isis-topo1/r5/r5_route6.json b/tests/topotests/isis-topo1/r5/r5_route6.json new file mode 100644 index 0000000000..860104f8d0 --- /dev/null +++ b/tests/topotests/isis-topo1/r5/r5_route6.json @@ -0,0 +1,122 @@ +{ + "2001:db8:1:1::/64": [ + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r5-eth0" + } + ], + "prefix": "2001:db8:1:1::/64", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:1:2::/64": [ + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r5-eth1" + } + ], + "prefix": "2001:db8:1:2::/64", + "protocol": "connected", + "selected": true + } + ], + "2001:db8:2:1::/64": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r5-eth0" + } + ], + "prefix": "2001:db8:2:1::/64", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:2:2::/64": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r5-eth1" + } + ], + "prefix": "2001:db8:2:2::/64", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:f::3/128": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 2, + "interfaceName": "r5-eth0" + } + ], + "prefix": "2001:db8:f::3/128", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:f::4/128": [ + { + "distance": 115, + "metric": 10, + "nexthops": [ + { + "active": true, + "afi": "ipv6", + "fib": true, + "interfaceIndex": 3, + "interfaceName": "r5-eth1" + } + ], + "prefix": "2001:db8:f::4/128", + "protocol": "isis", + "selected": true + } + ], + "2001:db8:f::5/128": [ + { + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "fib": true, + "interfaceIndex": 1, + "interfaceName": "lo" + } + ], + "prefix": "2001:db8:f::5/128", + "protocol": "connected", + "selected": true + } + ] +} diff --git a/tests/topotests/isis-topo1/test_isis_topo1.py b/tests/topotests/isis-topo1/test_isis_topo1.py index f3685ab2a6..c855644e39 100644 --- a/tests/topotests/isis-topo1/test_isis_topo1.py +++ b/tests/topotests/isis-topo1/test_isis_topo1.py @@ -204,6 +204,39 @@ def test_isis_linux_route_installation(): assert topotest.json_cmp(actual, expected) is None, assertmsg +def test_isis_route6_installation(): + "Check whether all expected routes are present" + 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 IPv6 routes') + + # Check for routes in 'show ip route json' + for rname, router in tgen.routers().iteritems(): + filename = '{0}/{1}/{1}_route6.json'.format(CWD, rname) + expected = json.loads(open(filename, 'r').read()) + actual = router.vtysh_cmd('show ipv6 route json', isjson=True) + + # Older FRR versions don't list interfaces in some ISIS routes + if router.has_version('<', '3.1'): + for network, routes in expected.iteritems(): + for route in routes: + # Older versions display different metrics for IPv6 routes + route.pop('metric', None) + + if route['protocol'] != 'isis': + continue + + for nexthop in route['nexthops']: + nexthop.pop('interfaceIndex', None) + nexthop.pop('interfaceName', None) + + assertmsg = "Router '{}' 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() -- 2.39.5