Repository navigation
Conversation
nikatza
force-pushed
the
bgp-nexthop-self
branch
from
October 22, 2026 11:44
a387998 to
0bf089f
Compare
nikatza
force-pushed
the
bgp-nexthop-self
branch
5 times, most recently
from
October 23, 2026 17:48
db044a8 to
8fbcb5d
Compare
This commit enables users to configure the next-hop attribute of routes advertised to BGP peers. The scope of this change is southbound connectivity and is currently limited to Cisco NX-OS. OpenConfig models the BGP next hop as an action on a routing policy statement. The action may be conditional and apply only to routes accepted by selected statements. The Kubernetes API follows this OpenConfig model, which does not directly match the NX-OS DME model. NX-OS DME instead exposes `nh-self` as a BGP peer address-family flag. Its scope is broader because it applies to every route advertised for that address family. It is stored in the shared `ctrl` leaf together with controls such as `rr-client`, which must be preserved when next-hop-self is added or removed. To realize the action on NX-OS devices, the controller resolves referenced routing policies and passes them to the provider. The policy name alone is insufficient because NX-OS must inspect its actions when configuring the peer. Routing policies are configured independently and may change after a peer has been realized, so policy generation changes also trigger reconciliation of affected peers. Interpretation of the resolved actions remains the responsibility of each platform-specific provider. The NX-OS provider translates an outbound `Self` action only when every permitted route has the same behavior. It rejects inbound actions, explicit addresses, and mixed policies that cannot be represented without changing their meaning. The OpenConfig and IOS-XR providers return an unsupported-field error instead of silently ignoring the new action. Signed-off-by: Pujol <enric.pujol@sap.com>
Represent BGP peer address-family control as a typed bitmask instead of comparing comma-separated strings. String comparison can cause an unnecessary device update on every reconciliation when the flag order returned by the device differs from the desired order. On NX-OS 10.6(3), the device canonicalizes "rr-client,nh-self" to "nh-self,rr-client" and returns null when no control flags are set. Sorting only the outgoing string still relies on the device returning the same order. Handling unset markers globally in Option.UnmarshalJSON is also unsafe because it changes the meaning of unset values for unrelated NX-OS fields: it would turn unset values into empty values This commit handles unset values locally in the BGP control type. Unit tests verify that flag order does not matter and that both marker and null values are treated as unset. Signed-off-by: Pujol <enric.pujol@sap.com>
nikatza
force-pushed
the
bgp-nexthop-self
branch
from
October 24, 2026 10:36
8fbcb5d to
f4c55e7
Compare
|
Caution No coverage for base commit 66fe5c5 was found, so this report compares against its ancestor b7e7c94 (1 commit earlier) Merging this branch changes the coverage (2 decrease, 5 increase)
Coverage detailsCompared to commit b7e7c94 (run #39940220055)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See commit message for design and implementation details.
Tested with a cisco nxos device: