Skip to content

[DP-1.11] qos: wait for flow transmission stop and in-flight packet drain in bursty_traffic_test - #6259

Open
arnavanand-lgtm wants to merge 4 commits into
openconfig:mainfrom
arnavanand-lgtm:fix-bursty-traffic-test-drain
Open

arnavanand-lgtm wants to merge 4 commits into
openconfig:mainfrom
arnavanand-lgtm:fix-bursty-traffic-test-drain

Conversation

@arnavanand-lgtm

@arnavanand-lgtm arnavanand-lgtm commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

In #5941, stopTrafficOnFlows was introduced to asynchronously stop traffic flows between subtests using gosnappi.StateTrafficFlowTransmitState.STOP. However, SetControlState returns immediately without waiting for transmission to halt or in-flight packets to clear the link and switch buffers.

When sampling flow counters immediately after stopTrafficOnFlows, transient in-flight packets (~90–200 packets / 48–100 KB) caused ateOutPkts > ateInPkts at the instant gnmi.Get was called. Because the physical DUT switch forwarded all traffic without drops (dutDropOctetCounterDiff = 0), the assertion:
if dutDropOctetCounterDiff < ateDropOctetCounterDiff { t.Errorf(...) }
failed with got 0, want >= <ateDrop> across all 7 QoS queue subtests, despite 100% throughput verified moments later once counters settled.

Changes Made

  1. Two-Phase Quiescence in stopTrafficOnFlows:
    • Phase 1 (Transmit State): Awaits gnmi.OTG().Flow(id).Transmit().State() == false to confirm OTG transmission has stopped.
    • Phase 2 (In-Flight Packet Drain): Awaits receiver gnmi.OTG().Flow(id).Counters().InPkts().State() counter stabilization across consecutive samples, using a hasLastRx tracker (per Gemini review feedback) so zero-packet flows also exit immediately instead of hitting the 15s timeout before assertions execute.
  2. Removed Redundant Sleep: Removed the arbitrary time.Sleep(30 * time.Second) before startTrafficOnFlows, reducing test execution time by ~3.5 minutes without impacting traffic stability.

Verification

Validated after the hasLastRx update across physical hardware testbeds for all 4 vendors (5/5 runs PASS, all 7 QoS queue subtests NC1, AF4, AF3, AF2, AF1, BE0, BE1 passing with 100% throughput; also resolves the pre-existing main Nokia IXR10E drain failure on Bursty_NC1_traffic):

@arnavanand-lgtm
arnavanand-lgtm requested a review from a team as a code owner November 8, 2026 19:20
@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 addresses a race condition in the bursty_traffic_test where assertions were failing due to transient in-flight packets being counted before they had fully cleared the network buffers. By introducing explicit state monitoring for transmission status and packet counter stabilization, the test now ensures accurate measurement of traffic drops. Additionally, the removal of an arbitrary sleep timer improves the efficiency of the test suite.

Highlights

  • Improved Traffic Quiescence: Implemented a two-phase waiting mechanism in stopTrafficOnFlows to ensure OTG transmission has fully stopped and in-flight packets have drained before proceeding with assertions.
  • Optimized Test Execution: Removed an unnecessary 30-second sleep period before starting traffic flows, reducing overall test execution time by approximately 3.5 minutes.
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 Nov 8, 2026 •

Copy link
Copy Markdown

Pull Request Functional Test Report for #6259 / 6f847c3

Virtual Devices

Device Test Status Test Documentation Job Raw Log
Arista cEOS status
DP-1.11: pending authorization
DP-1.11: Bursty traffic test
Cisco 8000E status
DP-1.11: pending authorization
DP-1.11: Bursty traffic test
Cisco XRd status
DP-1.11: pending authorization
DP-1.11: Bursty traffic test
Juniper ncPTX status
DP-1.11: pending authorization
DP-1.11: Bursty traffic test
Nokia SR Linux status
DP-1.11: pending authorization
DP-1.11: Bursty traffic test
Openconfig Lemming status
DP-1.11: pending authorization
DP-1.11: Bursty traffic test

Hardware Devices

Device Test Status Test Documentation Raw Log
Arista status
DP-1.11: pending authorization
DP-1.11: Bursty traffic test
Cisco status
DP-1.11: pending authorization
DP-1.11: Bursty traffic test
Juniper status
DP-1.11: pending authorization
DP-1.11: Bursty traffic test
Nokia status
DP-1.11: pending authorization
DP-1.11: Bursty traffic test

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 optimizes the bursty traffic test by removing a static 30-second sleep before starting traffic and introducing dynamic waiting logic in stopTrafficOnFlows using gnmi.Watch to confirm transmission has stopped and in-flight packets have drained. The review feedback identifies a bug in the packet-draining watch logic where a flow receiving zero packets (e.g., due to a traffic generation failure) will cause the watch to always time out after 15 seconds. A code suggestion is provided to resolve this by tracking the previous sample state with a boolean flag instead of a rx > 0 check.

@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!

@jayakumarramisetty jayakumarramisetty self-assigned this Nov 20, 2026

@navaneethyv navaneethyv 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.

Looks good. please apply the Gemini comments before closure.

@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.

4 participants