TE-16.3 fix#5495
Conversation
Summary of ChangesHello, 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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
| if deviations.ExplicitInterfaceInDefaultVRF(dut) && deviations.InterfaceRefInterfaceIDFormat(dut) { | ||
| dutIntf = dutIntf + ".0" | ||
| } |
There was a problem hiding this comment.
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.
| if deviations.ExplicitInterfaceInDefaultVRF(dut) && deviations.InterfaceRefInterfaceIDFormat(dut) { | |
| dutIntf = dutIntf + ".0" | |
| } | |
| if (deviations.ExplicitInterfaceInDefaultVRF(dut) || deviations.InterfaceRefInterfaceIDFormat(dut)) && !strings.Contains(dutIntf, ".") { | |
| dutIntf = dutIntf + ".0" | |
| } |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Addressed in latest commit.
There was a problem hiding this comment.
This can be true for 2 vendors independently and simultaneously as discussed. Latest commit has a better approach. PTAL
| if dut.Vendor() == ondatra.CISCO { | ||
| localAddressLeaf = loopbackIntfName | ||
| } |
There was a problem hiding this comment.
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
- 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.
There was a problem hiding this comment.
This will be addressed via existing deviation use_interface_name_for_ibgp_neighbor_transport_ipv4_local_address used in related tests.
There was a problem hiding this comment.
Addressed in latest commit.
| } | ||
| if deviations.ExplicitInterfaceInDefaultVRF(dut) || deviations.InterfaceRefInterfaceIDFormat(dut) { | ||
| intfName = intfName + ".0" | ||
| // Parse interface name to extract base interface and subinterface index |
There was a problem hiding this comment.
Addressed in latest commit.
|
/gemini review |
|
Latest changes:
|
There was a problem hiding this comment.
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.
| // Always populate interface-ref with base interface and subinterface index | ||
| isisIntf.GetOrCreateInterfaceRef().Interface = ygot.String(baseIntf) | ||
| isisIntf.GetOrCreateInterfaceRef().Subinterface = ygot.Uint32(subIdx) |
There was a problem hiding this comment.
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
- 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.
There was a problem hiding this comment.
Resolved in latest commit.
| 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 | ||
| } |
There was a problem hiding this comment.
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.
| 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
- 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.
There was a problem hiding this comment.
Agreed and resolved in latest commit.
|
/gemini review |
There was a problem hiding this comment.
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.
| if strings.Contains(dutIntf, ".") { | ||
| dutIntf = isisInterfaceID(dut, dutIntf) | ||
| } |
There was a problem hiding this comment.
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)| baseIntf := gnmi.Get(t, dut, gnmi.OC().Interface(intfName).Name().Config()) | ||
| subIdx := gnmi.Get(t, dut, gnmi.OC().Interface(baseIntf).Subinterface(0).Index().Config()) |
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
Not applicable with latest commit.
Fixes ISIS interface reference configuration and BGP configuration.