Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add next-hop-unchanged for BGP #1158

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

dplore
Copy link
Member

@dplore dplore commented Aug 3, 2024

Change Scope

By default BGP changes the next hop of a BGP route to itself when advertising to neighbors. .../afi-safis/afi-safi/.../config/next-hop-unchanged is added to disable this behavior.

This feature is commonly used in combination with BGP based VPN's (RFC4364).

The full paths added are:

/network-instances/network-instance/protocols/protocol/bgp/global/afi-safis/afi-safi/ipv4-unicast/config/next-hop-unchanged
/network-instances/network-instance/protocols/protocol/bgp/global/afi-safis/afi-safi/ipv4-unicast/state/next-hop-unchanged
/network-instances/network-instance/protocols/protocol/bgp/global/afi-safis/afi-safi/ipv6-unicast/config/next-hop-unchanged
/network-instances/network-instance/protocols/protocol/bgp/global/afi-safis/afi-safi/ipv6-unicast/state/next-hop-unchanged
/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/config/next-hop-unchanged
/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/state/next-hop-unchanged
/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/config/next-hop-unchanged
/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/state/next-hop-unchanged
/network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/config/next-hop-unchanged
/network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/state/next-hop-unchanged
/network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/config/next-hop-unchanged
/network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/state/next-hop-unchanged

This change is backwards compatible.

Platform Implementations

@dplore dplore requested a review from a team as a code owner August 3, 2024 00:07
@OpenConfigBot
Copy link

OpenConfigBot commented Aug 3, 2024

No major YANG version changes in commit 06d8d29

Copy link

@LimeHat LimeHat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be configurable with per afi/safi granularity and not tied to multihop.

Nokia ref: https://documentation.nokia.com/sr/24-7/7750-sr/cli-books/classic-cli-command-reference/classic-n-commands.html?hl=next-hop-unchanged#yc23860

Nvidia ref: https://docs.nvidia.com/networking/display/onyxv3104302/bgp+commands#src-132451846_BGPCommands-neighbornext-hop-unchanged

Another Cisco ref that shows per-afi/safi config
https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst3650/software/release/16-12/configuration_guide/rtng/b_1612_rtng_3650_cg/configuring_bgp_next_hop_unchanged.pdf

I know that Arista supports the config like in the above cisco reference as well, just wasn't able to find a public reference immediately.

@dplore dplore changed the title Add preserve-next-hop for ebgp-multihop container Add next-hop-unchanged for BGP Aug 29, 2024
@dplore
Copy link
Member Author

dplore commented Aug 29, 2024

This should be configurable with per afi/safi granularity and not tied to multihop.

Nokia ref: https://documentation.nokia.com/sr/24-7/7750-sr/cli-books/classic-cli-command-reference/classic-n-commands.html?hl=next-hop-unchanged#yc23860

Nvidia ref: https://docs.nvidia.com/networking/display/onyxv3104302/bgp+commands#src-132451846_BGPCommands-neighbornext-hop-unchanged

Another Cisco ref that shows per-afi/safi config https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst3650/software/release/16-12/configuration_guide/rtng/b_1612_rtng_3650_cg/configuring_bgp_next_hop_unchanged.pdf

I know that Arista supports the config like in the above cisco reference as well, just wasn't able to find a public reference immediately.

Moved to afi-safi container. I also renamed the leaf to 'next-hop-unchanged' to align with something much closer to what implementations are already using.

@dplore dplore added the last-call PR that is in final review before merging. label Sep 25, 2024
@robshakir
Copy link
Contributor

This is still inconsistent with how next-hop-self is represented in OpenConfig -- where it is something that is within a policy not a leaf. I don't agree with this proposal unless we have a coherent approach within the models.

Note that implementations would already a need to be mapping the current approach to underlying config -- so either this is implemented (and thus can be extended), or unimplementable (and thus the current n-h-s approach should be deprecated).

Copy link
Contributor

@robshakir robshakir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes to make this consistent with next-hop self in the models.

@dplore
Copy link
Member Author

dplore commented Jan 3, 2025

Requesting changes to make this consistent with next-hop self in the models.

Sorry I do not understand the issue. Could you provide an example of how BGP next-hop-self is represented in openconfig? Maybe that will be enough for me to understand how to propose something that enable/disables that. But if you have a suggestion in mind, I'd also be happy to see that too.

One idea is that you're referring to the typedef bgp-next-hop-type used in /routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/config/set-next-hop.

Are you saying that it's better to define next-hop-unchanged within each policy rather than at the afi/safi level?

@robshakir
Copy link
Contributor

Next-hop self is specified through:

  1. (/routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/config/set-next-hop)[https://openconfig.net/projects/models/schemadocs/yangdoc/openconfig-routing-policy.html#routing-policy-policy-definitions-policy-definition-statements-statement-actions-bgp-actions-config-set-next-hop]
  2. (bgp-next-hop-type)[https://openconfig.net/projects/models/schemadocs/yangdoc/openconfig-routing-policy.html#type-bgp-next-hop-type] enum values -- i.e., SELF here.

We have discussed this numerous times over the years -- since some implementations have this in config not policy, I'm not understanding why we would have one thing (n-h-s) be via policy and another (unchanged) be in neighbour config.

@dplore
Copy link
Member Author

dplore commented Jan 7, 2025

Next-hop self is specified through:

  1. (/routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/config/set-next-hop)[https://openconfig.net/projects/models/schemadocs/yangdoc/openconfig-routing-policy.html#routing-policy-policy-definitions-policy-definition-statements-statement-actions-bgp-actions-config-set-next-hop]
  2. (bgp-next-hop-type)[https://openconfig.net/projects/models/schemadocs/yangdoc/openconfig-routing-policy.html#type-bgp-next-hop-type] enum values -- i.e., SELF here.

We have discussed this numerous times over the years -- since some implementations have this in config not policy, I'm not understanding why we would have one thing (n-h-s) be via policy and another (unchanged) be in neighbour config.

Ah ok, I understand the reason and goal here. But the semantics are different from the 100% of all the precedent that I can find (I spent a lot more time search and found a total of 6 references below, all of which have distinct configuration for this and apply on a per session basis).

Is there an operational reason to need to craft policies to selectively choose which routes would cause next-hop self to be unchanged? The operational use cases I know of are both the classic scenario of override RFC4271 behavior: EVPN and an internal one at Google. The Google use case is for R1 to learn multi-path routes from an eBGP neighbor R2 and we want R1 to retain the next-hops/multipath information when sending the routes to iBGP peer R3.

I appreciate that it is elegant to have 'things related to next-hop-self' in the same subtree, but from a standpoint of precedent and ability to easily translate existing bgp policies into openconfig, applying on a per session is very straightforward. If we apply via policy, then I guess it's just adding another statement with no condition and an action next-hop-unchanged. Implementations however will have to parse the logic in context of routing-policy. This will be be an issue if there are statement/conditions defined, which is something we aren't asking for and implementations don't offer (to my knowledge).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
last-call PR that is in final review before merging. non-breaking
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

4 participants