Skip to content

Add vendor deviations for BGP, static and local-aggregate protocol names - #6311

Open
Verma-Anukul wants to merge 1 commit into
openconfig:mainfrom
Verma-Anukul:nw_inst_proto_custom_name
Open

Verma-Anukul wants to merge 1 commit into
openconfig:mainfrom
Verma-Anukul:nw_inst_proto_custom_name

Conversation

@Verma-Anukul

@Verma-Anukul Verma-Anukul commented Nov 21, 2026 •

Copy link
Copy Markdown

Several tests hardcode the protocol instance names in
/network-instances/network-instance/protocols/protocol keys: "BGP" for BGP, "DEFAULT" for static, and each test's own name for LOCAL_AGGREGATE. Some devices only accept a different fixed name. For example, Cisco SONiC accepts only lowercase bgp, so tests fail there with "only 'bgp' is supported".

This PR adds three vendor deviations so the name can be set per device in metadata.textproto:

  • nw_inst_bgp_proto_name (491): BGP protocol instance name, default "BGP".
  • nw_inst_static_proto_name (492): static protocol instance name, default "DEFAULT". Takes precedence over static_protocol_name.
  • nw_inst_local_agg_proto_name (490): LOCAL_AGGREGATE protocol instance name. Default is the name each caller passes in, so existing tests keep their current names.

Accessors NwInstBgpProtoName, NwInstStaticProtoName and NwInstLocalAggProtoName are added in internal/deviations. The hardcoded names in feature/ and internal/ now go through them.

No behaviour change for existing vendors. Every default equals the value the tests used before, and no vendor's metadata.textproto sets the new fields. The legacy DefaultBgpInstanceName accessor keeps its "DEFAULT" default, and the new field takes precedence over default_bgp_instance_name only when set.

Files: proto/metadata.proto and the regenerated proto/metadata_go_proto/metadata.pb.go (fields 490-492), internal/deviations/deviations.go, and about 85 test and helper files that use the accessors.

Testing: This was edited and checked with gofmt and a go/types comparison against main, which showed no new type errors. The module could not be built or run in my offline environment, so CI is the first full build. Device validation on SONiC is still pending.

Several tests hardcode the protocol instance names used in
/network-instances/network-instance/protocols/protocol keys ("BGP" for
BGP, "DEFAULT" for static and each test's own local-aggregate name).
Some devices only accept a different fixed name, for example lowercase
"bgp" on Cisco SONiC.

Add three metadata deviations so the name can be overridden per device
without changing any other vendor's behaviour:

- nw_inst_bgp_proto_name: BGP protocol instance name, default "BGP".
  When set it also takes precedence over default_bgp_instance_name in
  the legacy DefaultBgpInstanceName accessor.
- nw_inst_static_proto_name: static protocol instance name, default
  "DEFAULT". Takes precedence over static_protocol_name when set.
- nw_inst_local_agg_proto_name: LOCAL_AGGREGATE protocol instance name.
  The default is the name each caller passes in, so existing tests keep
  their current names.

Add accessors NwInstBgpProtoName, NwInstStaticProtoName and
NwInstLocalAggProtoName in internal/deviations and use them in place of
the hardcoded names across feature/ and internal/. Defaults match the
values the tests used before, so no vendor configuration changes unless
it sets one of the new fields.

metadata.proto and the regenerated metadata.pb.go add fields 490-492.

Signed-off-by: Verma-Anukul <anukulverma2013@gmail.com>
@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 enhances the test infrastructure by introducing metadata-driven deviations for BGP, static, and local-aggregate protocol instance names. This allows tests to accommodate devices that require specific, non-standard protocol names (e.g., lowercase 'bgp' on Cisco SONiC) without impacting other vendors. The changes involve updating the metadata schema and refactoring existing tests to use new accessors, ensuring consistent and configurable protocol naming across the test suite.

Highlights

  • Vendor Deviations for Protocol Names: Introduced three new metadata deviations (nw_inst_bgp_proto_name, nw_inst_static_proto_name, nw_inst_local_agg_proto_name) to allow overriding default protocol instance names per device.
  • Updated Accessors: Added new accessors in internal/deviations to retrieve these protocol names, ensuring vendor-specific overrides are respected.
  • Refactored Tests: Updated numerous test files across feature/ and internal/ directories to use the new accessors instead of hardcoded protocol names like 'BGP' or 'DEFAULT'.
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 introduces new deviations (nw_inst_bgp_proto_name, nw_inst_static_proto_name, and nw_inst_local_agg_proto_name) to allow overriding the default protocol instance names for BGP, static routing, and local aggregates within network instances. It updates the metadata protobuf definitions, adds corresponding helper functions in the deviations package, and refactors numerous test files and configuration plugins to use these new helpers instead of hardcoded strings like 'BGP' or 'DEFAULT'. This change enables compatibility with platforms that require specific fixed protocol names, such as Cisco SONiC. No review comments were provided, so there is no additional feedback to address.

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.

1 participant