featureprofiles icon indicating copy to clipboard operation
featureprofiles copied to clipboard

Implement BGP neighbor configuration.

Open ElodinLaarz opened this issue 2 months ago • 4 comments

Verified in https://github.com/openconfig/featureprofiles/pull/4703#issuecomment-3446861126.

===

This pull request introduces several new helper functions and refactors BGP neighbor configuration logic in internal/cfgplugins/bgp.go. The main changes focus on handling vendor-specific deviations, improving multipath configuration, and simplifying neighbor creation for BGP testing. These updates enhance code modularity and make deviation handling more explicit.

Deviation handling and configuration improvements:

  • Added HandleMaxPrefixesDeviation, which updates neighbor max prefixes only if the BGPMissingOCMaxPrefixesConfiguration deviation is set, with logic specific to Arista devices.
  • Implemented handleMultipathDeviation to manage multipath configuration at the AFI/SAFI level, including vendor-specific deviation logic for Juniper devices.

Neighbor creation and validation enhancements:

  • Introduced CreateBGPNeighbors, a helper to create BGP neighbors, peer groups, and global configuration, enforcing that all neighbors have the same local and peer AS numbers.
  • Added sameAS utility to verify that all provided neighbors share the same AS numbers, used by CreateBGPNeighbors.

Refactoring and consistency:

  • Refactored ConfigureBGPNeighbor to use the new parameter name routerID for consistency, replacing routerId. (F8362

ElodinLaarz avatar Oct 25 '25 15:10 ElodinLaarz

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 significantly enhances BGP neighbor configuration by introducing new helper functions and refining existing logic. It focuses on improving vendor-specific deviation handling for max prefixes (Arista) and multipath settings (Juniper), while also simplifying the overall process of creating BGP neighbors and ensuring AS number consistency. These changes contribute to better code modularity and more explicit deviation management within the BGP configuration plugin.

Highlights

  • New Deviation Handling for Max Prefixes: Introduced "HandleMaxPrefixesDeviation" to conditionally update BGP neighbor max prefixes, specifically addressing the "BGPMissingOCMaxPrefixesConfiguration" deviation for Arista devices.
  • Enhanced Multipath Deviation Logic: Implemented "handleMultipathDeviation" to manage multipath configuration at the AFI/SAFI level, including vendor-specific logic for Juniper devices when "MultipathUnsupportedNeighborOrAfisafi" deviation is present.
  • Simplified BGP Neighbor Creation: Added "CreateBGPNeighbors", a new helper function that streamlines the creation of BGP neighbors, peer groups, and global BGP configuration, ensuring consistent local and peer AS numbers across all neighbors.
  • AS Number Validation Utility: Introduced the "sameAS" utility function to verify that all BGP neighbors provided to "CreateBGPNeighbors" share the same local and peer AS numbers, preventing misconfigurations.
  • Refactored ConfigureBGPNeighbor: The "ConfigureBGPNeighbor" function was refactored to use "routerID" instead of "routerId" for its parameter name, improving consistency.
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.

gemini-code-assist[bot] avatar Oct 25 '25 15:10 gemini-code-assist[bot]

Pull Request Functional Test Report for #4750 / 783e85059221122cad581d0d2c8cd360d7c70fbc

No tests identified for validation.

Help

OpenConfigBot avatar Oct 25 '25 15:10 OpenConfigBot

Pull Request Test Coverage Report for Build 19235543450

Details

  • 0 of 120 (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.891%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/cfgplugins/bgp.go 0 120 0.0%
<!-- Total: 0 120
Totals Coverage Status
Change from base Build 19230614204: -0.06%
Covered Lines: 2224
Relevant Lines: 20420

💛 - Coveralls

coveralls avatar Oct 25 '25 16:10 coveralls

/gcbrun

ElodinLaarz avatar Nov 05 '25 18:11 ElodinLaarz