bgp: Make the BGP peer name retrievable from GoBGP#44024
Merged
YutaroHayakawa merged 1 commit intomainfrom Jan 29, 2026
Merged
Conversation
ee01c53 to
b511773
Compare
This is a preparation for the upcoming new BGPv2-native CLI and metrics.
In BGPv2, the peer is identified by the explicit name instead of IP
address. The reason for this spec is that makes it easier for users to
identify dynamically discovered peers on CLI or metrics.
However, the CLI and metrics output are based on the information
retrieved from the RouterManager which doesn't have a peer name => peer
IP address correspondence. Having this mapping in the RouterManager is
tricky because the peer discovery is done by the reconcilers.
The solution here is keeping the peer name in the GoBGP's Peer object.
While GoBGP still identifies peer with IP address, we have a Description
field that accepts arbitrary string. We can keep the peer name there.
For the sake of the future extensibility, the name is encoded as a JSON
string. Whenever we want to encode additional metadata, we can introduce
a new JSON field.
The agent API field is extended with name:
```
$ cilium-dbg bgp peer -o json
[
{
"configured-hold-time-seconds": 90,
"configured-keep-alive-time-seconds": 30,
"connect-retry-time-seconds": 120,
"ebgp-multihop-ttl": 1,
"families": [
{
"afi": "ipv6",
"safi": "unicast"
},
{
"afi": "ipv4",
"safi": "unicast"
}
],
...
"name": "peer0",
"peer-address": "10.0.0.1",
"peer-port": 179,
"remote-capabilities": [],
"session-state": "active"
}
]
```
Note that cilium-cli is not yet updated with this change because we will
introduce a completely new CLI output shortly, so it doesn't make sense
to augment the current output with name.
The TestGetPeerStatus test case used to identify peer with IP + ASN.
Change it to leverage this API.
Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
b511773 to
4afed2e
Compare
rastislavs
approved these changes
Jan 27, 2026
Contributor
rastislavs
left a comment
There was a problem hiding this comment.
Neat trick :) Thanks!
Member
|
(removing contributing review, I think it was accidentially requested and the need disappeared in the force push) |
Member
Author
|
/test |
squeed
approved these changes
Jan 29, 2026
21 tasks
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.
This is a preparation for the upcoming new BGPv2-native CLI and metrics.
In BGPv2, the peer is identified by the explicit name instead of IP address. The reason for this spec is that makes it easier for users to identify dynamically discovered peers on CLI or metrics.
However, the CLI and metrics output are based on the information retrieved from the RouterManager which doesn't have a peer name => peer IP address correspondence. Having this mapping in the RouterManager is tricky because the peer discovery is done by the reconcilers.
The solution here is keeping the peer name in the GoBGP's Peer object. While GoBGP still identifies peer with IP address, we have a Description field that accepts arbitrary string. We can keep the peer name there.
For the sake of the future extensibility, the name is encoded as a JSON string. Whenever we want to encode additional metadata, we can introduce a new JSON field.
The agent API field is extended with name:
Note that cilium-cli is not yet updated with this change because we will introduce a completely new CLI output shortly, so it doesn't make sense to augment the current output with name.
The TestGetPeerStatus test case used to identify peer with IP + ASN. Change it to leverage this API.