Skip to content

[Nexthop] [fboss2-dev] Add BGP CLI show commands and tests#1039

Closed
manoharan-nexthop wants to merge 2 commits into
facebook:mainfrom
nexthop-ai:manoharan.bgp-show
Closed

[Nexthop] [fboss2-dev] Add BGP CLI show commands and tests#1039
manoharan-nexthop wants to merge 2 commits into
facebook:mainfrom
nexthop-ai:manoharan.bgp-show

Conversation

@manoharan-nexthop

Copy link
Copy Markdown
Contributor

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

Adds BGP CLI show commands for the fboss2 CLI tool. These commands provide visibility into BGP state, configuration, routes, neighbors, and statistics.

BGP Show Commands Added:

Core Commands:

  • show bgp summary - Display BGP session summary
  • show bgp summary egress - Display egress BGP summary
  • show bgp neighbors - Show BGP neighbor information
  • show bgp table - Display BGP routing table
  • show bgp table - Show specific prefix details
  • show bgp table detail - Show detailed routing table
  • show bgp table community - Filter by community
  • show bgp table more-specifics - Show more specific routes
  • show bgp originated-routes - Display originated routes
  • show bgp shadowrib - Show shadow RIB entries
  • show bgp changelist - Display BGP changelist
  • show version bgp - Show BGP version information

Configuration Commands:

  • show config running bgp - Display running BGP configuration

Neighbor Route Commands:

  • show bgp neighbors received pre-policy - Routes received before policy
  • show bgp neighbors received post-policy - Routes received after policy
  • show bgp neighbors received rejected - Rejected received routes
  • show bgp neighbors advertised pre-policy - Routes to advertise before policy
  • show bgp neighbors advertised post-policy - Routes advertised after policy
  • show bgp neighbors advertised rejected - Rejected advertised routes
  • show bgp neighbors advertised dry-run - Dry-run advertised routes
  • show bgp neighbors session-id - Display session ID

Statistics Commands:

  • show bgp stats entries - Display BGP entry statistics
  • show bgp stats policy - Show BGP policy statistics
  • show bgp stats attrs - Display BGP attribute statistics

Stream Commands:

  • show bgp stream summary - Display BGP stream summary
  • show bgp stream subscriber - Show stream subscribers
  • show bgp stream subscriber pre-policy - Pre-policy stream subscribers
  • show bgp stream subscriber post-policy - Post-policy stream subscribers

Implementation Details:

Command Handler:

  • CmdHandlerImplBgp.cpp - BGP command handler implementation
  • CmdList.cpp - Updated to register BGP commands

Utilities:

  • CmdShowUtils.cpp/h - Common utilities for BGP show commands
  • CmdClientUtils.cpp/h - Client utilities for BGP service communication
  • CmdUtilsCommon.cpp - Common command utilities
  • NetTools.h - Network utility functions

Tests (22 test files):

  • CmdShowBgpSummaryTest.cpp
  • CmdShowBgpSummaryEgressTest.cpp
  • CmdShowBgpNeighborsTest.cpp
  • CmdShowBgpTableTest.cpp
  • CmdShowBgpTablePrefixTest.cpp
  • CmdShowBgpTableDetailTest.cpp
  • CmdShowBgpTableCommunityTest.cpp
  • CmdShowBgpTableMoreSpecificsTest.cpp
  • CmdShowBgpOriginatedRoutesTest.cpp
  • CmdShowBgpShadowRibTest.cpp
  • CmdShowBgpChangelistTest.cpp
  • CmdShowBgpNeighborsReceivedPrePolicyTest.cpp
  • CmdShowBgpNeighborsReceivedPostPolicyTest.cpp
  • CmdShowBgpNeighborsReceivedRejectedTest.cpp
  • CmdShowBgpNeighborsAdvertisedPrePolicyTest.cpp
  • CmdShowBgpNeighborsAdvertisedPostPolicyTest.cpp
  • CmdShowBgpNeighborsAdvertisedRejectedTest.cpp
  • CmdShowBgpStatsEntriesTest.cpp
  • CmdShowBgpStatsPolicyTest.cpp
  • CmdShowBgpStatsAttrsTest.cpp
  • CmdShowBgpStreamSummaryTest.cpp
  • CmdShowBgpStreamSubscriberTest.cpp

Test Infrastructure:

  • CmdBgpTestUtils.cpp/h - BGP test utilities
  • MockBgpClient.h - Mock BGP client for testing
  • CmdHandlerTestBase.h - Base class for command handler tests
  • MockClients.h - Mock client implementations
  • CmdShowConfigTestUtils.cpp/h - Configuration test utilities
  • BgpConfigSessionTest.cpp - BGP configuration session tests

Build System Updates:

  • cmake/CliFboss2.cmake - Added BGP command sources
  • cmake/CliFboss2Test.cmake - Added BGP test sources

Test Plan

All the CLI unit tests passes.

@manoharan-nexthop manoharan-nexthop requested review from a team as code owners March 26, 2026 18:31
@meta-cla meta-cla Bot added the CLA Signed label Mar 26, 2026
@manoharan-nexthop manoharan-nexthop force-pushed the manoharan.bgp-show branch 2 times, most recently from 10dcdb2 to 5b087e9 Compare March 26, 2026 20:32
@manoharan-nexthop manoharan-nexthop force-pushed the manoharan.bgp-show branch 4 times, most recently from 9262a08 to 83e2d58 Compare May 1, 2026 05:22
@manoharan-nexthop manoharan-nexthop force-pushed the manoharan.bgp-show branch 2 times, most recently from 128f228 to 61ac3e3 Compare May 7, 2026 14:25
@induvsuresh

Copy link
Copy Markdown
Contributor

bgp_thrift.thrift and policy_thrift.thrift have been published already, could we remove from the current PR?

@manoharan-nexthop manoharan-nexthop force-pushed the manoharan.bgp-show branch 2 times, most recently from a7df529 to 77f2cbd Compare May 8, 2026 08:27
@manoharan-nexthop

Copy link
Copy Markdown
Contributor Author

bgp_thrift.thrift and policy_thrift.thrift have been published already, could we remove from the current PR?

@induvsuresh , This has been updated.. please let me know if anything else to be changed. Thanks!

@induvsuresh induvsuresh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for the working on this! the test changes, cmake are going to be super useful and it is very thorough

I've left some comments that are blockers for merge , eg: the buck changes etc, could we address that for merge pls

Comment thread fboss/cli/fboss2/BUCK
Comment thread fboss/cli/fboss2/test/MockClients.h Outdated
Comment thread fboss/cli/fboss2/commands/show/hardware/CmdShowHardware.cpp Outdated
Comment thread fboss/cli/fboss2/BUCK
Comment thread fboss/cli/fboss2/oss/NetTools.h Outdated
Comment thread fboss/cli/fboss2/commands/show/bgp/CmdShowBgpOriginatedRoutes.h Outdated
Comment thread fboss/cli/fboss2/test/CmdBgpTestUtils.cpp Outdated
Comment thread fboss/cli/fboss2/test/bgp/MockBgpClient.h Outdated
@manoharan-nexthop manoharan-nexthop force-pushed the manoharan.bgp-show branch 5 times, most recently from 496831c to e74db48 Compare May 20, 2026 12:45
Comment thread fboss/cli/fboss2/BUCK Outdated
@manoharan-nexthop manoharan-nexthop force-pushed the manoharan.bgp-show branch 3 times, most recently from d246ad3 to 66004b8 Compare May 28, 2026 00:06
Comment thread fboss/cli/fboss2/BUCK Outdated
Comment thread fboss/cli/fboss2/CmdHandlerImplBgp.cpp
Comment thread fboss/cli/fboss2/BUCK
Comment thread fboss/cli/fboss2/commands/show/bgp/CmdShowUtils.cpp Outdated
Comment thread fboss/cli/fboss2/CmdList.cpp Outdated
@manoharan-nexthop manoharan-nexthop force-pushed the manoharan.bgp-show branch 5 times, most recently from 693e9ef to 2152450 Compare June 3, 2026 11:42
This commit adds build configuration for existing upstream BGP thrift
interfaces from the neteng/ directory.

Files Referenced:
- neteng/fboss/bgp/if/bgp_thrift.thrift - Main BGP service interface (TBgpService)
  defining RPC methods for BGP operations, session management, RIB queries,
  policy management, and monitoring
- neteng/fboss/bgp/if/policy_thrift.thrift - Routing policy statistics
- fboss/cli/fboss2/commands/show/bgp/summary/bgp_summary.thrift - BGP summary
  data model for CLI commands

Build System Updates:
- CMakeLists.txt - Added thrift compilation targets for BGP thrift files
  referencing the upstream neteng/ implementations with dependencies on
  configerator BGP policy and attribute definitions
- fboss/cli/fboss2/commands/show/bgp/summary/BUCK - Thrift library for bgp_summary

Dependencies:
- Uses upstream neteng BGP thrift definitions (full-featured version)
- Requires configerator BGP policy and attribute thrift definitions
- Integrates with fb303 for service monitoring

Migration Notes:
- Previously attempted to create custom thrift files in fboss/bgp/if/ and
  fboss/routing/policy/if/, but upstream Meta already provides these in
  neteng/fboss/bgp/if/ with full BGP++ feature set including health checks,
  partial drain state, profiler, and advanced session management
- Migrated to use the full-featured upstream version to avoid duplication
  and benefit from complete BGP++ functionality
@manoharan-nexthop manoharan-nexthop force-pushed the manoharan.bgp-show branch 2 times, most recently from 4038c81 to 6b4be38 Compare June 3, 2026 13:25
This commit adds comprehensive BGP (Border Gateway Protocol) CLI show commands
for the fboss2 CLI tool. These commands provide visibility into BGP state,
configuration, routes, neighbors, and statistics.

BGP Show Commands Added:
========================

Core Commands:
- show bgp summary - Display BGP session summary
- show bgp summary egress - Display egress BGP summary
- show bgp neighbors - Show BGP neighbor information
- show bgp table - Display BGP routing table
- show bgp table <prefix> - Show specific prefix details
- show bgp table detail - Show detailed routing table
- show bgp table community <community> - Filter by community
- show bgp table more-specifics <prefix> - Show more specific routes
- show bgp originated-routes - Display originated routes
- show bgp shadowrib - Show shadow RIB entries
- show bgp changelist - Display BGP changelist
- show version bgp - Show BGP version information

Configuration Commands:
- show config running bgp - Display running BGP configuration

Neighbor Route Commands:
- show bgp neighbors <neighbor> received pre-policy - Routes received before policy
- show bgp neighbors <neighbor> received post-policy - Routes received after policy
- show bgp neighbors <neighbor> received rejected - Rejected received routes
- show bgp neighbors <neighbor> advertised pre-policy - Routes to advertise before policy
- show bgp neighbors <neighbor> advertised post-policy - Routes advertised after policy
- show bgp neighbors <neighbor> advertised rejected - Rejected advertised routes
- show bgp neighbors <neighbor> advertised dry-run - Dry-run advertised routes
- show bgp neighbors <neighbor> session-id - Display session ID

Statistics Commands:
- show bgp stats entries - Display BGP entry statistics
- show bgp stats policy - Show BGP policy statistics
- show bgp stats attrs - Display BGP attribute statistics

Stream Commands:
- show bgp stream summary - Display BGP stream summary
- show bgp stream subscriber - Show stream subscribers
- show bgp stream subscriber pre-policy - Pre-policy stream subscribers
- show bgp stream subscriber post-policy - Post-policy stream subscribers

Implementation Details:
======================

Command Handler:
- CmdHandlerImplBgp.cpp - BGP command handler implementation
- CmdList.cpp - Updated to register BGP commands

Utilities:
- CmdShowUtils.cpp/h - Common utilities for BGP show commands
- NetTools.h - Network utility functions

Build System Updates:
- cmake/CliFboss2.cmake - Added BGP command sources
- cmake/CliFboss2Test.cmake - Added BGP test sources

Migration Notes:
- Updated bgp_summary.thrift to use neteng/fboss/bgp/if/ include path
- Updated all C++ includes to use neteng/fboss/bgp/if/gen-cpp2/ for generated code
- Removed OSS-specific simplified policy stats implementation to use full-featured
  upstream implementation everywhere

Dependencies:
This commit depends on the BGP thrift definitions added in the previous commit.

Total Changes:
- 39 command implementation files
- 22 test files
- 8 utility/infrastructure files
- 2 cmake build files
- 85 files changed

@induvsuresh induvsuresh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks Mano for patiently addressing all the changes!

@meta-codesync

meta-codesync Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@induvsuresh has imported this pull request. If you are a Meta employee, you can view this in D108329473.

@meta-codesync meta-codesync Bot closed this in 10ea6f6 Jun 12, 2026
@meta-codesync meta-codesync Bot added the Merged label Jun 12, 2026
@meta-codesync

meta-codesync Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@induvsuresh merged this pull request in 10ea6f6.

meta-codesync Bot pushed a commit that referenced this pull request Jun 15, 2026
… OSS migration

Summary:
The landed OSS show-CLI migration (D108329473 imported GitHub PR #1039, then D108379404 made OSS canonical and deleted the internal `commands/show/facebook/bgp/*` twins) silently reverted several internal-only CLI enhancements. PR #1039 was a snapshot that predated those internal changes, so making it canonical dropped them. Flagged on D108379404 by xiangxu1121; follow-up task T275793303.

This restores them. The change is rendering-only — the thrift models were unchanged and every field still exists in `neteng/fboss/bgp/if/bgp_thrift.thrift`.

`show bgp summary` (`commands/show/bgp/summary/CmdShowBgpSummary.h`, compiled by both the internal Buck build and OSS):
- `PA` (Prefixes Accepted) column from `postpolicy_rcvd_prefix_count`, the `Accepted - N` figure in the Paths line, and the `PA` acronym.
- Per-peer `UG` / `UGPS` columns (`update_group_id` / `peer_state_update_group`), shown only when `enable_update_group` is set, with `-` for unset values and the matching acronyms.
- Conditional `Downtime` column (omitted entirely when no peer has downtime).
- `drain_state` null-safety: print `N/A` for an unset optional instead of an unguarded `.value()` that throws `std::bad_optional_access`.

`show bgp neighbors` (`oss/CmdShowUtils.cpp` `printBgpNeighborsOutput`, OSS build only — the internal build links `facebook/CmdShowUtils.cpp`, which already retains these):
- `Ingress Policy:` / `Egress Policy:` lines (`ingress_policy_name` / `egress_policy_name`).
- `TTL Security (GTSM): enabled, hops: N` line (`ttl_security_enabled` / `ttl_security_hops`).

A complete before/after audit of the entire migration — all 28 migrated command pairs plus every other file both diffs touched (`show bgp techsupport`, the `CmdList` command trees, `show bgp initialization-events`, the `CmdShowUtils` seam, and the additive import diff; no `clear`/`config`/`set` BGP commands were touched) — found no other silently-wiped behavior. The remaining OSS-vs-internal divergences (CPS/CTE/FBNet/Open-R/Skynet/fbpkg helpers, and the documented `show config running bgp` structured-to-raw-JSON change) are intentional Meta-only strips. Full audit: {P2378985423}.

Reviewed By: xiangxu1121

Differential Revision: D108565895

fbshipit-source-id: 23abdce87c53e9f9808f2aff500a775839e41af1
meta-codesync Bot pushed a commit that referenced this pull request Jun 15, 2026
Summary:
Follow-up to D108565895 (OSS-parity track), task T275793303.

The OSS show-CLI migration left `show bgp initialization-events` internal-only: the import (D108329473 / PR #1039) added only an orphan `commands/show/bgp/CmdShowBgpInitializationEvents.h` with no implementation, so D108379404 kept the fully-implemented internal `commands/show/facebook/bgp/` command and deleted the incomplete OSS header. As a result the internal `fboss2` CLI exposes `show bgp initialization-events` but the open-source build does not (it isn't registered in `oss/CmdList.cpp` nor built by `CliFboss2.cmake`).

This brings the command to OSS, mirroring how every other migrated show command was handled — make the `commands/show/bgp/` version canonical and remove the internal twin:
- Move the full implementation from `commands/show/facebook/bgp/CmdShowBgpInitializationEvents.{h,cpp}` to `commands/show/bgp/` (OSS BSD header) and delete the internal twin. The command is generic — it only uses the canonical `neteng/fboss/bgp/if` thrift (`getInitializationEvents` RPC + `BgpInitializationEvent` enum), with no Meta-only dependencies — so a verbatim move suffices.
- Repoint the internal command trees (`facebook/CmdList.cpp`, `facebook/routing_protocol/CmdList.cpp`) and `fboss2/BUCK` from the `facebook/bgp/` path to `bgp/` (class/Traits/RPC/`printOutput` are unchanged, so the internal CLI behaves identically).
- Register the command in `oss/CmdList.cpp` under `bgp` and add its sources to `CliFboss2.cmake` so the open-source build exposes it.

`run()` stays self-instantiated in the command's `.cpp` (as before); `CmdHandlerImplBgp.cpp` does not reference it, so there is no double instantiation.

Reviewed By: xiangxu1121

Differential Revision: D108566837

fbshipit-source-id: af3b65b8524940073f3dec44d06436b8d780dc47
hillol-nexthop pushed a commit to nexthop-ai/fboss that referenced this pull request Jun 17, 2026
Summary:
**Pre-submission checklist**
- [ ] I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running `pip install -r requirements-dev.txt && pre-commit install`
- [ ] `pre-commit run`

Adds BGP CLI show commands for the fboss2 CLI tool. These commands provide visibility into BGP state, configuration, routes, neighbors, and statistics.

BGP Show Commands Added:
========================

Core Commands:
- show bgp summary - Display BGP session summary
- show bgp summary egress - Display egress BGP summary
- show bgp neighbors - Show BGP neighbor information
- show bgp table - Display BGP routing table
- show bgp table <prefix> - Show specific prefix details
- show bgp table detail - Show detailed routing table
- show bgp table community <community> - Filter by community
- show bgp table more-specifics <prefix> - Show more specific routes
- show bgp originated-routes - Display originated routes
- show bgp shadowrib - Show shadow RIB entries
- show bgp changelist - Display BGP changelist
- show version bgp - Show BGP version information

Configuration Commands:
- show config running bgp - Display running BGP configuration

Neighbor Route Commands:
- show bgp neighbors <neighbor> received pre-policy - Routes received before policy
- show bgp neighbors <neighbor> received post-policy - Routes received after policy
- show bgp neighbors <neighbor> received rejected - Rejected received routes
- show bgp neighbors <neighbor> advertised pre-policy - Routes to advertise before policy
- show bgp neighbors <neighbor> advertised post-policy - Routes advertised after policy
- show bgp neighbors <neighbor> advertised rejected - Rejected advertised routes
- show bgp neighbors <neighbor> advertised dry-run - Dry-run advertised routes
- show bgp neighbors <neighbor> session-id - Display session ID

Statistics Commands:
- show bgp stats entries - Display BGP entry statistics
- show bgp stats policy - Show BGP policy statistics
- show bgp stats attrs - Display BGP attribute statistics

Stream Commands:
- show bgp stream summary - Display BGP stream summary
- show bgp stream subscriber - Show stream subscribers
- show bgp stream subscriber pre-policy - Pre-policy stream subscribers
- show bgp stream subscriber post-policy - Post-policy stream subscribers

Implementation Details:
======================

Command Handler:
- CmdHandlerImplBgp.cpp - BGP command handler implementation
- CmdList.cpp - Updated to register BGP commands

Utilities:
- CmdShowUtils.cpp/h - Common utilities for BGP show commands
- CmdClientUtils.cpp/h - Client utilities for BGP service communication
- CmdUtilsCommon.cpp - Common command utilities
- NetTools.h - Network utility functions

Tests (22 test files):
- CmdShowBgpSummaryTest.cpp
- CmdShowBgpSummaryEgressTest.cpp
- CmdShowBgpNeighborsTest.cpp
- CmdShowBgpTableTest.cpp
- CmdShowBgpTablePrefixTest.cpp
- CmdShowBgpTableDetailTest.cpp
- CmdShowBgpTableCommunityTest.cpp
- CmdShowBgpTableMoreSpecificsTest.cpp
- CmdShowBgpOriginatedRoutesTest.cpp
- CmdShowBgpShadowRibTest.cpp
- CmdShowBgpChangelistTest.cpp
- CmdShowBgpNeighborsReceivedPrePolicyTest.cpp
- CmdShowBgpNeighborsReceivedPostPolicyTest.cpp
- CmdShowBgpNeighborsReceivedRejectedTest.cpp
- CmdShowBgpNeighborsAdvertisedPrePolicyTest.cpp
- CmdShowBgpNeighborsAdvertisedPostPolicyTest.cpp
- CmdShowBgpNeighborsAdvertisedRejectedTest.cpp
- CmdShowBgpStatsEntriesTest.cpp
- CmdShowBgpStatsPolicyTest.cpp
- CmdShowBgpStatsAttrsTest.cpp
- CmdShowBgpStreamSummaryTest.cpp
- CmdShowBgpStreamSubscriberTest.cpp

Test Infrastructure:
- CmdBgpTestUtils.cpp/h - BGP test utilities
- MockBgpClient.h - Mock BGP client for testing
- CmdHandlerTestBase.h - Base class for command handler tests
- MockClients.h - Mock client implementations
- CmdShowConfigTestUtils.cpp/h - Configuration test utilities
- BgpConfigSessionTest.cpp - BGP configuration session tests

Build System Updates:
- cmake/CliFboss2.cmake - Added BGP command sources
- cmake/CliFboss2Test.cmake - Added BGP test sources

Pull Request resolved: facebook#1039

Test Plan: All the CLI unit tests passes.

Reviewed By: xiangxu1121

Differential Revision: D108329473

Pulled By: induvsuresh

fbshipit-source-id: 58f87cf678ccae740afe5f9bf953c90fcf6ae083
hillol-nexthop pushed a commit to nexthop-ai/fboss that referenced this pull request Jun 17, 2026
… OSS migration

Summary:
The landed OSS show-CLI migration (D108329473 imported GitHub PR facebook#1039, then D108379404 made OSS canonical and deleted the internal `commands/show/facebook/bgp/*` twins) silently reverted several internal-only CLI enhancements. PR facebook#1039 was a snapshot that predated those internal changes, so making it canonical dropped them. Flagged on D108379404 by xiangxu1121; follow-up task T275793303.

This restores them. The change is rendering-only — the thrift models were unchanged and every field still exists in `neteng/fboss/bgp/if/bgp_thrift.thrift`.

`show bgp summary` (`commands/show/bgp/summary/CmdShowBgpSummary.h`, compiled by both the internal Buck build and OSS):
- `PA` (Prefixes Accepted) column from `postpolicy_rcvd_prefix_count`, the `Accepted - N` figure in the Paths line, and the `PA` acronym.
- Per-peer `UG` / `UGPS` columns (`update_group_id` / `peer_state_update_group`), shown only when `enable_update_group` is set, with `-` for unset values and the matching acronyms.
- Conditional `Downtime` column (omitted entirely when no peer has downtime).
- `drain_state` null-safety: print `N/A` for an unset optional instead of an unguarded `.value()` that throws `std::bad_optional_access`.

`show bgp neighbors` (`oss/CmdShowUtils.cpp` `printBgpNeighborsOutput`, OSS build only — the internal build links `facebook/CmdShowUtils.cpp`, which already retains these):
- `Ingress Policy:` / `Egress Policy:` lines (`ingress_policy_name` / `egress_policy_name`).
- `TTL Security (GTSM): enabled, hops: N` line (`ttl_security_enabled` / `ttl_security_hops`).

A complete before/after audit of the entire migration — all 28 migrated command pairs plus every other file both diffs touched (`show bgp techsupport`, the `CmdList` command trees, `show bgp initialization-events`, the `CmdShowUtils` seam, and the additive import diff; no `clear`/`config`/`set` BGP commands were touched) — found no other silently-wiped behavior. The remaining OSS-vs-internal divergences (CPS/CTE/FBNet/Open-R/Skynet/fbpkg helpers, and the documented `show config running bgp` structured-to-raw-JSON change) are intentional Meta-only strips. Full audit: {P2378985423}.

Reviewed By: xiangxu1121

Differential Revision: D108565895

fbshipit-source-id: 23abdce87c53e9f9808f2aff500a775839e41af1
hillol-nexthop pushed a commit to nexthop-ai/fboss that referenced this pull request Jun 17, 2026
Summary:
Follow-up to D108565895 (OSS-parity track), task T275793303.

The OSS show-CLI migration left `show bgp initialization-events` internal-only: the import (D108329473 / PR facebook#1039) added only an orphan `commands/show/bgp/CmdShowBgpInitializationEvents.h` with no implementation, so D108379404 kept the fully-implemented internal `commands/show/facebook/bgp/` command and deleted the incomplete OSS header. As a result the internal `fboss2` CLI exposes `show bgp initialization-events` but the open-source build does not (it isn't registered in `oss/CmdList.cpp` nor built by `CliFboss2.cmake`).

This brings the command to OSS, mirroring how every other migrated show command was handled — make the `commands/show/bgp/` version canonical and remove the internal twin:
- Move the full implementation from `commands/show/facebook/bgp/CmdShowBgpInitializationEvents.{h,cpp}` to `commands/show/bgp/` (OSS BSD header) and delete the internal twin. The command is generic — it only uses the canonical `neteng/fboss/bgp/if` thrift (`getInitializationEvents` RPC + `BgpInitializationEvent` enum), with no Meta-only dependencies — so a verbatim move suffices.
- Repoint the internal command trees (`facebook/CmdList.cpp`, `facebook/routing_protocol/CmdList.cpp`) and `fboss2/BUCK` from the `facebook/bgp/` path to `bgp/` (class/Traits/RPC/`printOutput` are unchanged, so the internal CLI behaves identically).
- Register the command in `oss/CmdList.cpp` under `bgp` and add its sources to `CliFboss2.cmake` so the open-source build exposes it.

`run()` stays self-instantiated in the command's `.cpp` (as before); `CmdHandlerImplBgp.cpp` does not reference it, so there is no double instantiation.

Reviewed By: xiangxu1121

Differential Revision: D108566837

fbshipit-source-id: af3b65b8524940073f3dec44d06436b8d780dc47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment