Skip to content

added wait for port up before checking bgp neighborship#5391

Open
mnp-juniper wants to merge 3 commits intoopenconfig:mainfrom
mnp-juniper:aftreboot
Open

added wait for port up before checking bgp neighborship#5391
mnp-juniper wants to merge 3 commits intoopenconfig:mainfrom
mnp-juniper:aftreboot

Conversation

@mnp-juniper
Copy link
Copy Markdown
Contributor

Issue:
After the system reboot the script is checking for bgp neighborship while the interface is still coming up.
Fix:
Added a wait time upto 12 minutes for the interface to come up

@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 occurring after system reboots in the AFT reboot test suite. By explicitly verifying that the interface has reached an operational UP status before attempting to validate BGP sessions, the change ensures that the test environment is fully initialized, thereby increasing the reliability of the test execution.

Highlights

  • Interface Readiness: Added a wait condition to ensure the DUT interface is in an UP state before proceeding with BGP neighborship checks.
  • Test Robustness: Introduced a 10-minute timeout for the interface operational status check to prevent premature test failures following a system reboot.
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 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 counter productive. 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
Copy link
Copy Markdown

OpenConfigBot commented Apr 28, 2026

Pull Request Functional Test Report for #5391 / 117f68d

Virtual Devices

Device Test Test Documentation Job Raw Log
Arista cEOS status
AFT-5.1: AFTs DUT Reboot
Cisco 8000E status
AFT-5.1: AFTs DUT Reboot
Cisco XRd status
AFT-5.1: AFTs DUT Reboot
Juniper ncPTX status
AFT-5.1: AFTs DUT Reboot
Nokia SR Linux status
AFT-5.1: AFTs DUT Reboot
Openconfig Lemming status
AFT-5.1: AFTs DUT Reboot

Hardware Devices

Device Test Test Documentation Raw Log
Arista 7808 status
AFT-5.1: AFTs DUT Reboot
Cisco 8808 status
AFT-5.1: AFTs DUT Reboot
Juniper PTX10008 status
AFT-5.1: AFTs DUT Reboot
Nokia 7250 IXR-10e status
AFT-5.1: AFTs DUT Reboot

Help

Copy link
Copy Markdown
Contributor

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

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 adds a check to ensure the network interface is operational after a reboot before verifying BGP sessions. The review feedback correctly identifies an incorrect usage of the gnmi.Await function, which does not support a timeout argument in its standard signature, and suggests using gnmi.Watch(...).Await(t) instead. The feedback also recommends increasing the timeout to 12 minutes and verifying multiple ports to improve test robustness.

Comment on lines +438 to +440
dutPort := tc.dut.Port(t, port1Name).Name()
t.Log("Waiting for interface to come up before checking BGP neighborship after reboot...")
gnmi.Await(t, dut, gnmi.OC().Interface(dutPort).OperStatus().State(), 12*time.Minute, oc.Interface_OperStatus_UP)
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.

high

The gnmi.Await function does not support a timeout argument in its standard signature. To wait for a condition with a specific timeout, you should use gnmi.Watch(...).Await(t).

Additionally:

  1. Use tc.dut instead of dut for consistency within the test case.
  2. The timeout is increased to 12 minutes to align with the PR description and ensure the convergence timeout is sufficiently long for a reboot scenario, per repository guidelines.
  3. Note that awaiting intermediate interface states may be redundant if a subsequent final state (like BGP) is also awaited, though it can assist in debugging.
Suggested change
dutPort := tc.dut.Port(t, port1Name).Name()
t.Log("Waiting for interface to come up before checking BGP neighborship after reboot...")
gnmi.Await(t, dut, gnmi.OC().Interface(dutPort).OperStatus().State(), 12*time.Minute, oc.Interface_OperStatus_UP)
for _, port := range []string{port1Name, port2Name} {
dutPort := tc.dut.Port(t, port).Name()
t.Logf("Waiting for interface %s to come up before checking BGP neighborship after reboot...", dutPort)
_, ok := gnmi.Watch(t, tc.dut, gnmi.OC().Interface(dutPort).OperStatus().State(), 12*time.Minute, func(val *ygnmi.Value[oc.E_Interface_OperStatus]) bool {
v, ok := val.Val()
return ok && v == oc.Interface_OperStatus_UP
}).Await(t)
if !ok {
t.Fatalf("Interface %s did not come up within timeout", dutPort)
}
}
References
  1. In tests that inject artificial latency or involve reboots, convergence timeouts must be sufficiently long to account for the added delay and prevent premature test failure.
  2. Avoid redundant gnmi.Await calls. Awaiting a final state (e.g., interfaces being up) can make an earlier await for an intermediate state (e.g., breakout mode completion) unnecessary.

@mnp-juniper mnp-juniper marked this pull request as ready for review April 28, 2026 06:56
@mnp-juniper mnp-juniper requested a review from a team as a code owner April 28, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants