Skip to content

Fix LACP configuration setup for TestLACPMember and TestLagMacAddress gNMI-1.10#5034

Open
youssefyamoutyy wants to merge 3 commits intoopenconfig:mainfrom
b4firex:fix/telemetry-basic-check
Open

Fix LACP configuration setup for TestLACPMember and TestLagMacAddress gNMI-1.10#5034
youssefyamoutyy wants to merge 3 commits intoopenconfig:mainfrom
b4firex:fix/telemetry-basic-check

Conversation

@youssefyamoutyy
Copy link
Copy Markdown
Contributor

Brief description and need for this PR

TestLagMacAddress and TestLACPMember tests were being skipped when base LACP configuration was not pre-loaded on the device

Proposed changes

Implemented dynamic LACP configuration setup/teardown helper functions that allows those two tests to run.
The change uses one gNMI.Update() to apply all LACP, LAG, and member port configs simultaneously.
The changes also ensure complete teardown of configurations after test completion and atomic updates prevent connection loss and intermediate bad states.

@youssefyamoutyy youssefyamoutyy requested a review from a team as a code owner January 30, 2026 21:18
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @youssefyamoutyy, 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 significantly enhances the reliability and independence of LACP-related tests by introducing dynamic configuration management. It provides helper functions to programmatically set up and tear down LACP, LAG, and member port configurations on the DUT. This change eliminates the dependency on pre-loaded LACP configurations, preventing tests from being skipped and ensuring a consistent testing environment through atomic updates and complete cleanup.

Highlights

  • Dynamic LACP Configuration: Introduced dynamic LACP configuration setup and teardown helper functions (setupLACPConfig, teardownLACPConfig) to manage LACP, LAG, and member port configurations on the DUT.
  • Test Reliability Improvement: Integrated these helper functions into TestLagMacAddress and TestLACPMember to ensure tests run reliably without relying on pre-existing LACP configurations, preventing them from being skipped.
  • Atomic Configuration Updates: Implemented atomic LACP, LAG, and member port configuration using a single gNMI.Update() call, which helps prevent intermediate bad states and potential connection loss during configuration changes.
  • Clean Test Environment: Ensured complete teardown of LACP configurations after test completion to maintain a clean and consistent testing environment for subsequent tests.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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 Jan 30, 2026

Pull Request Functional Test Report for #5034 / c57d2ec

Virtual Devices

Device Test Test Documentation Job Raw Log
Arista cEOS status
gNMI-1.10: Telemetry: Basic Check
Cisco 8000E status
gNMI-1.10: Telemetry: Basic Check
Cisco XRd status
gNMI-1.10: Telemetry: Basic Check
Juniper ncPTX status
gNMI-1.10: Telemetry: Basic Check
Nokia SR Linux status
gNMI-1.10: Telemetry: Basic Check
Openconfig Lemming status
gNMI-1.10: Telemetry: Basic Check

Hardware Devices

Device Test Test Documentation Raw Log
Arista 7808 status
gNMI-1.10: Telemetry: Basic Check
Cisco 8808 status
gNMI-1.10: Telemetry: Basic Check
Juniper PTX10008 status
gNMI-1.10: Telemetry: Basic Check
Nokia 7250 IXR-10e status
gNMI-1.10: Telemetry: Basic Check

Help

@youssefyamoutyy youssefyamoutyy changed the title Fix LACP configuration setup for TestLACPMember and TestLagMacAddress Fix LACP configuration setup for TestLACPMember and TestLagMacAddress gNMI-1.10 Jan 30, 2026
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 introduces helper functions to dynamically set up and tear down LACP configurations for tests, which is a great improvement. My review focuses on improving the robustness of these new helpers. I've suggested replacing a time.Sleep with a more reliable gnmi.Await to wait for state changes, in accordance with the repository's style guide. I've also recommended making the teardown process atomic using a gnmi.SetBatch for consistency with the atomic setup.

// Apply all configurations atomically
gnmi.Update(t, dut, gnmi.OC().Config(), d)
t.Logf("Configured LACP LAG interface %s with ports %s and %s", aggID, dp1.Name(), dp2.Name())
time.Sleep(2 * time.Second)
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.

medium

The use of time.Sleep is discouraged as it can lead to flaky tests. The repository style guide (lines 53-54) recommends using gnmi.Watch with .Await to wait for specific conditions. Instead of a fixed sleep, you should wait for the aggregate interface to become operationally UP.

Suggested change
time.Sleep(2 * time.Second)
gnmi.Await(t, dut, gnmi.OC().Interface(aggID).OperStatus().State(), 2*time.Minute, operStatusUp)
References
  1. The style guide explicitly states to avoid using time.Sleep and instead use gnmi.Watch with .Await for waiting on conditions to prevent flaky tests. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 62c0106

Comment on lines +1161 to +1169
for _, port := range []*ondatra.Port{dp1, dp2} {
gnmi.Delete(t, dut, gnmi.OC().Interface(port.Name()).Ethernet().AggregateId().Config())
}

// Remove LAG interface
gnmi.Delete(t, dut, gnmi.OC().Interface(aggID).Config())

// Remove LACP interface configuration
gnmi.Delete(t, dut, gnmi.OC().Lacp().Interface(aggID).Config())
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.

medium

The teardownLACPConfig function uses multiple gnmi.Delete calls, which are not atomic. While the setup is atomic, the teardown is not. For consistency and robustness, it's better to perform the teardown atomically as well. You can achieve this by using a gnmi.SetBatch to group all delete operations into a single gNMI Set request.

    b := &gnmi.SetBatch{}
	for _, port := range []*ondatra.Port{dp1, dp2} {
		gnmi.BatchDelete(b, gnmi.OC().Interface(port.Name()).Ethernet().AggregateId().Config())
	}

	// Remove LAG interface
	gnmi.BatchDelete(b, gnmi.OC().Interface(aggID).Config())

	// Remove LACP interface configuration
	gnmi.BatchDelete(b, gnmi.OC().Lacp().Interface(aggID).Config())

	b.Set(t, dut)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in c57d2ec

@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 21530991490

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 9.919%

Totals Coverage Status
Change from base Build 21508799190: 0.0%
Covered Lines: 2247
Relevant Lines: 22654

💛 - Coveralls

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants