bgp: Introduce bgp/peers Hive Shell command#44067
Merged
YutaroHayakawa merged 5 commits intomainfrom Jan 30, 2026
Merged
Conversation
The current RouterManager.GetPeer and Router.GetPeerState API returns the API model directly. In the new CLI, we will rely on the new internal model we introduced in the previous commit. Since, we still need to keep the legacy output around for a while, mark it as legacy and keep it as is. We'll introduce a new implementation in the subsequent commits. Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
Introduce an equivalent of models.BgpPeer to the types package. This is a preparation for getting rid of the agent API and moving on to the Hive-Script-based implementation. Currently, the RouterManager's GetPeer call directly returns the models.BgpPeer format, but in the Hive-Script-based implementation, we won't rely on the OpenAPI-generated types. Currently, we only define the fields required for implemeting the CLI summary output. For the fields we need for the detailed output or metrics will be added later. Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
Implement a new RouterManager.GetPeers and Router.GetPeers. Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
Introduce a new bgp/peers Hive Script command which will become a
backend of the new `cilium-dbg bgp peers` command. Note that the name is
colliding with the existing command which is only used in the script
test. We will change test side to use the new command in the subsequent
commits.
The new command reflects BGPv2 structure natively. It identifies
instance and peer with the name configured by the user. ASN or IP
address will not be showed in the default output format.
Old CLI output
```
Local AS Peer AS Peer Address Session Uptime Family Received Advertised
65000 65000 172.19.0.1:179 established 22m25s ipv6/unicast 0 0
ipv4/unicast 4 0
65000 65000 172.19.0.200:179 active 0s ipv6/unicast 0 0
ipv4/unicast 0 0
65001 65001 172.19.0.100:179 active 0s ipv6/unicast 0 0
ipv4/unicast 0 0
```
New CLI output
```
Instance Peer Session State Uptime Family Received Accepted Advertised
instance0 peer0 established 22m35s ipv4-unicast 4 4 0
ipv6-unicast 0 0 0
peer1 active - ipv4-unicast - - -
ipv6-unicast - - -
instance1 peer0 active - ipv4-unicast - - -
ipv6-unicast - - -
```
An optional flag --no-uptime hides uptime value. This eliminates any
non-deterministic output and makes script test assertion easier.
Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
Use the new bgp/peers instead of the implementation for tests. Adjust the expected output and use --no-uptime flag. Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
598992f to
3d6cd63
Compare
Member
Author
|
/test |
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 work to renew the current
cilium-dbg bgp peerscommand output to reflect BGPv2 structure better. Introducing bgp/peers Hive Shell command which eventually become a backend of thecilium-dbg bgp peerscommand. Note that this PR doesn't replacecilium-dbg bpf peers. It will be covered in the separate PR. Please review commit-by-commit.