Repository navigation
Add type-checked static analyzer blocking legacy ATE / IxNetwork APIs - #6315
yatraavaghasia wants to merge 2 commits into
Conversation
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.
Pull Request Functional Test Report for #6315 / 8b036f6Virtual Devices
Hardware Devices
|
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 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
Ignored Files
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 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().
| 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) | ||
| } |
There was a problem hiding this comment.
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.
| 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) | |
| } |
|
@yatraavaghasia thanks, can you verify if these are adding the necessary comments in a dummy PR? |
|
Thanks @navaneethyv! Verified in dummy Draft PR #6323 (adding
|

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.