Skip to content

bgp: Introduce bgp/peers Hive Shell command#44067

Merged
YutaroHayakawa merged 5 commits intomainfrom
yutaro/bgpv2-cli-peers
Jan 30, 2026
Merged

bgp: Introduce bgp/peers Hive Shell command#44067
YutaroHayakawa merged 5 commits intomainfrom
yutaro/bgpv2-cli-peers

Conversation

@YutaroHayakawa
Copy link
Copy Markdown
Member

@YutaroHayakawa YutaroHayakawa commented Jan 30, 2026

This is a preparation work to renew the current cilium-dbg bgp peers command output to reflect BGPv2 structure better. Introducing bgp/peers Hive Shell command which eventually become a backend of the cilium-dbg bgp peers command. Note that this PR doesn't replace cilium-dbg bpf peers. It will be covered in the separate PR. Please review commit-by-commit.

bgp: Introduce bgp/peers Hive Shell command

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>
@YutaroHayakawa YutaroHayakawa requested a review from a team as a code owner January 30, 2026 00:13
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jan 30, 2026
@YutaroHayakawa YutaroHayakawa added the release-note/misc This PR makes changes that have no direct user impact. label Jan 30, 2026
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jan 30, 2026
@YutaroHayakawa YutaroHayakawa changed the title bgp: Introduce bgp/peer Hive Shell command bgp: Introduce bgp/peers Hive Shell command Jan 30, 2026
@YutaroHayakawa YutaroHayakawa marked this pull request as draft January 30, 2026 00:34
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>
@YutaroHayakawa
Copy link
Copy Markdown
Member Author

/test

@YutaroHayakawa YutaroHayakawa marked this pull request as ready for review January 30, 2026 07:26
Copy link
Copy Markdown
Contributor

@rastislavs rastislavs left a comment

Choose a reason for hiding this comment

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

Very nice, thanks!

@YutaroHayakawa YutaroHayakawa added this pull request to the merge queue Jan 30, 2026
Merged via the queue into main with commit 26d721f Jan 30, 2026
484 of 486 checks passed
@YutaroHayakawa YutaroHayakawa deleted the yutaro/bgpv2-cli-peers branch January 30, 2026 19:10
@maintainer-s-little-helper maintainer-s-little-helper bot added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. labels Jan 30, 2026
@YutaroHayakawa YutaroHayakawa added the needs-backport/1.19 This PR / issue needs backporting to the v1.19 branch label Feb 19, 2026
@YutaroHayakawa YutaroHayakawa mentioned this pull request Feb 24, 2026
21 tasks
@YutaroHayakawa YutaroHayakawa added backport-pending/1.19 The backport for Cilium 1.19.x for this PR is in progress. and removed needs-backport/1.19 This PR / issue needs backporting to the v1.19 branch labels Feb 24, 2026
@github-actions github-actions bot added backport-done/1.19 The backport for Cilium 1.19.x for this PR is done. and removed backport-pending/1.19 The backport for Cilium 1.19.x for this PR is in progress. labels Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-done/1.19 The backport for Cilium 1.19.x for this PR is done. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants