mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-09 16:52:25 +00:00
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>
This commit is contained in:
parent
224737467e
commit
96984a17a5
@ -155,20 +155,20 @@ def teardown_module(mod):
|
|||||||
# This function tears down the whole topology.
|
# This function tears down the whole topology.
|
||||||
tgen.stop_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):
|
def router_compare_json_output(rname, command, reference):
|
||||||
|
"Compare router JSON output"
|
||||||
|
|
||||||
logger.info('Comparing router "%s" "%s" output', rname, command)
|
logger.info('Comparing router "%s" "%s" output', rname, command)
|
||||||
|
|
||||||
# Run test function until we get an result. Wait at most 60 seconds.
|
tgen = get_topogen()
|
||||||
test_func = partial(router_compare_json_output_cb, rname, command, reference)
|
filename = '{}/{}/{}'.format(CWD, rname, reference)
|
||||||
_, diff = topotest.run_and_expect(test_func, None, count=20, wait=3)
|
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)
|
assertmsg = '"{}" JSON output mismatches the expected result'.format(rname)
|
||||||
assert diff is None, assertmsg
|
assert diff is None, assertmsg
|
||||||
|
|
||||||
@ -283,9 +283,6 @@ def test_ldp_pseudowires_after_link_down():
|
|||||||
tgen = get_topogen()
|
tgen = get_topogen()
|
||||||
tgen.gears['r1'].peer_link_enable('r1-eth1', False)
|
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)
|
# check if the pseudowire is still up (using an alternate path for nexthop resolution)
|
||||||
for rname in ['r1', 'r2', 'r3']:
|
for rname in ['r1', 'r2', 'r3']:
|
||||||
router_compare_json_output(rname, "show l2vpn atom vc json", "show_l2vpn_vc.ref")
|
router_compare_json_output(rname, "show l2vpn atom vc json", "show_l2vpn_vc.ref")
|
||||||
|
Loading…
Reference in New Issue
Block a user