Repository navigation
Add vendor deviations for BGP, static and local-aggregate protocol names - #6311
Verma-Anukul wants to merge 1 commit into
Conversation
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>
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 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
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 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.
Several tests hardcode the protocol instance names in
/network-instances/network-instance/protocols/protocolkeys:"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 lowercasebgp, 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 overstatic_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,NwInstStaticProtoNameandNwInstLocalAggProtoNameare added ininternal/deviations. The hardcoded names infeature/andinternal/now go through them.No behaviour change for existing vendors. Every default equals the value the tests used before, and no vendor's
metadata.textprotosets the new fields. The legacyDefaultBgpInstanceNameaccessor keeps its"DEFAULT"default, and the new field takes precedence overdefault_bgp_instance_nameonly when set.Files:
proto/metadata.protoand the regeneratedproto/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
gofmtand a go/types comparison againstmain, 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.