]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ldp-vpls-topo1: remove duplicated code and sleep
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Sat, 4 Aug 2018 14:48:00 +0000 (11:48 -0300)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Nov 2018 01:22:14 +0000 (20:22 -0500)
Use the new standardized code for router output compare and remove a
code sleep.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py

index e279c8fc68ac23c2a32e30070a95647d3c4829d2..0948c2e41b681de016f127d0360938a47ba97023 100755 (executable)
@@ -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")