From 4f032a44a43345f42ccb5557a7b48805c99ad17e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 7 Sep 2023 07:57:26 -0400 Subject: [PATCH 1/2] tests: Fix ospfapi client to clear ospf process Test is failing locally: 2023-09-06 18:39:56,865 DEBUG: r1: vtysh result: Hello, this is FRRouting (version 9.1-dev). Copyright 1996-2005 Kunihiro Ishiguro, et al. r1# conf t r1(config)# router ospf r1(config-router)# ospf router-id 1.1.1.1 For this router-id change to take effect, use "clear ip ospf process" command r1(config-router)# 2023-09-06 18:39:56,865 DEBUG: root: GOT LINE: 'SUCCESS: 1.0.0.0' 2023-09-06 18:39:56,866 DEBUG: root: GOT LINE: '2023-09-06 18:39:55,982 INFO: TESTER: root: Waiting for 1.1.1.1' 2023-09-06 18:39:56,867 DEBUG: root: GOT LINE: '2023-09-06 18:39:55,982 DEBUG: TESTER: root: expected '1.1.1.1' != '1.0.0.0'' 2023-09-06 18:39:56,867 DEBUG: root: GOT LINE: 'waiting on notify' Sure looks like the router-id is not allowed to be changed because neighbors have already been formed. If we are changing the router-id then let's clear the process to allow it to correctly change. Signed-off-by: Donald Sharp --- tests/topotests/ospfapi/test_ospf_clientapi.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/topotests/ospfapi/test_ospf_clientapi.py b/tests/topotests/ospfapi/test_ospf_clientapi.py index 89a34ff9b58d..9e00fcf11fc1 100644 --- a/tests/topotests/ospfapi/test_ospf_clientapi.py +++ b/tests/topotests/ospfapi/test_ospf_clientapi.py @@ -218,10 +218,12 @@ def _test_router_id(tgen, testbin): step("router id: check for modified router id") r1.vtysh_multicmd("conf t\nrouter ospf\nospf router-id 1.1.1.1") + r1.vtysh_multicmd("clear ip ospf process") _wait_output(p, "SUCCESS: {}".format(waitlist[1])) step("router id: check for restored router id") r1.vtysh_multicmd("conf t\nrouter ospf\nospf router-id 1.0.0.0") + r1.vtysh_multicmd("clear ip ospf process") _wait_output(p, "SUCCESS: {}".format(waitlist[2])) except Exception as error: logging.error("ERROR: %s", error) From bf05536741872d5df361eeb521f45ca7f9d9b1e5 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 7 Sep 2023 08:06:28 -0400 Subject: [PATCH 2/2] tests: fix max med on startup The test is failing because on r2 we are looking for a metric of 777 on startup, but the start of looking for this happens to be after the 5 second delay that is setup in the config. On r1: 2023/09/06 17:05:14.999407 BGP: [G822R-SBMNH] config-from-file# router bgp 65001 2023/09/06 17:05:15.003060 BGP: [G822R-SBMNH] config-from-file# bgp max-med on-startup 5 777 2023/09/06 17:05:15.003342 BGP: [G822R-SBMNH] config-from-file# no bgp ebgp-requires-policy 2023/09/06 17:05:15.003453 BGP: [G822R-SBMNH] config-from-file# neighbor 192.168.255.2 remote-as 65001 2023/09/06 17:05:15.004029 BGP: [G822R-SBMNH] config-from-file# neighbor 192.168.255.2 timers 3 10 2023/09/06 17:05:15.004242 BGP: [G822R-SBMNH] config-from-file# address-family ipv4 unicast 2023/09/06 17:05:15.004329 BGP: [G822R-SBMNH] config-from-file# redistribute connected 2023/09/06 17:05:15.005023 BGP: [G822R-SBMNH] config-from-file# exit-address-family 2023/09/06 17:05:15.005140 BGP: [G822R-SBMNH] config-from-file# ! 2023/09/06 17:05:15.005162 BGP: [G822R-SBMNH] config-from-file# ! 2023/09/06 17:05:17.538112 BGP: [M7Q4P-46WDR] vty[25]@> enable 2023/09/06 17:05:17.546700 BGP: [M7Q4P-46WDR] vty[25]@# clear log cmdline-targets 2023/09/06 17:05:17.570635 BGP: [M7Q4P-46WDR] vty[25]@(config)# log commands 2023/09/06 17:05:17.572518 BGP: [M7Q4P-46WDR] vty[25]@(config)# log timestamp precision 6 2023/09/06 17:05:24.982647 BGP: [YNGC8-65JDM] Begin maxmed onstartup mode - timer 5 seconds 2023/09/06 17:05:26.033134 BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.255.2 in vrf default 2023/09/06 17:05:29.982960 BGP: [N1747-51Y51] Max med on startup ended - timer expired. on r2: 2023/09/06 17:05:23.976029 BGP: [G822R-SBMNH] config-from-file# ! 2023/09/06 17:05:26.084086 BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.255.1 in vrf default 2023/09/06 17:05:27.280103 BGP: [M7Q4P-46WDR] vty[25]@> enable 2023/09/06 17:05:27.290204 BGP: [M7Q4P-46WDR] vty[25]@# clear log cmdline-targets 2023/09/06 17:05:27.328798 BGP: [M7Q4P-46WDR] vty[25]@(config)# log commands 2023/09/06 17:05:27.335032 BGP: [M7Q4P-46WDR] vty[25]@(config)# log timestamp precision 6 2023/09/06 17:05:31.558216 BGP: [M7Q4P-46WDR] vty[5]@> enable 2023/09/06 17:05:31.562482 BGP: [M7Q4P-46WDR] vty[5]@# do show logging 2023/09/06 17:05:32.942204 BGP: [M7Q4P-46WDR] vty[5]@> enable 2023/09/06 17:05:32.946745 BGP: [M7Q4P-46WDR] vty[5]@# show ip bgp neighbor 192.168.255.1 json 2023/09/06 17:05:34.173879 BGP: [M7Q4P-46WDR] vty[5]@> enable 2023/09/06 17:05:34.178448 BGP: [M7Q4P-46WDR] vty[5]@# show ip bgp neighbor 192.168.255.1 routes json 2023/09/06 17:05:36.459365 BGP: [M7Q4P-46WDR] vty[5]@> enable 2023/09/06 17:05:36.472019 BGP: [M7Q4P-46WDR] vty[5]@# show ip bgp neighbor 192.168.255.1 routes json 2023/09/06 17:05:38.557840 BGP: [M7Q4P-46WDR] vty[5]@> enable 2023/09/06 17:05:38.558948 BGP: [M7Q4P-46WDR] vty[5]@# show ip bgp neighbor 192.168.255.1 routes json 2023/09/06 17:05:40.198563 BGP: [M7Q4P-46WDR] vty[5]@> enable Notice that the 5 second delay for the max med expires at 29 seconds but the show routes on r2 does not even begin until 34 seconds, long after the max med has expired and the test has moved on. Let's relax the max-med timer to 30 seconds and modify the test to wait a bit longer for both finding it and expiring timer. Signed-off-by: Donald Sharp --- tests/topotests/bgp_max_med_on_startup/r1/bgpd.conf | 2 +- .../bgp_max_med_on_startup/test_bgp_max_med_on_startup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/topotests/bgp_max_med_on_startup/r1/bgpd.conf b/tests/topotests/bgp_max_med_on_startup/r1/bgpd.conf index 41bf96344ad0..14f90b859db0 100644 --- a/tests/topotests/bgp_max_med_on_startup/r1/bgpd.conf +++ b/tests/topotests/bgp_max_med_on_startup/r1/bgpd.conf @@ -1,6 +1,6 @@ ! router bgp 65001 - bgp max-med on-startup 5 777 + bgp max-med on-startup 30 777 no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 neighbor 192.168.255.2 timers 3 10 diff --git a/tests/topotests/bgp_max_med_on_startup/test_bgp_max_med_on_startup.py b/tests/topotests/bgp_max_med_on_startup/test_bgp_max_med_on_startup.py index 545d7bd245a9..12ec88249a96 100644 --- a/tests/topotests/bgp_max_med_on_startup/test_bgp_max_med_on_startup.py +++ b/tests/topotests/bgp_max_med_on_startup/test_bgp_max_med_on_startup.py @@ -82,12 +82,12 @@ def _bgp_has_routes(router, metric): # Check session is established test_func = functools.partial(_bgp_converge, router2) - _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + _, result = topotest.run_and_expect(test_func, None, count=60, wait=1.0) assert result is None, "Failed bgp convergence on r2" # Check metric has value of max-med test_func = functools.partial(_bgp_has_routes, router2, 777) - _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + _, result = topotest.run_and_expect(test_func, None, count=60, wait=1.0) assert result is None, "r2 does not receive routes with metric 777" # Check that when the max-med timer expires, metric is updated