diff options
author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2018-08-04 16:48:00 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-11-28 02:22:14 +0100 |
commit | 96984a17a5fa8661a62ec773f94a28d0c720249b (patch) | |
tree | 6f8b8e86664f5f5f82312cef70bc2d3ddb7c5d20 /tests/topotests | |
parent | ospf-topo1-vrf: replace link_enable api with zebra topotest api (diff) | |
download | frr-96984a17a5fa8661a62ec773f94a28d0c720249b.tar.xz frr-96984a17a5fa8661a62ec773f94a28d0c720249b.zip |
ldp-vpls-topo1: remove duplicated code and sleep
Use the new standardized code for router output compare and remove a
code sleep.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'tests/topotests')
-rwxr-xr-x | tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py b/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py index e279c8fc6..0948c2e41 100755 --- a/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py +++ b/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py @@ -155,20 +155,20 @@ def teardown_module(mod): # This function tears down the whole topology. tgen.stop_topology() -def router_compare_json_output_cb(rname, command, reference): - tgen = get_topogen() - router = tgen.gears[rname] - output = router.vtysh_cmd(command, isjson=True) - refTableFile = '{}/{}/{}'.format(CWD, router.name, reference) - expected = json.loads(open(refTableFile).read()) - return topotest.json_cmp(output, expected) def router_compare_json_output(rname, command, reference): + "Compare router JSON output" + logger.info('Comparing router "%s" "%s" output', rname, command) - # Run test function until we get an result. Wait at most 60 seconds. - test_func = partial(router_compare_json_output_cb, rname, command, reference) - _, diff = topotest.run_and_expect(test_func, None, count=20, wait=3) + tgen = get_topogen() + filename = '{}/{}/{}'.format(CWD, rname, reference) + expected = json.loads(open(filename).read()) + + # Run test function until we get an result. Wait at most 80 seconds. + test_func = partial(topotest.router_json_cmp, + tgen.gears[rname], command, expected) + _, diff = topotest.run_and_expect(test_func, None, count=160, wait=0.5) assertmsg = '"{}" JSON output mismatches the expected result'.format(rname) assert diff is None, assertmsg @@ -283,9 +283,6 @@ def test_ldp_pseudowires_after_link_down(): tgen = get_topogen() tgen.gears['r1'].peer_link_enable('r1-eth1', False) - # Wait 15 seconds for the r1-r2 LDP link adjacencies to time out - sleep(15) - # check if the pseudowire is still up (using an alternate path for nexthop resolution) for rname in ['r1', 'r2', 'r3']: router_compare_json_output(rname, "show l2vpn atom vc json", "show_l2vpn_vc.ref") |