Skip to content

[Nexthop] [fboss2-dev] Add show config running bgp - #1748

Open
vybhav-nexthop wants to merge 1 commit into
meta:mainfrom
nexthop-ai:show-config-running-bgp
Open

vybhav-nexthop wants to merge 1 commit into
meta:mainfrom
nexthop-ai:show-config-running-bgp

Conversation

@vybhav-nexthop

@vybhav-nexthop vybhav-nexthop commented Oct 12, 2026 •

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

show config running only had an agent child, so fboss2-dev show config running bgp failed with A subcommand is required; BGP running config was only reachable as show bgp config running.

This makes show config running <daemon> the canonical form for running-config views:

  • oss/CmdList.cpp: register bgp under show config running, reusing CmdShowConfigRunningBgp.
  • show bgp config running is kept as an alias for backward compatibility; it was the only OSS spelling before this change.
  • CmdShowConfigTraits.h: the description said the OSS build does not register show config running bgp; updated to name it as the primary spelling.
  • CmdHandler.cpp: fix --fmt json for commands whose RetType is folly::dynamic (show config running bgp|agent, show bgp config running, show bgp policy). printJson passed the per-host map to SimpleJSONSerializer, which threw TypeError: expected dynamic type 'array', but had type 'object' and exited 1. It now renders folly::dynamic results with folly::toJson.
  • docs/docs/debugging/fboss_cli.md: command table lists show config running agent / bgp.

Test Plan

On a hardware switch running bgpd:

Command Before After
show config running bgp A subcommand is required, rc=106 BGP running-config JSON, rc=0
show bgp config running JSON, rc=0 same, rc=0
show config running agent rc=0 identical output, rc=0

show config running bgp output is byte-identical to show bgp config running. show config running --help lists agent and bgp.

--fmt json fix (CmdHandler.cpp): before / after

On a hardware switch, bgpd running. Before = the installed fboss2-dev; after = this PR's build.

Command Before After
--fmt json show bgp config running rc=1, TypeError: expected dynamic type 'array', but had type 'object' rc=0, valid JSON {"localhost": {...}} (861,551 bytes)
--fmt json show config running bgp rc=106, A subcommand is required rc=0, byte-identical (cmp) to the row above
--fmt json show bgp policy (no policy name) usage message, then rc=1 TypeError: ... usage message, rc=0, {"localhost":{}}

Start of the after output:

{"localhost":{"defaultCommandLineArgs":{"publish_stats_to_fsdb":"true","publish_state_to_fsdb":"true",...},"local_confed_as_4_byte":...

--fmt json show config running agent was not re-checked in this run: the agent on that switch was not configured (switch is still initializing or is exiting and is not fully configured yet) with both binaries. It is covered by ShowConfigRunningAgentTest.JsonMatchesDaemonRunningConfig.

New integration tests in fboss2_integration_test, all passing (3/3) on a hardware switch with a BGP peer established:

  • ShowConfigRunningAgentTest.JsonMatchesDaemonRunningConfig: show config running agent matches the agent's getRunningConfig RPC.
  • ShowConfigRunningBgpTest.MatchesDaemonRunningConfig: show config running bgp matches bgpd's getRunningConfig RPC.
  • ShowConfigRunningBgpTest.MatchesShowBgpConfigRunningAlias: show config running bgp matches show bgp config running.

`show config running` only had an `agent` child, so the natural
`show config running bgp` failed with "A subcommand is required"; the
BGP running config was reachable only as `show bgp config running`.

Make `show config running <daemon>` the canonical shape for running-config
views: register `bgp` there, reusing CmdShowConfigRunningBgp.
`show bgp config running` is kept as an alias for backward compatibility;
it was the only OSS spelling before this change. Update the command's
description (which said the OSS build does not register this spelling)
and the fboss_cli.md command table.

Fix `--fmt json` for commands whose RetType is folly::dynamic
('show config running bgp|agent', 'show bgp config running',
'show bgp policy'): CmdHandler::printJson fed the per-host map to
SimpleJSONSerializer, which threw "TypeError: expected dynamic type
'array', but had type 'object'" and exited 1. printJson now renders
folly::dynamic results with folly::toJson.

Add integration tests that compare `show config running agent` and
`show config running bgp` against each daemon's getRunningConfig RPC,
and check that `show config running bgp` matches the
`show bgp config running` alias.
@vybhav-nexthop
vybhav-nexthop requested review from a team as code owners October 12, 2026 05:32
@meta-cla meta-cla Bot added the CLA Signed label Oct 12, 2026
@vybhav-nexthop vybhav-nexthop changed the title [Nexthop][fboss2-dev] Add show config running bgp [Nexthop] [fboss2-dev] Add show config running bgp Oct 14, 2026
@github-actions github-actions Bot added nexthop project:fboss2-dev FBOSS project: fboss2-dev labels Oct 14, 2026

This branch has not been deployed

No deployments
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