Skip to content

TE-16.3 fix#5495

Open
suredhar wants to merge 14 commits into
openconfig:mainfrom
b4firex:suredhar_te-16.3_fix
Open

TE-16.3 fix#5495
suredhar wants to merge 14 commits into
openconfig:mainfrom
b4firex:suredhar_te-16.3_fix

Conversation

@suredhar
Copy link
Copy Markdown
Contributor

Fixes ISIS interface reference configuration and BGP configuration.

@suredhar suredhar requested a review from a team as a code owner May 21, 2026 08:43
@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 updates the network configuration logic for ISIS and BGP within the test suite. The changes ensure more robust interface reference handling across different hardware vendors and improve the accuracy of telemetry verification paths by refining how interface suffixes are applied.

Highlights

  • ISIS Interface Configuration: Updated ISIS interface configuration to explicitly parse and set base interface and subinterface references, including handling for specific device deviations.
  • BGP Configuration: Modified BGP local address assignment to use the loopback interface name specifically for Cisco devices.
  • Telemetry Verification: Adjusted the logic for telemetry path verification to require both deviation flags to be present before appending the .0 suffix.
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.

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 updates the ISIS and BGP configuration logic to better handle subinterfaces and vendor-specific requirements. Key changes include parsing interface names for subinterface indices in configureISIS and adjusting BGP local address settings for Cisco devices. Review feedback highlighted a logic inconsistency in the ISIS telemetry verification regarding interface suffixing and noted a violation of the deviation guidelines where dut.Vendor() was used instead of the deviations package for vendor-specific logic.

Comment on lines 639 to 641
if deviations.ExplicitInterfaceInDefaultVRF(dut) && deviations.InterfaceRefInterfaceIDFormat(dut) {
dutIntf = dutIntf + ".0"
}
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 condition for adding the ".0" suffix has been changed from "||" to "&&", which creates an inconsistency with the configuration logic in "configureISIS" (lines 577-579) that still uses "||". This mismatch will cause the telemetry check to look for the wrong interface name if only one of the deviations is enabled. Additionally, the check for an existing dot in the interface name should be included to prevent double-suffixing, matching the logic used in the configuration step.

Suggested change
if deviations.ExplicitInterfaceInDefaultVRF(dut) && deviations.InterfaceRefInterfaceIDFormat(dut) {
dutIntf = dutIntf + ".0"
}
if (deviations.ExplicitInterfaceInDefaultVRF(dut) || deviations.InterfaceRefInterfaceIDFormat(dut)) && !strings.Contains(dutIntf, ".") {
dutIntf = dutIntf + ".0"
}

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.

This needs to be corrected as well. I think we should just remove InterfaceRefInterfaceIDFormat. These are two different deviations used by two different vendors and can never be True

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.

ack

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.

Addressed in latest commit.

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.

This can be true for 2 vendors independently and simultaneously as discussed. Latest commit has a better approach. PTAL

Comment on lines +623 to +625
if dut.Vendor() == ondatra.CISCO {
localAddressLeaf = loopbackIntfName
}
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

Avoid using dut.Vendor() for vendor-specific logic or configurations in tests. Instead, define and use a deviation in the deviations package to maintain test abstraction and portability across different vendors, as per the general rules.

References
  1. Avoid using "dut.Vendor()" for vendor-specific logic or configurations in tests. Instead, use the "deviations" package to maintain test abstraction and portability across different vendors.

Copy link
Copy Markdown
Contributor

@karthikeya-remilla karthikeya-remilla May 21, 2026

Choose a reason for hiding this comment

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

This will be addressed via existing deviation use_interface_name_for_ibgp_neighbor_transport_ipv4_local_address used in related tests.

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.

Addressed in latest commit.

}
if deviations.ExplicitInterfaceInDefaultVRF(dut) || deviations.InterfaceRefInterfaceIDFormat(dut) {
intfName = intfName + ".0"
// Parse interface name to extract base interface and subinterface index
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.

This should be through OC.

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.

will correct it

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.

Addressed in latest commit.

@karthikeya-remilla karthikeya-remilla requested a review from a team as a code owner May 21, 2026 15:58
@karthikeya-remilla
Copy link
Copy Markdown
Contributor

/gemini review

@karthikeya-remilla
Copy link
Copy Markdown
Contributor

Latest changes:

  • Nokia does not need ExplicitInterfaceInDefaultVRF to imply portX.0 in
    ISIS, so we can decouple that
  • if the vendor needs interface-ref ID formatting and the name is a base interface, append .0
  • if the name already has a dot, leave it alone

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 a new deviation UseInterfaceNameForIBGPNeighborTransportIpv4LocalAddress to support BGP neighborship using interface names on specific platforms. It also refactors ISIS interface configuration to use a helper function and includes logic for populating interface-ref. Review feedback identifies a logic error where GetOrCreateInterfaceRef() is called regardless of deviation checks, potentially negating them. Additionally, it was noted that redundant gNMI GET calls for interface names and subinterface indices should be replaced with known values to improve efficiency and portability.

Comment on lines +596 to +598
// Always populate interface-ref with base interface and subinterface index
isisIntf.GetOrCreateInterfaceRef().Interface = ygot.String(baseIntf)
isisIntf.GetOrCreateInterfaceRef().Subinterface = ygot.Uint32(subIdx)
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

This block contains a logic error: calling GetOrCreateInterfaceRef() will recreate the InterfaceRef container even if it was intended to be omitted by the InterfaceRefConfigUnsupported deviation check. This effectively negates the deviation. Ensure that vendor deviations are correctly respected to maintain cross-vendor compatibility.

References
  1. Avoid using dut.Vendor() for vendor-specific logic or configurations in tests. Instead, use the deviations package to maintain test abstraction and portability across different vendors.

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.

Resolved in latest commit.

Comment on lines +573 to +583
baseIntf := gnmi.Get(t, dut, gnmi.OC().Interface(intfName).Name().Config())
subIdx := gnmi.Get(t, dut, gnmi.OC().Interface(baseIntf).Subinterface(0).Index().Config())

isisIntfName := isisInterfaceID(dut, intfName)

isisIntf := isis.GetOrCreateInterface(isisIntfName)
isisIntf.GetOrCreateInterfaceRef().Interface = ygot.String(baseIntf)
isisIntf.GetOrCreateInterfaceRef().Subinterface = ygot.Uint32(subIdx)
if deviations.InterfaceRefConfigUnsupported(dut) {
isisIntf.InterfaceRef = nil
}
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 gNMI GET calls to fetch the interface name and subinterface index are redundant as these values are already known (intfName and 0). Additionally, use the deviations package to handle vendor-specific configuration requirements for interface-ref to maintain test portability across different vendors.

Suggested change
baseIntf := gnmi.Get(t, dut, gnmi.OC().Interface(intfName).Name().Config())
subIdx := gnmi.Get(t, dut, gnmi.OC().Interface(baseIntf).Subinterface(0).Index().Config())
isisIntfName := isisInterfaceID(dut, intfName)
isisIntf := isis.GetOrCreateInterface(isisIntfName)
isisIntf.GetOrCreateInterfaceRef().Interface = ygot.String(baseIntf)
isisIntf.GetOrCreateInterfaceRef().Subinterface = ygot.Uint32(subIdx)
if deviations.InterfaceRefConfigUnsupported(dut) {
isisIntf.InterfaceRef = nil
}
isisIntfName := isisInterfaceID(dut, intfName)
isisIntf := isis.GetOrCreateInterface(isisIntfName)
if !deviations.InterfaceRefConfigUnsupported(dut) {
isisIntf.GetOrCreateInterfaceRef().Interface = ygot.String(intfName)
isisIntf.GetOrCreateInterfaceRef().Subinterface = ygot.Uint32(0)
}
References
  1. Avoid using dut.Vendor() for vendor-specific logic or configurations in tests. Instead, use the deviations package to maintain test abstraction and portability across different vendors.

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.

Agreed and resolved in latest commit.

@karthikeya-remilla karthikeya-remilla requested a review from AmrNJ May 25, 2026 08:36
@karthikeya-remilla
Copy link
Copy Markdown
Contributor

/gemini review

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 a new deviation UseInterfaceNameForIBGPNeighborTransportIpv4LocalAddress to support configuring the BGP neighbor transport local address using an interface name instead of an IPv4 address. It also updates ISIS interface configuration logic to fetch and set interface references. The review comments point out two critical issues: first, a logic bug in verifyISISTelemetry where checking strings.Contains(dutIntf, ".") prevents appending the .0 suffix when the interface name does not already contain a dot; second, an inefficiency in configureISIS where querying the DUT configuration via gNMI for static/known values like the interface name and subinterface index adds unnecessary latency and flakiness.

Comment on lines +632 to +634
if strings.Contains(dutIntf, ".") {
dutIntf = isisInterfaceID(dut, dutIntf)
}
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

There is a logic bug here. The condition strings.Contains(dutIntf, ".") checks if the interface name already contains a dot. If it does NOT contain a dot (e.g., "port8"), the condition is false, and isisInterfaceID is never called. This means the .0 suffix will never be appended when InterfaceRefInterfaceIDFormat is enabled, causing telemetry verification to fail. Since isisInterfaceID already internally checks !strings.Contains(intfName, "."), you should call it directly without the outer if check.

	dutIntf = isisInterfaceID(dut, dutIntf)

Comment on lines +573 to +574
baseIntf := gnmi.Get(t, dut, gnmi.OC().Interface(intfName).Name().Config())
subIdx := gnmi.Get(t, dut, gnmi.OC().Interface(baseIntf).Subinterface(0).Index().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

Querying the DUT configuration via gNMI for static/known values like the interface name and subinterface index is unnecessary and inefficient. It adds round-trip latency and can introduce flakiness if the configuration has not fully converged. Since intfName is already known and the subinterface index is statically 0, you can assign these directly.

Suggested change
baseIntf := gnmi.Get(t, dut, gnmi.OC().Interface(intfName).Name().Config())
subIdx := gnmi.Get(t, dut, gnmi.OC().Interface(baseIntf).Subinterface(0).Index().Config())
baseIntf := intfName
subIdx := uint32(0)

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.

Not applicable with latest commit.

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.

4 participants