Skip to content

RT-1.1: Fix intermittent notification counter race and peer-as telemetry lag in base_bgp_session_parameters - #6172

Merged
navaneethyv merged 4 commits into
openconfig:mainfrom
arnavanand-lgtm:fix-bgp-session-parameters-telemetry-sync
Nov 20, 2026
Merged

navaneethyv merged 4 commits into
openconfig:mainfrom
arnavanand-lgtm:fix-bgp-session-parameters-telemetry-sync

Conversation

@arnavanand-lgtm

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

Copy link
Copy Markdown
Contributor

Summary

Fixes intermittent telemetry synchronization races and session teardown handling in base_bgp_session_parameters_test (RT-1.1)

Problem

  1. Notification Counter Reset Race (TestEstablishAndDisconnect): The test sequentially awaited session disconnect and error code verification before executing a synchronous gnmi.Get for the received NOTIFICATION counter. Because active session counters reset when BGP transitions to IDLE, fast session teardowns caused the test to intermittently read 0 (received NOTIFICATION count got 0, want > 0).
  2. Telemetry Propagation Lag (TestParameters): Calling confirm.State() immediately after modifying peer-as intermittently read stale state before the DUT's telemetry engine converged on the new AS.
  3. Missing Teardown Barrier (bgpClearConfig): bgpClearConfig() deleted the BGP config without awaiting session teardown to IDLE, leaking transitioning session state into subsequent subtests.

Fix

  1. Real-time Notification Streaming: Initiated an asynchronous gnmi.Watch on NOTIFICATION().State() before sending the CEASE notification, capturing the counter increment in real time as the packet arrives and eliminating the race against session teardown.
  2. Await Telemetry Convergence: Added gnmi.Await for nbrPath.PeerAs().State() to reach wantPeerAS before executing confirm.State().
  3. Clean Teardown Synchronization: Added a gnmi.Watch in bgpClearConfig() waiting for SessionState == IDLE before proceeding to the next subtest.

Verification

  • Verified across 3 consecutive runs on physical Arista j2 hardware testbeds with a 100% pass rate across all subtests and parameter permutations.

RT-1.1 Pass 1.log
RT-1.1 Pass 2.log
RT-1.1 Pass 3.log

Pass log for other Nokia, Juniper and Cisco
RT-1.1 Cisco Pass log.log
RT-1.1 Nokia Pass log.log
RT-1.1 Juniper Pass log.log

@arnavanand-lgtm
arnavanand-lgtm requested a review from a team as a code owner October 16, 2026 06:59
@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 intermittent test failures in the base_bgp_session_parameters suite by improving synchronization between test execution and the DUT's telemetry state. By implementing asynchronous watches and explicit await barriers, the changes ensure that telemetry data is fully propagated and captured before verification, effectively eliminating race conditions during session teardown and configuration updates.

Highlights

  • Notification Counter Race: Replaced synchronous gnmi.Get calls with gnmi.Watch to capture BGP notification increments in real-time, preventing race conditions during fast session teardowns.
  • Telemetry Propagation Lag: Introduced gnmi.Await for PeerAs state to ensure the DUT's telemetry engine has converged on new configuration values before verification.
  • Teardown Synchronization: Added a state-checking barrier in bgpClearConfig to ensure BGP sessions reach the IDLE state before proceeding to subsequent subtests, preventing state leakage.
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 16, 2026 •

Copy link
Copy Markdown

Pull Request Functional Test Report for #6172 / d4f01f8

Virtual Devices

Device Test Status Test Documentation Job Raw Log
Arista cEOS status
RT-1.1: pending authorization
RT-1.1: Base BGP Session Parameters
Cisco 8000E status
RT-1.1: pending authorization
RT-1.1: Base BGP Session Parameters
Cisco XRd status
RT-1.1: pending authorization
RT-1.1: Base BGP Session Parameters
Juniper ncPTX status
RT-1.1: pending authorization
RT-1.1: Base BGP Session Parameters
Nokia SR Linux status
RT-1.1: pending authorization
RT-1.1: Base BGP Session Parameters
Openconfig Lemming status
RT-1.1: pending authorization
RT-1.1: Base BGP Session Parameters

Hardware Devices

Device Test Status Test Documentation Raw Log
Arista status
RT-1.1: pending authorization
RT-1.1: Base BGP Session Parameters
Cisco status
RT-1.1: pending authorization
RT-1.1: Base BGP Session Parameters
Juniper status
RT-1.1: pending authorization
RT-1.1: Base BGP Session Parameters
Nokia status
RT-1.1: pending authorization
RT-1.1: Base BGP Session Parameters

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 improves the reliability of BGP session parameter tests by replacing direct state checks with asynchronous watches. Specifically, it adds a watch to ensure the BGP neighbor session state is IDLE during configuration cleanup, uses an asynchronous watch for received NOTIFICATION messages in the disconnect test to avoid race conditions, and awaits the correct Peer AS state in parameter tests. The feedback recommends using the ygot-generated getter GetBgp() instead of direct field access to ensure nil-safety and prevent potential nil-pointer dereference panics.

@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 @AmrNJ @jayakumarramisetty
I've added the pass log for other vendors in the desrciption

@navaneethyv
navaneethyv merged commit 7486c7d into openconfig:main Nov 20, 2026
20 checks passed
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.

3 participants