Skip to content

feat: Extend BGPPeer and enable path modifiers#414

Open
nikatza wants to merge 1 commit into
mainfrom
fix-bpgpeer-localas-behavior
Open

feat: Extend BGPPeer and enable path modifiers#414
nikatza wants to merge 1 commit into
mainfrom
fix-bpgpeer-localas-behavior

Conversation

@nikatza

@nikatza nikatza commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Note: this is a breaking change in the API.

The field LocalASNumber enables a router to appear as a member of another AS in addition to its real AS. Most vendors support mechanisms to specify how the device should use this number. This is, however, not specified in OpenConfig[1].

This commit removes LocalASNumber and adds LocalAS, which specifies the local AS number and how this number factors into eBGP announcements.
Specifically, we add three independent boolean flags:

  • PrependLocalAS: prepend local-as to inbound routes (default: true)
  • PrependGlobalAS: prepend global-as to outbound routes (default: true)
  • AcceptEitherAS: accept connections using either AS (default: false)

We opt to follow the Nokia YANG model [2], as it allows us tocover most of the vendors we checked, i.e., Cisco, Juniper, and Arista. This implies that the provider must ensure that the parameter combinations are valid, and reject them with an apistatus error that the controller can wrap into a TerminalError.

Vendor mappings:

Cisco NX-OS/IOS-XR [3,4]:

  • PrependLocalAS=false → no-prepend
  • PrependLocalAS=false, PrependGlobalAS=false → no-prepend replace-as
  • Above + AcceptEitherAS=true → no-prepend replace-as dual-as

Juniper [5]:

  • PrependLocalAS=false → no-prepend-global-as
  • PrependGlobalAS=false → private
  • AcceptEitherAS=true → alias

Arista [6]:

  • PrependLocalAS=false → no-prepend
  • PrependLocalAS=false, PrependGlobalAS=false → no-prepend replace-as
  • Above + AcceptEitherAS=true → no-prepend replace-as fallback

Nokia SR [7]:

  • PrependLocalAS → prepend-local-as
  • PrependGlobalAS → prepend-global-as
  • AcceptEitherAS → not supported

[1] https://openconfig.net/projects/models/schemadocs/yangdoc/openconfig-network-instance.html#network-instances-network-instance-protocols-protocol-bgp-neighbors-neighbor-config-local-as
[2] https://yangbrowser.nokia.com/srlinux/24.10.7/tree?path=%2Fnetworkinstance%5Bname%3D*%5D%2Fprotocols%2Fbgp%2Fneighbor%5Bpeer-address%3D*%5D%2Flocal-as
[3] https://www.cisco.com/c/en/us/td/docs/dcn/nx-os/nexus9000/106x/configuration/unicast-routing-configuration/cisco-nexus-9000-series-nx-os-unicast-routing-configuration-guide/configuring-bgp.html
[4] https://www.cisco.com/c/en/us/td/docs/routers/asr9000/software/routing/configuration/guide/rcg-asr9000/rcg-bgp.html
[5] https://www.juniper.net/documentation/us/en/software/junos/bgp/topics/ref/statement/local-as-edit-protocols-bgp.html
[6] https://www.arista.com/en/um-eos/eos-border-gateway-protocol-bgp
[7] https://documentation.nokia.com/srlinux/24-10/books/routing-protocols/bgp.html

BREAKING CHANGE: LocalASNumber field removed, replaced with LocalAS
struct containing ASNumber, PrependLocalAS, PrependGlobalAS, and
AcceptEitherAS fields.

@nikatza nikatza force-pushed the fix-bpgpeer-localas-behavior branch 2 times, most recently from c9cef81 to 05ede10 Compare June 19, 2026 16:06
@nikatza nikatza marked this pull request as ready for review June 19, 2026 16:12
@nikatza nikatza requested a review from a team as a code owner June 19, 2026 16:12
@nikatza nikatza marked this pull request as draft June 19, 2026 18:21
@nikatza nikatza force-pushed the fix-bpgpeer-localas-behavior branch 2 times, most recently from b755da1 to a16a41a Compare June 21, 2026 14:17
@nikatza nikatza changed the title feat: Extend BGPPeer with LocalASPropagation feat: Extend BGPPeer and enable path modifiers Jun 21, 2026
@nikatza nikatza force-pushed the fix-bpgpeer-localas-behavior branch 4 times, most recently from e70ac9c to 977e9cf Compare June 21, 2026 21:16
@nikatza nikatza marked this pull request as ready for review June 21, 2026 21:17
@nikatza nikatza force-pushed the fix-bpgpeer-localas-behavior branch from 977e9cf to 60294e0 Compare June 21, 2026 21:26
The field LocalASNumber enables a router to appear as a member of
another AS in addition to its real AS. Most vendors support mechanisms
to specify how the device should use this number. This is, however, not
specified in OpenConfig[1].

This commit removes LocalASNumber and adds LocalAS, which specifies the
local AS number and how this number factors into eBGP announcements.
Specifically, we add three independent boolean flags:
- PrependLocalAS: prepend local-as to inbound routes (default: true)
- PrependGlobalAS: prepend global-as to outbound routes (default: true)
- AcceptEitherAS: accept connections using either AS (default: false)

We opt to follow the Nokia implementation [2,7], as it allows us to
cover most of the vendors we checked, i.e., Cisco, Juniper, and Arista.
This implies that the provider must ensure that the parameter
combinations are valid, and reject them with an apistatus error that the
controller can wrap into a TerminalError.

Vendor mappings:

Cisco NX-OS/IOS-XR [3,4]:
- PrependLocalAS=false → no-prepend
- PrependLocalAS=false, PrependGlobalAS=false → no-prepend replace-as
- Above + AcceptEitherAS=true → no-prepend replace-as dual-as

Juniper [5]:
- PrependLocalAS=false → no-prepend-global-as
- PrependGlobalAS=false → private
- AcceptEitherAS=true → alias

Arista [6]:
- PrependLocalAS=false → no-prepend
- PrependLocalAS=false, PrependGlobalAS=false → no-prepend replace-as
- Above + AcceptEitherAS=true → no-prepend replace-as fallback

Nokia SR Linux [7]:
- PrependLocalAS → prepend-local-as
- PrependGlobalAS → prepend-global-as
- AcceptEitherAS → not supported

[1]
https://openconfig.net/projects/models/schemadocs/yangdoc/openconfig-network-instance.html#network-instances-network-
instance-protocols-protocol-bgp-neighbors-neighbor-config-local-as [2]
https://yangbrowser.nokia.com/srlinux/24.10.7/tree?path=%2Fnetwork-instance%5Bname%3D*%5D%2Fprotocols%2Fbgp%2Fneighbo
r%5Bpeer-address%3D*%5D%2Flocal-as [3]
https://www.cisco.com/c/en/us/td/docs/dcn/nx-os/nexus9000/106x/configuration/unicast-routing-configuration/cisco-nexu
s-9000-series-nx-os-unicast-routing-configuration-guide/configuring-bgp.html
[4]
https://www.cisco.com/c/en/us/td/docs/routers/asr9000/software/routing/configuration/guide/rcg-asr9000/rcg-bgp.html
[5]
https://www.juniper.net/documentation/us/en/software/junos/bgp/topics/ref/statement/local-as-edit-protocols-bgp.html
[6] https://www.arista.com/en/um-eos/eos-border-gateway-protocol-bgp [7]
https://documentation.nokia.com/srlinux/24-10/books/routing-protocols/bgp.html

BREAKING CHANGE: LocalASNumber field removed, replaced with LocalAS
struct containing ASNumber, PrependLocalAS, PrependGlobalAS, and
AcceptEitherAS fields.

Signed-off-by: Pujol <enric.pujol@sap.com>
@nikatza nikatza force-pushed the fix-bpgpeer-localas-behavior branch from 60294e0 to 2a83df8 Compare June 21, 2026 21:28
@github-actions

Copy link
Copy Markdown

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/ironcore-dev/network-operator/api/core/v1alpha1 0.00% (ø)
github.com/ironcore-dev/network-operator/internal/controller/core 63.51% (-0.08%) 👎
github.com/ironcore-dev/network-operator/internal/provider/cisco/iosxr 35.93% (ø)
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos 9.97% (-0.05%) 👎
github.com/ironcore-dev/network-operator/internal/webhook/core/v1alpha1 95.43% (-0.02%) 👎

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/ironcore-dev/network-operator/api/core/v1alpha1/bgp_peer_types.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/core/v1alpha1/zz_generated.deepcopy.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/internal/controller/core/bgp_peer_controller.go 58.07% (ø) 322 187 135
github.com/ironcore-dev/network-operator/internal/provider/cisco/iosxr/provider.go 22.00% (ø) 200 44 156
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos/provider.go 0.06% (-0.00%) 1812 (+13) 1 1811 (+13) 👎
github.com/ironcore-dev/network-operator/internal/webhook/core/v1alpha1/bgppeer_webhook.go 75.00% (-1.92%) 12 (-1) 9 (-1) 3 👎

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

  • github.com/ironcore-dev/network-operator/internal/controller/core/bgp_peer_controller_test.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant