Repository navigation
[Nexthop][fboss2-dev] Add show running-config CLI command - #838
Closed
benoit-nexthop wants to merge 2 commits into
Closed
benoit-nexthop wants to merge 2 commits into
benoit-nexthop wants to merge 2 commits into
Conversation
This was referenced Jan 26, 2026
benoit-nexthop
force-pushed
the
fboss2-cli-prototype_part18
branch
3 times, most recently
from
January 28, 2026 18:49
d682f77 to
73d5198
Compare
benoit-nexthop
force-pushed
the
fboss2-cli-prototype_part18
branch
from
March 5, 2026 23:09
73d5198 to
9d484eb
Compare
Add new fboss2-dev CLI commands for managing static MAC address entries on VLANs: - `config vlan <vlan-id> static-mac add <mac-address> <port-id>` - `config vlan <vlan-id> static-mac delete <mac-address>` These commands allow operators to configure static MAC address entries in the FBOSS switch configuration, which is useful for scenarios where MAC addresses need to be pinned to specific ports. Features: * VLAN ID validation (1-4094 range) * MAC address format validation * Port existence validation with automatic logical ID resolution * Duplicate entry detection for add operations * Integration with ConfigSession for proper config management Unit Tests: ``` ./fboss/oss/scripts/nhfboss-test.sh --timeout 30 --retry 0 --filter 'CmdConfigVlanStaticMac' Output: [==========] Running 33 tests from 1 test suite. ... [ PASSED ] 33 tests. ``` Manual CLI Testing: ``` $ fboss2-dev config vlan 2001 static-mac add 02:00:00:E2:E2:01 eth1/1/1 Successfully added static MAC entry: MAC 02:00:00:E2:E2:01 -> VLAN 2001, Port eth1/1/1 (ID 9) $ fboss2-dev config session commit Config session committed successfully as r77 and config reloaded. $ fboss2-dev config vlan 2001 static-mac delete 02:00:00:E2:E2:01 Successfully deleted static MAC entry: MAC 02:00:00:E2:E2:01 from VLAN 2001 ```
Add a new fboss2 show command that retrieves the running configuration
from the agent via the `getRunningConfig()` Thrift API and displays it
as nicely formatted JSON.
This is useful when the config file on disk is missing or out of sync
with the running agent configuration.
Added unit test CmdShowRunningConfigTest that mocks the getRunningConfig
thrift API.
```
[admin@fboss101 ~]$ fboss2 show running-config
{
"sw": {
"version": 0,
"ports": [
{
"logicalID": 1,
"speed": "HUNDREDG",
"name": "eth1/1/1",
...
}
],
...
}
}
```
NOS-4057 #done
benoit-nexthop
force-pushed
the
fboss2-cli-prototype_part18
branch
from
March 6, 2026 00:48
9d484eb to
aea6fb0
Compare
meta-codesync Bot
pushed a commit
that referenced
this pull request
Mar 6, 2026
Summary: Add new fboss2-dev CLI commands for managing static MAC address entries on VLANs: - `config vlan <vlan-id> static-mac add <mac-address> <port-id>` - `config vlan <vlan-id> static-mac delete <mac-address>` These commands allow operators to configure static MAC address entries in the FBOSS switch configuration, which is useful for scenarios where MAC addresses need to be pinned to specific ports. Features: * VLAN ID validation (1-4094 range) * MAC address format validation * Port existence validation with automatic logical ID resolution * Duplicate entry detection for add operations * Integration with ConfigSession for proper config management Unit tests: ``` /var/FBOSS/tmp_bld_dir/build/fboss/fboss2_cmd_config_test --gtest_filter='CmdConfigVlanStaticMacTestFixture.*' Output: [==========] Running 31 tests from 1 test suite. ... [ PASSED ] 31 tests. ``` Note: this change is part of a series, the previous one is #832, the next one is #838. ## Sample usage ``` $ fboss2-dev config vlan 2001 static-mac add 02:00:00:E2:E2:01 eth1/1/1 Successfully added static MAC entry: MAC 02:00:00:E2:E2:01 -> VLAN 2001, Port eth1/1/1 (ID 9) $ fboss2-dev config session commit Config session committed successfully as r77 and config reloaded. $ fboss2-dev config vlan 2001 static-mac delete 02:00:00:E2:E2:01 Successfully deleted static MAC entry: MAC 02:00:00:E2:E2:01 from VLAN 2001 ``` Original change by manoharan-nexthop Pull Request resolved: #837 Reviewed By: srikrishnagopu Differential Revision: D95454566 Pulled By: joseph5wu fbshipit-source-id: fb224affbe826d0d13f0e8011a28b408983c9d04
meta-codesync Bot
pushed a commit
that referenced
this pull request
Mar 9, 2026
Summary: When reviewing #838, I noticed this PR is trying to implement the same show config logic that we already support in fboss2 But these show running config and config history commands are not open-source ready This diff is trying to open source `fboss2 show config running agent` and `fboss2 show config history agent` commands # Summary of All Changes 1. Files Moved from FB-specific to OSS (commands/show/config/) |File |Purpose |CmdShowConfigHistoryAgent.h/.cpp |Agent config history command |CmdShowConfigRunningAgent.h/.cpp |Agent running config command |CmdShowConfigTraits.h |Shared traits for all show config commands |CmdShowConfigUtils.h/.cpp |Shared utilities 2. BUCK File Updates - Added OSS files to sources and headers lists - Removed deleted FB-specific files from sources and headers lists - Added proper dependencies 3. CmdList.cpp Updates Since `CmdSubcommands.cpp` can't support merging command trees with the same root nodes("show" -> "config"), I can't put the open source ready commands from 1) to fboss2/CmdList.cpp. Instead I need to maintain this "show"->"config" branch in two different files: - OSS CmdList.cpp: Added show config running agent and show config history agent - FB facebook/CmdList.cpp: Kept all existing show config commands 4. CMake Updates (CliFboss2.cmake) Added the new OSS files to fboss2_lib library for OSS CMake builds Reviewed By: shri-khare Differential Revision: D95634317 fbshipit-source-id: 3874fc32191665b474be1de68cb203c8f3ab1b2b
Contributor
Author
|
Superseded by commit 2c62539. |
meta-codesync Bot
pushed a commit
that referenced
this pull request
Mar 14, 2026
Summary: **Pre-submission checklist** - [x] 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` - [x] `pre-commit run` Implements new fboss2-dev CLI commands for configuring PFC priority group policies (`portPgConfigs` in `SwitchConfig`). This allows configuring per-port priority group settings for traffic prioritization and buffer management. New command: `config qos priority-group-policy <policy-name> group-id <id> <attr> <value> [<attr> <value> ...]` Where <attr> can be: - `min-limit-bytes` - `headroom-limit-bytes` - `resume-offset-bytes` - `static-limit-bytes` - `scaling-factor` (accepts `MMUScalingFactor` enum values like `ONE_HALF`, `TWO`, etc) - `buffer-pool-name` Multiple attributes can be set in a single command, or one at a time. The implementation doesn't declare the sub-subcommands in a conventional way in order to avoid an explosion of `.h` / `.cpp` pairs. Also updates `ConfigSession::restartAgent()` to use `sudo` for `systemctl restart` since the CLI may be run by non-root users. Note: this change is part of a series, the previous one is #838, the next one is #862. Pull Request resolved: #843 Test Plan: New end to end tests: ``` ====================================================================== CLI E2E Test: PFC Configuration ====================================================================== [Step 0] Cleaning up any existing test config... Copying system config to session config... Removing PFC-related configs... Updating metadata for AGENT_RESTART... Committing cleanup... Using CLI from FBOSS_CLI_PATH: /home/admin/benoit/fboss2-dev [CLI] Running: config session commit [CLI] Completed in 4.90s: config session commit Cleanup complete [Step 1] Configuring buffer pool 'cli_e2e_test_buffer_pool'... [CLI] Running: config qos buffer-pool cli_e2e_test_buffer_pool shared-bytes 78773528 [CLI] Completed in 0.08s: config qos buffer-pool cli_e2e_test_buffer_pool shared-bytes 78773528 [CLI] Running: config qos buffer-pool cli_e2e_test_buffer_pool headroom-bytes 4405376 [CLI] Completed in 0.07s: config qos buffer-pool cli_e2e_test_buffer_pool headroom-bytes 4405376 Buffer pool configured [Step 2] Configuring priority group policy 'cli_e2e_test_pg_policy'... Using single-attribute commands for group-ids 2 and 6... Configuring group-id 2 (one attribute at a time)... [CLI] Running: config qos priority-group-policy cli_e2e_test_pg_policy group-id 2 min-limit-bytes 14478 [CLI] Completed in 0.08s: config qos priority-group-policy cli_e2e_test_pg_policy group-id 2 min-limit-bytes 14478 ... Using multi-attribute commands for group-ids 0 and 7... Configuring group-id 0 (all attributes at once)... [CLI] Running: config qos priority-group-policy cli_e2e_test_pg_policy group-id 0 min-limit-bytes 4826 headroom-limit-bytes 0 resume-offset-bytes 9652 scaling-factor TWO buffer-pool-name cli_e2e_test_buffer_pool [CLI] Completed in 0.08s: config qos priority-group-policy cli_e2e_test_pg_policy group-id 0 min-limit-bytes 4826 headroom-limit-bytes 0 resume-offset-bytes 9652 scaling-factor TWO buffer-pool-name cli_e2e_test_buffer_pool Configuring group-id 7 (all attributes at once)... [CLI] Running: config qos priority-group-policy cli_e2e_test_pg_policy group-id 7 min-limit-bytes 4826 headroom-limit-bytes 0 resume-offset-bytes 9652 scaling-factor TWO buffer-pool-name cli_e2e_test_buffer_pool [CLI] Completed in 0.07s: config qos priority-group-policy cli_e2e_test_pg_policy group-id 7 min-limit-bytes 4826 headroom-limit-bytes 0 resume-offset-bytes 9652 scaling-factor TWO buffer-pool-name cli_e2e_test_buffer_pool All priority groups configured [Step 3] Committing configuration... [CLI] Running: config session commit [CLI] Completed in 15.55s: config session commit Configuration committed successfully [Step 4] Verifying configuration... Buffer pool 'cli_e2e_test_buffer_pool' verified Priority group policy 'cli_e2e_test_pg_policy' verified ====================================================================== TEST PASSED ====================================================================== [Step 5] Cleaning up test config... Copying system config to session config... Removing PFC-related configs... Updating metadata for AGENT_RESTART... Committing cleanup... [CLI] Running: config session commit [CLI] Completed in 6.67s: config session commit Cleanup complete ``` ## Sample usage ``` [admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos buffer-pool sample_buffer_pool shared-bytes 78773528 Successfully set shared-bytes for buffer-pool 'sample_buffer_pool' to 78773528 [admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos buffer-pool sample_buffer_pool headroom-bytes 4405376 Successfully set headroom-bytes for buffer-pool 'sample_buffer_pool' to 4405376 [admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos priority-group-policy sample_pg_policy group-id 2 min-limit-bytes 14478 headroom-limit-bytes 726440 resume-offset-bytes 9652 scaling-factor ONE_HALF buffer-pool-name sample_buffer_pool Successfully configured priority-group-policy 'sample_pg_policy' group-id 2 [admin@fboss101 ~]$ ~/benoit/fboss2-dev config session diff --- current live config +++ session config @@ -121,6 +121,12 @@ "arpAgerInterval": 5, "arpRefreshSeconds": 20, "arpTimeoutSeconds": 60, + "bufferPoolConfigs": { + "sample_buffer_pool": { + "headroomBytes": 4405376, + "sharedBytes": 78773528 + } + }, "clientIdToAdminDistance": { "0": 20, "1": 1, @@ -2196,6 +2202,19 @@ "maxNeighborProbes": 300, "mirrorOnDropReports": [], "mirrors": [], + "portPgConfigs": { + "sample_pg_policy": [ + { + "bufferPoolName": "sample_buffer_pool", + "headroomLimitBytes": 726440, + "id": 2, + "minLimitBytes": 14478, + "name": "pg2", + "resumeOffsetBytes": 9652, + "sramScalingFactor": 8 + } + ] + }, "portQueueConfigs": {}, "ports": [ { ``` Reviewed By: srikrishnagopu Differential Revision: D95879391 Pulled By: joseph5wu fbshipit-source-id: 5e3f4f4f51aedc1f3eb3d836e5c40cfb2da7c769
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.
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit installpre-commit runAdd a new fboss2 show command that retrieves the running configuration
from the agent via the
getRunningConfig()Thrift API and displays itas nicely formatted JSON.
This is useful when the config file on disk is missing or out of sync
with the running agent configuration.
Note: this change is part of a series, the previous one is #837, the next one is #843.
Test Plan
Added unit test CmdShowRunningConfigTest that mocks the getRunningConfig
thrift API.
Sample usage