From 6214e11a6a7b3c4d2a4706aa91cc0749bb01f626 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 20 Mar 2020 23:53:39 +0100 Subject: [PATCH] tests: fix check for nhid in ipv6 table output Check based on actual output instead of assuming output based on kernel version Signed-off-by: Martin Winter --- tests/topotests/ospf6-topo1/test_ospf6_topo1.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/topotests/ospf6-topo1/test_ospf6_topo1.py b/tests/topotests/ospf6-topo1/test_ospf6_topo1.py index cb0c4af221..2f7a4ce4e3 100755 --- a/tests/topotests/ospf6-topo1/test_ospf6_topo1.py +++ b/tests/topotests/ospf6-topo1/test_ospf6_topo1.py @@ -319,18 +319,18 @@ def test_linux_ipv6_kernel_routingTable(): # Now compare the routing tables (after substituting link-local addresses) for i in range(1, 5): - if topotest.version_cmp(platform.release(), '5.3') < 0: + # Actual output from router + actual = tgen.gears['r{}'.format(i)].run('ip -6 route').rstrip() + if "nhid" in actual: + refTableFile = os.path.join(CWD, 'r{}/ip_6_address.nhg.ref'.format(i)) + else: refTableFile = os.path.join(CWD, 'r{}/ip_6_address.ref'.format(i)) - else: - refTableFile = os.path.join(CWD, 'r{}/ip_6_address.nhg.ref'.format(i)) - if os.path.isfile(refTableFile): + if os.path.isfile(refTableFile): expected = open(refTableFile).read().rstrip() # Fix newlines (make them all the same) expected = ('\n'.join(expected.splitlines())).splitlines(1) - # Actual output from router - actual = tgen.gears['r{}'.format(i)].run('ip -6 route').rstrip() # Mask out Link-Local mac addresses for ll in linklocals: actual = actual.replace(ll[1], "fe80::__(%s)__" % ll[0]) -- 2.39.5