Add ATE advertised routes helper function.
Verified in https://github.com/openconfig/featureprofiles/pull/4703#issuecomment-3446861126.
To be used in https://github.com/openconfig/featureprofiles/pull/4703 and other AFT tests.
===
This pull request introduces a new utility package, internal/cfgplugins/ate.go, to centralize and simplify the configuration of ATE (Automated Test Equipment) devices for network protocol testing. The new code provides reusable functions and types for advertising ISIS and BGP routes, handling default values, and building complete OTG (Open Traffic Generator) configurations for test setups. This abstraction streamlines test code and improves maintainability.
ATE configuration utilities:
- Added the
AdvertisedRoutesandATEAdvertiseRoutestypes to encapsulate route advertisement parameters for ISIS and BGP protocols, including default values and device/port attributes. - Implemented the
AdvertiseBGPRoutesandAdvertiseISISRoutesfunctions to programmatically configure BGP and ISIS route advertisements on ATE devices, supporting both IPv4 and IPv6.
Default handling and configuration orchestration:
- Added logic to automatically set default values for advertised routes when not provided, ensuring robust and predictable test setups.
- Introduced the
ConfigureATEWithISISAndBGPRoutesfunction to build and push a complete OTG configuration, including Ethernet, IP, ISIS, and BGP protocols, with proper route advertisement and protocol startup.
Summary of Changes
Hello @ElodinLaarz, I'm Gemini Code Assist[^1]! 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 enhances the BGP configuration plugin by introducing a dedicated helper function and a corresponding data structure for managing advertised BGP routes. The primary goal is to standardize and simplify the process of configuring BGP route advertisements across both IPv4 and IPv6 interfaces, which will be particularly beneficial for integration into automated feature testing frameworks.
Highlights
- New BGP Advertised Routes Struct: A new
BGPAdvertisedRoutesstruct has been introduced to encapsulate configuration parameters for BGP route advertisement, including starting address, prefix length, route count, and the peer's ATE AS number. - Standardized Route Advertisement Function: A new
AdvertiseRouteshelper function has been added to simplify and standardize the configuration of BGP advertised routes on a device for both IPv4 and IPv6 interfaces, utilizing the newBGPAdvertisedRoutesstruct. - Support for AFT Tests: This new functionality is intended to be used in Automated Feature Test (AFT) scenarios, providing a consistent method for testing BGP route advertisement.
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 :thumbsup: and :thumbsdown: 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.
[^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.
Pull Request Functional Test Report for #4752 / 1e0d5565625c59fa43fcd81abe1e65109ed848f8
No tests identified for validation.
Pull Request Test Coverage Report for Build 19350261569
Details
- 0 of 134 (0.0%) changed or added relevant lines in 1 file are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage decreased (-0.06%) to 10.292%
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
|---|---|---|---|
| internal/otg_helpers/otg_config_helpers/otgrouteadvertise.go | 0 | 134 | 0.0% |
| <!-- | Total: | 0 | 134 |
| Totals | |
|---|---|
| Change from base Build 19349901779: | -0.06% |
| Covered Lines: | 2224 |
| Relevant Lines: | 21610 |
💛 - Coveralls
Nice work Caleb, Can we see this run in a _test.go that uses it? I personally don't like to merge code into featureprofiles that isn't actually used in some test.
Nice work Caleb, Can we see this run in a _test.go that uses it? I personally don't like to merge code into featureprofiles that isn't actually used in some test.
It is tested in https://github.com/openconfig/featureprofiles/pull/4703#issuecomment-3407486994. I split the library changes into individual PRs, but the changes are included and tested there.