From 1f4c4aec44c4559e541f2582684f29d8ed2b1a78 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Thu, 13 Jul 2017 09:54:37 -0300 Subject: [PATCH] bgp-ecmp-topo1: add convergence test Assert that we got the routes from ExaBGP and they are multipath enabled. --- .../bgp-ecmp-topo1/test_bgp_ecmp_topo1.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/topotests/bgp-ecmp-topo1/test_bgp_ecmp_topo1.py b/tests/topotests/bgp-ecmp-topo1/test_bgp_ecmp_topo1.py index d51c8bfd9d..0e8bd7b0ea 100755 --- a/tests/topotests/bgp-ecmp-topo1/test_bgp_ecmp_topo1.py +++ b/tests/topotests/bgp-ecmp-topo1/test_bgp_ecmp_topo1.py @@ -116,6 +116,35 @@ def teardown_module(module): tgen = get_topogen() tgen.stop_topology() +def test_bgp_ecmp(): + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + expect = { + 'routerId': '10.0.255.1', + 'routes': { + }, + } + + for net in range(1, 5): + for subnet in range(0, 10): + netkey = '10.20{}.{}.0/24'.format(net, subnet) + expect['routes'][netkey] = [] + for _ in range(0, 10): + peer = {'multipath': True, 'valid': True} + expect['routes'][netkey].append(peer) + + def _output_cmp(): + output = tgen.gears['r1'].vtysh_cmd('show ip bgp json', isjson=True) + return topotest.json_cmp(output, expect) + + _, res = topotest.run_and_expect(_output_cmp, None, count=20, wait=3) + assertmsg = 'expected multipath routes in "show ip bgp" output' + assert res is None, assertmsg + if __name__ == '__main__': args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) -- 2.39.5