Commit 2138f00
committed
Fix route_check.py: intersection-based retry in check_frr_pending_routes
## What I did
Replaced the overwrite-on-each-iteration retry loop with an intersection
accumulator so that only routes stuck in *every* poll window are mitigated.
## Problem with the previous logic
The retry loop called get_frr_routes_parallel() up to FRR_CHECK_RETRIES
times and simply overwrote missed_rt on every iteration:
for i in range(retries):
missed_rt, failed_rt = get_frr_routes_parallel(namespace)
if not missed_rt and not failed_rt:
break
time.sleep(FRR_WAIT_TIME)
# mitigate whatever happened to be in missed_rt at loop exit
Consequence: a route stuck only in the last iteration is
mitigated even though it may be in the middle of normal BGP convergence
(false positive / premature mitigation).
## New logic
Accumulate a running intersection across iterations. On the first iteration
the accumulator is seeded with the full result set. On each subsequent
iteration, any prefix no longer present is removed.
iter 0: {A, B, C, D} <- seed
iter 1: {A, B, C} <- D removed (converged)
iter 2: {A, B} <- C removed (converged)
result: {A, B} <- truly stuck, safe to mitigate
If the current iteration returns nothing, the intersection becomes empty and
the loop exits early — same fast-path as before for the healthy case.
Signed-off-by: mike-dubrovsky <mdubrovs@cisco.com>1 parent 212bd03 commit 2138f00
1 file changed
Lines changed: 38 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
730 | 730 | | |
731 | 731 | | |
732 | 732 | | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
744 | 766 | | |
745 | 767 | | |
746 | | - | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
747 | 773 | | |
748 | 774 | | |
749 | 775 | | |
| |||
0 commit comments