diff options
Diffstat (limited to 'tests/topotests')
4 files changed, 39 insertions, 28 deletions
diff --git a/tests/topotests/bgp_gr_notification/r1/bgpd.conf b/tests/topotests/bgp_gr_notification/r1/bgpd.conf index 0af042f6be..bca5c33bc3 100644 --- a/tests/topotests/bgp_gr_notification/r1/bgpd.conf +++ b/tests/topotests/bgp_gr_notification/r1/bgpd.conf @@ -3,7 +3,6 @@ router bgp 65001   bgp graceful-restart   neighbor 192.168.255.2 remote-as external   neighbor 192.168.255.2 timers 1 3 - neighbor 192.168.255.2 timers delayopen 10   address-family ipv4    redistribute connected   exit-address-family diff --git a/tests/topotests/bgp_gr_notification/r2/bgpd.conf b/tests/topotests/bgp_gr_notification/r2/bgpd.conf index 8325e21d2c..5e47f9dee3 100644 --- a/tests/topotests/bgp_gr_notification/r2/bgpd.conf +++ b/tests/topotests/bgp_gr_notification/r2/bgpd.conf @@ -4,7 +4,6 @@ router bgp 65002   bgp graceful-restart   neighbor 192.168.255.1 remote-as external   neighbor 192.168.255.1 timers 1 3 - neighbor 192.168.255.1 timers delayopen 10   address-family ipv4    redistribute connected   exit-address-family diff --git a/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py b/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py index 7e39b83d8f..874ad09264 100644 --- a/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py +++ b/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py @@ -165,8 +165,8 @@ def test_bgp_administrative_reset_gr():          }          return topotest.json_cmp(output, expected) -    def _bgp_check_gr_notification_stale(): -        output = json.loads(r1.vtysh_cmd("show bgp ipv4 unicast 172.16.255.2/32 json")) +    def _bgp_check_gr_notification_stale(router, prefix): +        output = json.loads(router.vtysh_cmd(f"show bgp ipv4 unicast {prefix} json"))          expected = {              "paths": [                  { @@ -177,16 +177,6 @@ def test_bgp_administrative_reset_gr():          }          return topotest.json_cmp(output, expected) -    def _bgp_clear_r1_and_shutdown(): -        r2.vtysh_cmd( -            """ -            clear ip bgp 192.168.255.1 -            configure terminal -             router bgp -              neighbor 192.168.255.1 shutdown -            """ -        ) -      def _bgp_verify_show_bgp_router_json():          output = json.loads(r1.vtysh_cmd("show bgp router json"))          expected = { @@ -202,14 +192,37 @@ def test_bgp_administrative_reset_gr():      _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)      assert result is None, "Failed to see BGP convergence on R2" -    step("Reset and shutdown R1") -    _bgp_clear_r1_and_shutdown() +    step("Reset and delay the session establishement for R1") +    r1.vtysh_cmd( +        """ +        configure terminal" +        router bgp +         neighbor 192.168.255.2 timers delayopen 60 +        """ +    ) +    r2.vtysh_cmd( +        """ +        configure terminal" +        router bgp +         neighbor 192.168.255.1 timers delayopen 60 +        """ +    ) +    r2.vtysh_cmd("clear ip bgp 192.168.255.1")      step("Check if stale routes are retained on R1") -    test_func = functools.partial(_bgp_check_gr_notification_stale) +    test_func = functools.partial( +        _bgp_check_gr_notification_stale, r1, "172.16.255.2/32" +    )      _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)      assert result is None, "Failed to see retained stale routes on R1" +    step("Check if stale routes are retained on R2") +    test_func = functools.partial( +        _bgp_check_gr_notification_stale, r2, "172.16.255.1/32" +    ) +    _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) +    assert result is None, "Failed to see retained stale routes on R2" +      step("Check if Hard Reset notification wasn't sent from R2")      test_func = functools.partial(_bgp_check_hard_reset)      _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) diff --git a/tests/topotests/ospf6_gr_topo1/test_ospf6_gr_topo1.py b/tests/topotests/ospf6_gr_topo1/test_ospf6_gr_topo1.py index ba705e3dfc..a5715e6d88 100755 --- a/tests/topotests/ospf6_gr_topo1/test_ospf6_gr_topo1.py +++ b/tests/topotests/ospf6_gr_topo1/test_ospf6_gr_topo1.py @@ -17,14 +17,14 @@ test_ospf6_gr_topo1.py:               | 1.1.1.1 |               +---------+                    |eth-rt2 -                  | +                  |area 1                    |eth-rt1               +---------+               |   RT2   |               | 2.2.2.2 |               +---------+                    |eth-rt3 -                  | +                  |area 0                    |eth-rt2               +---------+               |   RT3   | @@ -33,14 +33,14 @@ test_ospf6_gr_topo1.py:            eth-rt4|  |eth-rt6                   |  |         +---------+  +--------+ -       |                     | +       |area 0               |area 0         |eth-rt3              |eth-rt3    +---------+           +---------+    |   RT4   |           |   RT6   |    | 4.4.4.4 |           | 6.6.6.6 |    +---------+           +---------+         |eth-rt5              |eth-rt7 -       |                     | +       |area 2               |area 3         |eth-rt4              |eth-rt6    +---------+           +---------+    |   RT5   |           |   RT7   | @@ -153,7 +153,7 @@ def router_compare_json_output(rname, command, reference, tries):      expected = json.loads(open(filename).read())      test_func = partial(topotest.router_json_cmp, tgen.gears[rname], command, expected) -    _, diff = topotest.run_and_expect(test_func, None, count=tries, wait=0.5) +    _, diff = topotest.run_and_expect(test_func, None, count=tries, wait=1)      assertmsg = '"{}" JSON output mismatches the expected result'.format(rname)      assert diff is None, assertmsg @@ -206,12 +206,12 @@ def check_routers(initial_convergence=False, exiting=None, restarting=None):          # processing it.  Let's give it a few seconds to allow this to happen          # under load.          if initial_convergence == True: -            tries = 240 +            tries = 120          else:              if restarting != None: -                tries = 40 +                tries = 20              else: -                tries = 10 +                tries = 15          router_compare_json_output(              rname, "show ipv6 route ospf json", "show_ipv6_route.json", tries          ) @@ -219,7 +219,7 @@ def check_routers(initial_convergence=False, exiting=None, restarting=None):          # Check that all adjacencies are up and running (except when there's          # an OSPF instance that is shutting down).          if exiting == None: -            tries = 240 +            tries = 120              router_compare_json_output(                  rname,                  "show ipv6 ospf neighbor json", @@ -231,9 +231,9 @@ def check_routers(initial_convergence=False, exiting=None, restarting=None):          # In the restarting router, wait up to one minute for the LSDB to converge.          if exiting != rname:              if initial_convergence == True or restarting == rname: -                tries = 240 +                tries = 120              else: -                tries = 10 +                tries = 15              router_compare_json_output(                  rname,                  "show ipv6 ospf database json",  | 
