From 29614f56c5ef9f25377d65c90f49882a29109c72 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Thu, 14 Dec 2017 16:54:30 -0200 Subject: [PATCH] isis-topo1: add support for stable versions Allow isis-topo1 tests to run on stable versions (2.0.2 and 3.0.2). There are two differences between the stable versions and master: 1. ISIS nexthops don't show interfaceName nor interfaceIndex (on 'show ip route json') 2. New FRR version install ISIS routes in Linux with a different proto type identification. Signed-off-by: Rafael Zalamena --- tests/topotests/isis-topo1/test_isis_topo1.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/topotests/isis-topo1/test_isis_topo1.py b/tests/topotests/isis-topo1/test_isis_topo1.py index 1faff2c01c..d703459d91 100644 --- a/tests/topotests/isis-topo1/test_isis_topo1.py +++ b/tests/topotests/isis-topo1/test_isis_topo1.py @@ -147,6 +147,25 @@ def test_isis_route_installation(): filename = '{0}/{1}/{1}_route.json'.format(CWD, rname) expected = json.loads(open(filename, 'r').read()) actual = router.vtysh_cmd('show ip 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: + if route['protocol'] != 'isis': + continue + + for nexthop in route['nexthops']: + try: + nexthop.pop('interfaceIndex') + except KeyError: + pass + + try: + nexthop.pop('interfaceName') + except KeyError: + pass + assertmsg = "Router '{}' routes mismatch".format(rname) assert topotest.json_cmp(actual, expected) is None, assertmsg @@ -165,6 +184,13 @@ def test_isis_linux_route_installation(): filename = '{0}/{1}/{1}_route_linux.json'.format(CWD, rname) expected = json.loads(open(filename, 'r').read()) actual = topotest.ip4_route(router) + + # Older FRR versions install routes using different proto + if router.has_version('<', '3.1'): + for network, netoptions in expected.iteritems(): + if 'proto' in netoptions and netoptions['proto'] == '187': + netoptions['proto'] = 'zebra' + assertmsg = "Router '{}' OS routes mismatch".format(rname) assert topotest.json_cmp(actual, expected) is None, assertmsg -- 2.39.5