File tree Expand file tree Collapse file tree
tests/topotests/two_layer_wucmp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -374,13 +374,32 @@ def check_bgp_peer():
374374 step ("STEP 2: Installing sharp routes and waiting for convergence" )
375375
376376 # Extract IPv4 from leaf2 loopback
377- lo_output = net [ "leaf2" ]. cmd ( "vtysh -c 'show interface lo'" )
378- ipv4_match = re . search ( r"inet (\d+\.\d+\.\d+\.\d+)/\d+" , lo_output )
377+ expected_loopback_ipv4 = "10.0.0.2"
378+ ipv4_state = { "nexthop" : None }
379379
380- if not ipv4_match :
381- assert False , "Could not find IPv4 address on loopback interface"
380+ def check_leaf2_loopback_ipv4 ():
381+ lo_output = net ["leaf2" ].cmd ("vtysh -c 'show interface lo'" )
382+ ipv4_match = re .search (r"inet (\d+\.\d+\.\d+\.\d+)/\d+" , lo_output )
382383
383- ipv4_nexthop = ipv4_match .group (1 )
384+ if not ipv4_match :
385+ logger .info ("Still waiting for IPv4 address on leaf2 loopback interface" )
386+ return False
387+
388+ ipv4_state ["nexthop" ] = ipv4_match .group (1 )
389+ return True
390+
391+ success , result = topotest .run_and_expect (
392+ check_leaf2_loopback_ipv4 ,
393+ True ,
394+ count = 20 ,
395+ wait = 1 ,
396+ )
397+
398+ assert (
399+ success
400+ ), f"Could not find IPv4 address on loopback interface for node leaf2; expected { expected_loopback_ipv4 } "
401+
402+ ipv4_nexthop = ipv4_state ["nexthop" ]
384403 logger .info (f"Using nexthop for sharp routes: IPv4={ ipv4_nexthop } " )
385404
386405 # Install IPv4 routes
You can’t perform that action at this time.
0 commit comments