tests: bgp_suppress_duplicates: simplify and split into four tests - #21203
Merged
Conversation
Convert the iBGP session between r1 and r2 to eBGP. This eliminates rmap-to-r2 (which existed solely to normalize local-pref to 100 at r2), next-hop-self, and the now-empty address-family block on r2. Since local-pref is not carried over eBGP, drop the local_pref parameter from _bgp_check_route_attributes(). Add a step to wait for the initial route to appear at r2 before recording the baseline dup count and starting the TCs. Also add an explicit verification that TC4's force update (metric=2000) has been received at r2 before the withdraw+readd sequence, closing a race condition where the MRAI timer could already be expired and the sleep skipped while the BGP UPDATE was still in flight. Move helper functions to module level and split the single monolithic test function into four separate functions, one per TC. Each captures its own dup_before baseline. TC1 retains session establishment and initial route propagation checks; TC2-TC4 rely on the shared topology state left by the preceding TC. Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
Greptile SummaryThis PR simplifies the
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant TC as Test Case
participant R1 as r1 (AS 65001)
participant R2 as r2 (AS 65002)
Note over R1,R2: eBGP Session Setup
TC->>R1: Check BGP neighbor established
R1->>R2: BGP UPDATE (metric=2000)
TC->>R2: Wait for initial route receipt
Note over TC: TC1: Attr A β Attr A
TC->>R1: Change local-pref 500β600 (metric unchanged)
TC->>R1: Wait for MRAI expiry
TC->>R2: Verify no duplicate update sent
Note over TC: TC2: Attr A β B β A
TC->>R1: Change metric 2000β3000 (force update)
R1->>R2: BGP UPDATE (metric=3000)
TC->>R1: Within MRAI: metric 3000β2000β3000
TC->>R1: Wait for MRAI expiry
TC->>R2: Verify no duplicate update sent
Note over TC: TC3: Attr A β B β B
TC->>R1: Change metric 3000β2000 (force update)
R1->>R2: BGP UPDATE (metric=2000)
TC->>R1: Within MRAI: metricβ3000, then local-pref change
TC->>R1: Wait for MRAI expiry
TC->>R2: Verify single update (metric=3000)
Note over TC: TC4: Attr A β Withdraw β A
TC->>R1: Change metric 3000β2000 (force update)
R1->>R2: BGP UPDATE (metric=2000)
TC->>R2: Explicit wait for update receipt (race fix)
TC->>R1: Withdraw route, then re-add
TC->>R1: Wait for MRAI expiry
TC->>R2: Verify no duplicate/withdraw sent
Last reviewed commit: 2becd7b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Convert the iBGP session between r1 and r2 to eBGP. This eliminates rmap-to-r2 (which existed solely to normalize local-pref to 100 at r2), next-hop-self, and the now-empty address-family block on r2. Since local-pref is not carried over eBGP, drop the local_pref parameter from _bgp_check_route_attributes().
Add a step to wait for the initial route to appear at r2 before recording the baseline dup count and starting the TCs. Also add an explicit verification that TC4's force update (metric=2000) has been received at r2 before the withdraw+readd sequence, closing a race condition where the MRAI timer could already be expired and the sleep skipped while the BGP UPDATE was still in flight.
Move helper functions to module level and split the single monolithic test function into four separate functions, one per TC. Each captures its own dup_before baseline. TC1 retains session establishment and initial route propagation checks; TC2-TC4 rely on the shared topology state left by the preceding TC.