Skip to content

Fix for Tun-1.4#5209

Open
AishwaryaSKulakrni wants to merge 1 commit intoopenconfig:mainfrom
b4firex:Tun-1.4-fix
Open

Fix for Tun-1.4#5209
AishwaryaSKulakrni wants to merge 1 commit intoopenconfig:mainfrom
b4firex:Tun-1.4-fix

Conversation

@AishwaryaSKulakrni
Copy link

  1. Brief description and need for this PR
  • TUN-1.4 for interface-based IPv6 GRE encapsulation was not runnable on Cisco when tunnel OC config/state paths are unsupported.
  • After enabling Cisco deviations, the test still failed due to missing Cisco tunnel endpoint programming logic and overly rigid ECMP validation assumptions.
  • This PR adds Cisco-specific tunnel configuration handling and stabilizes ECMP verification so the test validates real forwarding behavior instead of failing on platform/runtime variance.
  1. Proposed changes
  • Added Cisco deviation for TUN-1.4 in
    tunnel_state_path_unsupported = true
    tunnel_config_path_unsupported = true
    This enables Cisco to use deviation-aware paths in this test.

  • Updated Cisco tunnel endpoint programming path in
    Added explicit Cisco branch in configureTunnelInterface.
    Added hard failure if generated CLI config is empty.

  • Added Cisco CLI generator in
    Uses interface tunnel-ipN
    Configures GRE IPv6 encapsulation mode, loopback source, destination, and tunnel IPv6 address.
    This fixed prior CLI syntax/semantic issues seen on Cisco runs.

  • Network-instance setup was normalized via helper in
    Use fptest.ConfigureDefaultNetworkInstance to avoid per-platform NI inconsistencies.

  • ECMP validation logic was made robust in
    Keeps formula-based expected total for observability/logging.
    Uses observed egress deltas as authoritative total for per-link balance checks.
    Adds zero-observed guard and undercount guard using minObservedTotalRatioPct.
    Retains tolerance-window validation per link.

  • Added new threshold constant in
    minObservedTotalRatioPct = 80
    Prevents silent pass when DUT egress is unexpectedly low versus formula expectation

@AishwaryaSKulakrni AishwaryaSKulakrni requested a review from a team as a code owner March 10, 2026 08:33
@google-cla
Copy link

google-cla bot commented Mar 10, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@OpenConfigBot
Copy link

Pull Request Functional Test Report for #5209 / afc221b

Virtual Devices

Device Test Test Documentation Job Raw Log
Arista cEOS status
TUN-1.4: Interface based IPv6 GRE Encapsulation
Cisco 8000E status
TUN-1.4: Interface based IPv6 GRE Encapsulation
Cisco XRd status
TUN-1.4: Interface based IPv6 GRE Encapsulation
Juniper ncPTX status
TUN-1.4: Interface based IPv6 GRE Encapsulation
Nokia SR Linux status
TUN-1.4: Interface based IPv6 GRE Encapsulation
Openconfig Lemming status
TUN-1.4: Interface based IPv6 GRE Encapsulation

Hardware Devices

Device Test Test Documentation Raw Log
Arista 7808 status
TUN-1.4: Interface based IPv6 GRE Encapsulation
Cisco 8808 status
TUN-1.4: Interface based IPv6 GRE Encapsulation
Juniper PTX10008 status
TUN-1.4: Interface based IPv6 GRE Encapsulation
Nokia 7250 IXR-10e status
TUN-1.4: Interface based IPv6 GRE Encapsulation

Help

@gemini-code-assist
Copy link
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 resolves critical issues preventing the TUN-1.4 interface-based IPv6 GRE encapsulation test from running successfully on Cisco devices. It integrates Cisco-specific tunnel configuration logic, standardizes network instance setup, and significantly improves the reliability of ECMP load balancing validation, ensuring the test accurately reflects forwarding behavior rather than failing due to platform variations.

Highlights

  • Cisco Deviations Added: Introduced Cisco-specific deviations for tunnel_state_path_unsupported and tunnel_config_path_unsupported in the test metadata to enable platform-aware test execution.
  • Cisco Tunnel Endpoint Programming: Implemented an explicit Cisco branch within configureTunnelInterface to handle Cisco-specific tunnel configurations and added a safeguard to fail if the generated CLI configuration is empty.
  • Cisco CLI Generator: Created configureTunnelEndPointsCisco to generate correct Cisco CLI for GRE IPv6 encapsulation, addressing previous syntax and semantic issues.
  • Normalized Network Instance Setup: Standardized network instance configuration across platforms by utilizing fptest.ConfigureDefaultNetworkInstance.
  • Robust ECMP Validation Logic: Enhanced verifyEcmpLoadBalance to use observed egress deltas as the authoritative total for per-link balance checks, incorporating guards for zero-observed packets and undercounts, while maintaining tolerance-window validation.
  • New Threshold Constant: Added minObservedTotalRatioPct = 80 to prevent tests from silently passing when the Device Under Test (DUT) egress traffic is unexpectedly low compared to the expected formula.
Changelog
  • feature/tunnel/otg_tests/tunnel_interface_based_ipv6_gre_encapsulation_test/metadata.textproto
    • Added Cisco platform exceptions for tunnel_state_path_unsupported and tunnel_config_path_unsupported.
  • feature/tunnel/otg_tests/tunnel_interface_based_ipv6_gre_encapsulation_test/tunnel_interface_based_ipv6_gre_encapsulation_test.go
    • Defined minObservedTotalRatioPct constant for egress undercount checks.
    • Modified configureTunnelInterface to include Cisco-specific tunnel endpoint configuration and added a check for empty generated CLI.
    • Implemented configureTunnelEndPointsCisco to generate Cisco CLI for GRE IPv6 tunnels.
    • Updated configureNetworkInstance to use fptest.ConfigureDefaultNetworkInstance for consistent network instance setup.
    • Refactored verifyEcmpLoadBalance to improve robustness, including input validation, safe delta calculation, total observed packet calculation, egress undercount check, and refined per-link balance checks.
    • Updated verifyUnusedTunnelStatistic to use consistent parameter names.
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.

Copy link
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 support for Cisco devices in the TUN-1.4 test case by adding necessary deviations and a vendor-specific CLI configuration function for GRE tunnels. A key improvement is the complete rewrite of the ECMP load-balancing validation logic, making it significantly more robust by basing calculations on observed traffic and adding better input validation and undercount checks. The changes are well-aligned with the description and substantially improve the test's reliability. I have one minor suggestion to improve code consistency, and the use of t.Fatalf in the suggested code is consistent with our guidelines for critical test failures.

Comment on lines 373 to +382
switch dut.Vendor() {
case ondatra.JUNIPER:
config = configureTunnelEndPoints(intf, unit, tunnelSrc, tunnelDst, tunnelIpv6address, Ipv6Mask)
case ondatra.CISCO:
config = configureTunnelEndPointsCisco(intf, unit, tunnelDst, tunnelIpv6address, Ipv6Mask)
t.Logf("Push the CLI config:\n%s", config)

default:
t.Errorf("Invalid Tunnel endpoint configuration")
t.Fatalf("Tunnel endpoint configuration is not defined for %s", dut.Vendor())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For better consistency and to avoid duplicating the logging statement if more vendors are added, consider moving the t.Logf call to after the switch statement. This ensures that the generated config is logged for any vendor that provides one, without needing to add the log line in each case.

	switch dut.Vendor() {
	case ondatra.JUNIPER:
		config = configureTunnelEndPoints(intf, unit, tunnelSrc, tunnelDst, tunnelIpv6address, Ipv6Mask)
	case ondatra.CISCO:
		config = configureTunnelEndPointsCisco(intf, unit, tunnelDst, tunnelIpv6address, Ipv6Mask)
	default:
		t.Fatalf("Tunnel endpoint configuration is not defined for %s", dut.Vendor())
	}
	t.Logf("Push the CLI config for %s:\n%s", dut.Vendor(), config)
References
  1. Using t.Fatalf in the default case for an unsupported vendor configuration is appropriate as it represents a critical setup failure, aligning with rules that allow t.Fatal for critical components or processes not found (Rules 2 and 3).

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