Skip to content

Add type-checked static analyzer blocking legacy ATE / IxNetwork APIs - #6315

Open
yatraavaghasia wants to merge 2 commits into
openconfig:mainfrom
yatraavaghasia:block-legacy-ixnetwork
Open

yatraavaghasia wants to merge 2 commits into
openconfig:mainfrom
yatraavaghasia:block-legacy-ixnetwork

Conversation

@yatraavaghasia

Copy link
Copy Markdown

Add tools/legacyatecheck, a stdlib-only Go static analyzer using go/types to detect and reject deprecated Ondatra legacy ATE and IxNetwork APIs (ate.Topology, ate.Traffic, ate.Actions, legacy ondatra packet header/flow/topology symbols, DialIxNetwork, and ondatra/ixnet or ondatra/binding/ixweb imports) across all packages and tests while exempting topologies/binding.

Also remove the remaining unused legacy ATE calls and dead helpers in bgp_scale_test.go, internal/gnmi/setup/setup.go, and internal/attrs/attrs.go, wire legacyatecheck into GitHub Actions static analysis workflows, and document the ban in .gemini/styleguide.md.

Add tools/legacyatecheck, a stdlib-only Go static analyzer using go/types to detect and reject deprecated Ondatra legacy ATE and IxNetwork APIs (ate.Topology, ate.Traffic, ate.Actions, legacy ondatra packet header/flow/topology symbols, DialIxNetwork, and ondatra/ixnet or ondatra/binding/ixweb imports) across all packages and tests while exempting topologies/binding.

Also remove the remaining unused legacy ATE calls and dead helpers in bgp_scale_test.go, internal/gnmi/setup/setup.go, and internal/attrs/attrs.go, wire legacyatecheck into GitHub Actions static analysis workflows, and document the ban in .gemini/styleguide.md.
@OpenConfigBot

OpenConfigBot commented Nov 23, 2026 •

Copy link
Copy Markdown

Pull Request Functional Test Report for #6315 / 8b036f6

Virtual Devices

Device Test Status Test Documentation Job Raw Log
Arista cEOS status
RT-1.65: pending authorization
RT-1.65: BGP scale test
Cisco 8000E status
RT-1.65: pending authorization
RT-1.65: BGP scale test
Cisco XRd status
RT-1.65: pending authorization
RT-1.65: BGP scale test
Juniper ncPTX status
RT-1.65: pending authorization
RT-1.65: BGP scale test
Nokia SR Linux status
RT-1.65: pending authorization
RT-1.65: BGP scale test
Openconfig Lemming status
RT-1.65: pending authorization
RT-1.65: BGP scale test

Hardware Devices

Device Test Status Test Documentation Raw Log
Arista status
RT-1.65: pending authorization
RT-1.65: BGP scale test
Cisco status
RT-1.65: pending authorization
RT-1.65: BGP scale test
Juniper status
RT-1.65: pending authorization
RT-1.65: BGP scale test
Nokia status
RT-1.65: pending authorization
RT-1.65: BGP scale test

Help

@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 introduces a new static analysis tool designed to enforce the migration from legacy Ondatra ATE and IxNetwork APIs to the modern Open Traffic Generator (OTG) API. By providing a type-checked analyzer, the PR ensures that deprecated symbols and imports are flagged during development, while simultaneously cleaning up existing legacy code in several key files to align with the new standards.

Highlights

  • New Static Analysis Tool: Introduced tools/legacyatecheck, a Go-based static analyzer that detects and blocks the use of deprecated Ondatra legacy ATE and IxNetwork APIs.
  • Code Cleanup: Removed redundant legacy ATE calls and dead helper functions from bgp_scale_test.go, internal/gnmi/setup/setup.go, and internal/attrs/attrs.go.
  • CI Integration: Integrated the new static analysis tool into GitHub Actions workflows to enforce the deprecation policy.
Ignored Files
  • Ignored by pattern: .gemini/** (1)
    • .gemini/styleguide.md
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/go-arm.yml
    • .github/workflows/go.yml
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. ↩

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

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.

Code Review

This pull request removes deprecated Ondatra legacy ATE topology configurations across tests and helper libraries, and introduces a new static analyzer tool, legacyatecheck, to prevent future usage of deprecated Ondatra legacy ATE and IxNetwork APIs in favor of the Open Traffic Generator (OTG) API. Feedback on the pull request highlights a potential deadlock issue in the analyzer's package loading logic when a decoding error occurs before the child process finishes, suggesting explicitly killing the process before calling cmd.Wait().

Comment on lines +363 to +369
if err := dec.Decode(&p); err != nil {
if errors.Is(err, io.EOF) {
break
}
_ = cmd.Wait()
return nil, fmt.Errorf("decoding go list output: %w", err)
}

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

If dec.Decode fails before the child process finishes, calling cmd.Wait() directly can cause a deadlock. This happens because the child process might still be running and blocked on writing to the stdout pipe (which is no longer being read), while cmd.Wait() blocks indefinitely waiting for the child process to exit.

To prevent this deadlock, explicitly kill the process using cmd.Process.Kill() before calling cmd.Wait() when aborting due to a decoding error.

Suggested change
if err := dec.Decode(&p); err != nil {
if errors.Is(err, io.EOF) {
break
}
_ = cmd.Wait()
return nil, fmt.Errorf("decoding go list output: %w", err)
}
if err := dec.Decode(&p); err != nil {
if errors.Is(err, io.EOF) {
break
}
if cmd.Process != nil {
_ = cmd.Process.Kill()
}
_ = cmd.Wait()
return nil, fmt.Errorf("decoding go list output: %w", err)
}

@navaneethyv

Copy link
Copy Markdown
Contributor

@yatraavaghasia thanks, can you verify if these are adding the necessary comments in a dummy PR?

@yatraavaghasia

Copy link
Copy Markdown
Author

Thanks @navaneethyv! Verified in dummy Draft PR #6323 (adding ate.Topology().New(), ate.Traffic().NewFlow(...), ondatra.NewEthernetHeader(), and ondatra.NewIPv4Header() in feature/example/tests/topology_test/topology_test.go):

  1. Deterministic CI check & inline PR annotations (Static Analysis (ARM64) / legacyatecheck):
    - Build (ARM64) and the legacy path-only OTG Changes Required check passed, while Static Analysis (ARM64) failed the PR as expected and posted inline error annotations directly on lines 169 and 171 of the diff:
    - Failing CI run & annotations: https://github.com/openconfig/featureprofiles/actions/runs/45337865143/job/138254120390
    - Inline diff annotations: https://github.com/openconfig/featureprofiles/pull/6323/files

  2. Gemini Code Assist (.gemini/styleguide.md):
    - Gemini Code Assist loads .gemini/styleguide.md from the base branch (main), so its AI review comments for this new rule will take effect once this PR merges into main

Screenshot 2026-11-24 at 6 07 04 PM

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants