Skip to content

TE-3.31 gribi: Fix traffic generation and tolerance check in hierarchical_weight_resolution_pbf_test - #6202

Open
arnavanand-lgtm wants to merge 3 commits into
openconfig:mainfrom
arnavanand-lgtm:fix-hierarchical-weight-resolution-pbf-traffic-rate
Open

arnavanand-lgtm wants to merge 3 commits into
openconfig:mainfrom
arnavanand-lgtm:fix-hierarchical-weight-resolution-pbf-traffic-rate

Conversation

@arnavanand-lgtm

@arnavanand-lgtm arnavanand-lgtm commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR addresses packet distribution imbalances and test inconsistencies in hierarchical_weight_resolution_pbf_test by aligning its traffic parameters with the sister test (hierarchical_weight_resolution_test) and ensuring platform tolerance deviations are checked consistently.


Problem

  1. Premature Flow Truncation & Under-Sampling:

    • ipv4FlowCount is configured to 65,000 flows.
    • However, flowipv4.Rate().SetPps(...) and flowipv4.Duration().Continuous() were omitted in testTraffic(), causing OTG to default to 1,000 PPS.
    • Over the 1-minute test duration, only 60,359 packets were transmitted.
    • Because only 60,359 packets were sent out of a 65,000-flow sequence, the generator stopped before finishing even a single full iteration. The last 4,641 flows (~7.14% of the flow space) were truncated and never transmitted, skewing the hardware hash distribution into the buckets by ~0.3% - 0.47% and causing failures against the strict 0.20% tolerance.
  2. Missing 5-Tuple L4 Entropy:

    • Unlike hierarchical_weight_resolution_test (which includes an inner UDP header incrementing across 50,000 ports), this test lacked an inner L4 header, reducing entropy for the switch load-balancing hash engines.
  3. Inconsistent Tolerance Deviation Check:

    • The test file has two test cases: testBasicHierarchicalWeight() (4 VLANs) and testHierarchicalWeightBoundaryScenario() (18 VLANs).
    • In testHierarchicalWeightBoundaryScenario(), the test properly queries deviations.HierarchicalWeightResolutionTolerance(dut) to check whether the platform has an approved tolerance deviation (e.g., Juniper specifies 0.4 in metadata.textproto).
    • However, in testBasicHierarchicalWeight(), this check was omitted, causing it to compare directly against the hardcoded package-level default tolerance = 0.2 and ignoring any platform-specific tolerance configured in metadata.textproto.

Solution

  1. Packet Size, Traffic Rate & Continuous Duration: Updated packet size via flowipv4.Size().SetFixed(300) (from 100) and explicitly configured flowipv4.Rate().SetPps(10000) and flowipv4.Duration().Continuous(), transmitting >600,000 packets per minute (>9 complete iterations of the 65,000 flow space) to eliminate cyclic flow truncation.
  2. Inner UDP Port Entropy: Added an inner UDP header incrementing across 50,000 source and destination ports to provide full 5-tuple hash entropy (matching hierarchical_weight_resolution_test).
  3. Local Tolerance Deviation Check: Added tolerance := deviations.HierarchicalWeightResolutionTolerance(dut) inside t.Run("testTraffic", ...) in testBasicHierarchicalWeight() so platform-specific tolerance deviations are applied without mutating the package-level tolerance variable (per Gemini review feedback).

Hardware Verification

Validated both TestBasicHierarchicalWeightWithVrfPolW (4 VLANs) and TestHierarchicalWeightBoundaryScenarioWithVrfPolW (18 VLANs) — including both testTraffic and validateAFTWeights — across physical hardware testbeds for all 4 vendors after applying the local tolerance update (5/5 PASS):

@arnavanand-lgtm
arnavanand-lgtm requested a review from a team as a code owner October 27, 2026 18:41
@arnavanand-lgtm
arnavanand-lgtm requested a review from ecb75 October 27, 2026 18:41
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the reliability and accuracy of the hierarchical weight resolution test by addressing packet distribution imbalances. By aligning traffic generation parameters with existing test standards and ensuring that platform-specific tolerance deviations are respected, the changes eliminate previous test failures caused by flow truncation and overly strict hardcoded thresholds.

Highlights

  • Traffic Generation Improvements: Configured the traffic generator with a fixed rate of 10,000 PPS and continuous duration to prevent flow truncation and ensure full iteration coverage.
  • Enhanced L4 Entropy: Added an inner UDP header with incrementing source and destination ports to improve hash distribution entropy for load-balancing verification.
  • Tolerance Check Consistency: Integrated platform-specific tolerance deviations into the basic hierarchical weight test to ensure consistent validation across all test scenarios.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@OpenConfigBot

OpenConfigBot commented Oct 27, 2026 •

Copy link
Copy Markdown

Pull Request Functional Test Report for #6202 / e088f58

Virtual Devices

Device Test Status Test Documentation Job Raw Log
Arista cEOS status
TE-3.31: pending authorization
TE-3.31: Hierarchical weight resolution with PBF
Cisco 8000E status
TE-3.31: pending authorization
TE-3.31: Hierarchical weight resolution with PBF
Cisco XRd status
TE-3.31: pending authorization
TE-3.31: Hierarchical weight resolution with PBF
Juniper ncPTX status
TE-3.31: pending authorization
TE-3.31: Hierarchical weight resolution with PBF
Nokia SR Linux status
TE-3.31: pending authorization
TE-3.31: Hierarchical weight resolution with PBF
Openconfig Lemming status
TE-3.31: pending authorization
TE-3.31: Hierarchical weight resolution with PBF

Hardware Devices

Device Test Status Test Documentation Raw Log
Arista status
TE-3.31: pending authorization
TE-3.31: Hierarchical weight resolution with PBF
Cisco status
TE-3.31: pending authorization
TE-3.31: Hierarchical weight resolution with PBF
Juniper status
TE-3.31: pending authorization
TE-3.31: Hierarchical weight resolution with PBF
Nokia status
TE-3.31: pending authorization
TE-3.31: Hierarchical weight resolution with PBF

Help

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the hierarchical weight resolution PBF test by adjusting the flow packet size, rate, and duration, adding UDP source and destination port increments, and dynamically updating the tolerance value based on device deviations. The reviewer pointed out that modifying the package-level global variable tolerance inside a test case is an anti-pattern that can lead to state leakage and flaky tests, suggesting instead to define it as a local variable.

@arnavanand-lgtm

Copy link
Copy Markdown
Contributor Author

Hi @AmrNJ @navaneethyv @jayakumarramisetty, could you please help review this PR or assign someone who can take a look? Thanks!

@arnavanand-lgtm

Copy link
Copy Markdown
Contributor Author

Hi @navaneethyv @jayakumarramisetty @AmrNJ
I've addressed all the comments and have added the latest results for the remaining vendor could you please help to get this reviewed and merged

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants