From 940ac2a6fd53af0d62ebc2ccebc0185fe008ca86 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 29 Jul 2023 13:26:26 -0400 Subject: [PATCH] tests: bfd_bgp_cbit_topo3 allow bgp to converge before testing This test was failing upstream a bunch of times. Upon examining the log files as well as the test script it was noticed that the bfd peers were checked to see that they had come up. But both the timers used for bgp as well as not checking that bgp has actually come up would cause the test to fail in subsuquent steps if bgp has not come up. Test that bgp peering is actually established before testing link down events. It's possible this test might need to be revisited to ensure that the routes are actually installed and ready to go before as well, but I am not seeing that right now. Signed-off-by: Donald Sharp --- tests/topotests/bfd_bgp_cbit_topo3/r1/bgpd.conf | 2 +- tests/topotests/bfd_bgp_cbit_topo3/r3/bgpd.conf | 2 +- .../bfd_bgp_cbit_topo3/test_bfd_bgp_cbit_topo3.py | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/topotests/bfd_bgp_cbit_topo3/r1/bgpd.conf b/tests/topotests/bfd_bgp_cbit_topo3/r1/bgpd.conf index d30c32043e..f8ad1f3a66 100644 --- a/tests/topotests/bfd_bgp_cbit_topo3/r1/bgpd.conf +++ b/tests/topotests/bfd_bgp_cbit_topo3/r1/bgpd.conf @@ -3,7 +3,7 @@ router bgp 101 bgp router-id 10.254.254.1 no bgp ebgp-requires-policy no bgp network import-check - timers bgp 8 24 + timers bgp 3 10 bgp graceful-restart neighbor 2001:db8:4::1 remote-as 102 neighbor 2001:db8:4::1 timers 3 10 diff --git a/tests/topotests/bfd_bgp_cbit_topo3/r3/bgpd.conf b/tests/topotests/bfd_bgp_cbit_topo3/r3/bgpd.conf index 22f0650d0d..42953a075c 100644 --- a/tests/topotests/bfd_bgp_cbit_topo3/r3/bgpd.conf +++ b/tests/topotests/bfd_bgp_cbit_topo3/r3/bgpd.conf @@ -3,7 +3,7 @@ router bgp 102 bgp router-id 10.254.254.3 no bgp ebgp-requires-policy no bgp network import-check - timers bgp 20 60 + timers bgp 3 10 bgp graceful-restart ! simulate NSF machine bgp graceful-restart preserve-fw-state diff --git a/tests/topotests/bfd_bgp_cbit_topo3/test_bfd_bgp_cbit_topo3.py b/tests/topotests/bfd_bgp_cbit_topo3/test_bfd_bgp_cbit_topo3.py index 475c4b1aa1..906687d1cd 100644 --- a/tests/topotests/bfd_bgp_cbit_topo3/test_bfd_bgp_cbit_topo3.py +++ b/tests/topotests/bfd_bgp_cbit_topo3/test_bfd_bgp_cbit_topo3.py @@ -129,6 +129,14 @@ def test_bfd_loss_intermediate(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) + r1 = tgen.gears["r1"] + expected = { "as":101, "peers":{ "2001:db8:4::1": { "state":"Established" } } } + test_func = partial(topotest.router_json_cmp, r1, "show bgp ipv6 uni summ json", expected) + _, result = topotest.run_and_expect(test_func, None, count=60, wait=1) + assertmsg ='"r1" has not established bgp peering yet' + assert result is None, assertmsg + + #assert False logger.info("removing IPv6 address from r2 to simulate loss of connectivity") # Disable r2-eth0 ipv6 address cmd = 'vtysh -c "configure terminal" -c "interface r2-eth1" -c "no ipv6 address 2001:db8:4::2/64"' -- 2.39.5