Skip to content

[Nexthop][fboss2-dev] Unify agent/BGP config session + decouple ConfigSession header - #1446

Open
hillol-nexthop wants to merge 3 commits into
facebook:mainfrom
nexthop-ai:bgp-session-unify
Open

[Nexthop][fboss2-dev] Unify agent/BGP config session + decouple ConfigSession header#1446
hillol-nexthop wants to merge 3 commits into
facebook:mainfrom
nexthop-ai:bgp-session-unify

Conversation

@hillol-nexthop

@hillol-nexthop hillol-nexthop commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1344 (BGP-aware fboss2 config session): unify the agent and BGP
domains inside ConfigSession and decouple the ConfigSession.h header from
the heavy generated thrift types.

  • Collapse the BGP_RESTART action level into AGENT_WARMBOOT (bgpd has no
    hitless reload; its restart already runs the agent-warmboot code path).
  • Introduce a single ConfigDomain descriptor + configDomains() and shared
    per-domain helpers so commit(), rollback() and config session diff
    handle the agent and BGP domains uniformly (private DiffDomain removed).
  • Make the agent skip-when-unchanged like BGP: a commit whose staged config
    equals what is already promoted is a true no-op (no git revision, no symlink
    churn, no reloadConfig()/bgpd restart). Change detection is semantic
    (compare the deserialized thrift structs), so formatting-only diffs don't
    count.
  • Consolidate config session clear onto a static stagedSessionFilePaths()
    and reuse ConfigSession::readStagedContent() in diff.
  • Make ConfigSession::saveConfig(service, level) generic over the service and
    reduce saveBgpConfig() to a thin wrapper.
  • Keep the heavy generated thrift headers out of ConfigSession.h: use the
    *_types_fwd.h forward-declaration headers, hold agentConfig_/bgpConfig_
    by std::unique_ptr, and drop the configLoaded_/bgpConfigLoaded_ bools
    (null == not loaded).

Test Plan

  • fboss/cli/fboss2/test/config:cmd_config_test passes (the config-session /
    commit / diff / BGP / clear unit tests cover the refactored paths).
  • //fboss/cli/... builds and tests pass on top of upstream/main.
  • Verified the agent no-op commit behaviour live on test switches.

Follow-up cleanups to the BGP-aware config session infra (facebook#1344):

- Collapse the BGP_RESTART action level into AGENT_WARMBOOT (bgpd has no hitless
  reload; its restart already runs the agent-warmboot code path).
- Introduce a single ConfigDomain descriptor + configDomains() and shared
  per-domain helpers so commit(), rollback() and `config session diff` handle
  the agent and BGP domains uniformly (private DiffDomain removed).
- Make the agent skip-when-unchanged like BGP: a commit whose staged config
  equals what is already promoted is a true no-op (no git revision, no symlink
  churn, no reloadConfig()/bgpd restart). Change detection is semantic (compare
  the deserialized thrift structs), so formatting-only diffs don't count.
- Consolidate `config session clear` onto a static stagedSessionFilePaths()
  and reuse ConfigSession::readStagedContent() in diff.
- Make ConfigSession::saveConfig(service, level) generic over the service and
  reduce saveBgpConfig() to a thin wrapper.
- Keep the heavy generated thrift headers out of ConfigSession.h: use the
  *_types_fwd.h forward-declaration headers, hold agentConfig_/bgpConfig_ by
  std::unique_ptr, and drop the configLoaded_/bgpConfigLoaded_ bools
  (null == not loaded).
- clang-tidy: use auto for the SimpleJSONSerializer template-cast results.

Built fboss2-dev + the config unit tests; config-session/commit/diff/BGP/clear
tests pass. Verified the agent no-op behaviour live on test switches.
Removed comments about the destructor definition in ConfigSession.h.
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

@meta-codesync

meta-codesync Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D114376130. (Because this pull request was imported automatically, there will not be any future comments.)

…thInterface call

main renamed findFirstEthInterface() to getRandomInterfacePortName()
(virtual-management-port fix); convert the branch-added no-op-commit test
to the new helper. Drop the three includes ConfigSession.cpp no longer
uses directly (misc-include-cleaner runs as errors in CI).
@facebook-github-tools

Copy link
Copy Markdown

@hillol-nexthop has updated the pull request. You must reimport the pull request before landing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant