Skip to content

Conversation

@benoit-nexthop
Copy link
Contributor

@benoit-nexthop benoit-nexthop commented Jan 28, 2026

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

Implements new fboss2-dev CLI commands for configuring port queue configs
(PortQueue) under queuing policies. This allows setting queue scheduling,
weights, buffer sizes, and other queue-related parameters.

Command syntax uses key-value pairs to set multiple attributes at once:

config qos queuing-policy <name> queue-id <id> <attr> <value> [<attr> <value> ...]

Valid attributes:

  • scheduling: WRR, SP, DRR (or full names: WEIGHTED_ROUND_ROBIN, STRICT_PRIORITY, DEFICIT_ROUND_ROBIN)
  • weight: queue weight (integer)
  • shared-bytes: shared buffer bytes (integer)
  • reserved-bytes: reserved buffer bytes (integer)
  • scaling-factor: MMU scaling factor (e.g., TWO, FOUR, ONE_HALF)
  • stream-type: stream type (UNICAST, MULTICAST, ALL, FABRIC_TX)
  • buffer-pool-name: name of buffer pool to use

All enum values (scheduling, stream-type, scaling-factor) are case-insensitive, so both wrr and WRR are accepted.

Also refactors the cleanup_config() helper function into cli_test_lib.py to
reduce code duplication between test_config_pfc.py and test_config_portqueuecfg.py.

Note: this change is part of a series, the previous one is #862, the next one is #866.

Test Plan

End to end tests:

======================================================================
CLI E2E Test: Port Queue Configuration
======================================================================

[Step 0] Cleaning up any existing test config...
  Copying system config to session config...
  Removing port queue 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.36s: 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.07s: 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.06s: config qos buffer-pool cli_e2e_test_buffer_pool headroom-bytes 4405376
  Buffer pool configured

[Step 2] Configuring queuing policy 'cli_e2e_test_queue_policy'...
  Configuring queue-id 2...
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 2 scheduling SP weight 10 shared-bytes 83618832
[CLI] Completed in 0.06s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 2 scheduling SP weight 10 shared-bytes 83618832
  Configuring queue-id 6...
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 6 scheduling SP shared-bytes 83618832 scaling-factor TWO
[CLI] Completed in 0.07s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 6 scheduling SP shared-bytes 83618832 scaling-factor TWO
  Configuring queue-id 7...
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 scheduling WRR weight 20 reserved-bytes 5000 buffer-pool-name cli_e2e_test_buffer_pool
[CLI] Completed in 0.06s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 scheduling WRR weight 20 reserved-bytes 5000 buffer-pool-name cli_e2e_test_buffer_pool
  Configuring queue-id 3...
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 3 scheduling WRR weight 15 stream-type MULTICAST
[CLI] Completed in 0.07s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 3 scheduling WRR weight 15 stream-type MULTICAST
  All queues configured

[Step 3] Committing configuration...
[CLI] Running: config session commit
[CLI] Completed in 16.23s: config session commit
  Configuration committed successfully

[Step 4] Verifying configuration...
  Buffer pool 'cli_e2e_test_buffer_pool' verified
  Queuing policy 'cli_e2e_test_queue_policy' verified

======================================================================
TEST PASSED
======================================================================

[Step 5] Cleaning up test config...
  Copying system config to session config...
  Removing port queue configs...
  Updating metadata for AGENT_RESTART...
  Committing cleanup...
[CLI] Running: config session commit
[CLI] Completed in 5.46s: config session commit
  Cleanup complete

Sample usage

[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos queuing-policy test-queue queue-id 0 scheduling WRR weight 10 reserved-bytes 1000
Successfully configured queuing-policy 'test-queue' queue-id 0

[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos queuing-policy test-queue queue-id 1 scheduling SP shared-bytes 83618832 scaling-factor TWO
Successfully configured queuing-policy 'test-queue' queue-id 1

[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos queuing-policy test-queue queue-id 2 buffer-pool-name ingress_pool
Successfully configured queuing-policy 'test-queue' queue-id 2

[admin@fboss101 ~]$ ~/benoit/fboss2-dev config session diff
--- current live config
+++ session config
@@ -2197,7 +2197,30 @@
     "maxNeighborProbes": 300,
     "mirrorOnDropReports": [],
     "mirrors": [],
-    "portQueueConfigs": {},
+    "portQueueConfigs": {
+      "test-queue": [
+        {
+          "id": 0,
+          "reservedBytes": 1000,
+          "scheduling": 0,
+          "streamType": 0,
+          "weight": 10
+        },
+        {
+          "id": 1,
+          "scalingFactor": 9,
+          "scheduling": 1,
+          "sharedBytes": 83618832,
+          "streamType": 0
+        },
+        {
+          "bufferPoolName": "ingress_pool",
+          "id": 2,
+          "scheduling": 0,
+          "streamType": 0
+        }
+      ]
+    },
     "ports": [
       {
         "conditionalEntropyRehash": false,

Sample usage (showing case-insensitive enum values)

[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos queuing-policy test-policy queue-id 0 scheduling wrr weight 10 stream-type multicast
Successfully configured queuing-policy 'test-policy' queue-id 0

[admin@fboss101 ~]$ ~/benoit/fboss2-dev config session diff
--- current live config
+++ session config
@@ -2197,7 +2197,16 @@
     "maxNeighborProbes": 300,
     "mirrorOnDropReports": [],
     "mirrors": [],
-    "portQueueConfigs": {},
+    "portQueueConfigs": {
+      "test-policy": [
+        {
+          "id": 0,
+          "scheduling": 0,
+          "streamType": 1,
+          "weight": 10
+        }
+      ]
+    },
     "ports": [
       {
         "conditionalEntropyRehash": false,

manoharan-nexthop and others added 8 commits January 28, 2026 18:12
1. Some of the configuration commands like QoS buffer pool modification
requires an agent restart and some are hitless. Inorder to take
appropriate action during the commit, track the highest impact action by
storing the same in `$HOME/.fboss2/action_level` at the end of each
configuration change. The proposed change only prints a warning if the
action needs to be taken. Later this can be modified to perform the
action automatically

2. Add QoS buffer pool configuration commands
```
- fboss2 config qos buffer-pool <name> shared-bytes <value>
- fboss2 config qos buffer-pool <name> headroom-bytes <value>
- fboss2 config qos buffer-pool <name> reserved-bytes <value>
```

1. Updated existing UT for action information
2. Added new tests for QoS buffer bool configurations.

```
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos buffer-pool testpool headroom-bytes 1024
Successfully set headroom-bytes for buffer-pool 'testpool' to 1024
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config session diff
--- current live config
+++ session config
@@ -121,6 +121,12 @@
     "arpAgerInterval": 5,
     "arpRefreshSeconds": 20,
     "arpTimeoutSeconds": 60,
+    "bufferPoolConfigs": {
+      "testpool": {
+        "headroomBytes": 1024,
+        "sharedBytes": 0
+      }
+    },
     "clientIdToAdminDistance": {
       "0": 20,
       "1": 1,
[admin@fboss101 ~]$ ll ~/.fboss2
total 216
-rw-r--r-- 1 admin admin 213283 Jan 13 05:15 agent.conf
-rw-r--r-- 1 admin admin     42 Jan 13 05:15 conf_metadata.json
[admin@fboss101 ~]$ cat ~/.fboss2/conf_metadata.json
{
  "action": {
    "WEDGE_AGENT": "AGENT_RESTART"
  }
}
```
…mand.

This doesn't yet automatically create the VLAN if it doesn't exist.
A recent merge introduced a duplicate command by mistake (bad merge on
my part) and this escaped because of lack of test coverage.

Also make sure we keep `cmake/CliFboss2Test.cmake` sorted.
Now every config command is saved in the CLI session metadata so we can
easily tell what commands were used in a given session. The metadata is
now also saved along the config when we commit the session. A future
commit will make rollback also rely on this metadata to decide whether
or not to restart the agent.
Replace the basic file-based configuration versioning mechanism with
Git-based versioning for the CLI config session.

Key changes:

- Add new Git class (Git.h/cpp) providing a simple interface for Git
  operations: init, commit, log, show, resolveRef, getHead, hasCommits
- Use folly::Subprocess with full path /usr/bin/git for all Git commands
- Replace revision files (agent-rN.conf + symlink) with atomic writes
  to agent.conf tracked in a local Git repository
- Use Git commit SHAs as revision identifiers instead of rN format
- Update RevisionList validation to accept Git SHAs (7+ hex chars)

Repository initialization:
- Automatically initialize Git repo if it doesn't exist
- Automatically create initial commit if repo has no commits but
  config file exists
- Use --shared=group flag and umask 0002 to ensure .git directory
  is group-writable when /etc/coop is group-writable

Commands updated:
- config history: Shows Git commit log with SHA, author, timestamp, message
- config session diff: Uses git show to compare commits
- config session commit: Creates Git commits with username as author
- config rollback: Reads config from Git history and creates new commit

Test updates:
- Update all CLI config tests to use Git-based setup
- Initialize Git repo and create initial commit in test fixtures
…esolution

When multiple users have concurrent config sessions, the first user to
commit succeeds, but subsequent users get an error because their session
is based on a stale commit. Previously, whoever committed last would
overwrite changes of other users that committed before them.

This commit adds a `config session rebase` command that:
1. Takes the diff between the config as of the base commit and the
session
2. Re-applies this diff on top of the current HEAD (similar to git
rebase)
3. Uses a recursive 3-way merge algorithm for JSON objects
4. Detects and reports conflicts at specific JSON paths
5. Updates the session's base to the current HEAD on success

The 3-way merge algorithm handles:
- Objects: recursively merges each key
- Arrays: element-by-element merge if sizes match
- Scalars: conflict if both head and session changed differently from
base

Add unit tests covering:
- Successful rebase with non-conflicting changes
- Rebase failure when changes conflict
- Rebase not needed when session is already up-to-date

NOS-3962 #done
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.

# Test Plan

Added unit test CmdShowRunningConfigTest that mocks the getRunningConfig
thrift API.

## Sample usage

```
[admin@fboss101 ~]$ fboss2 show running-config
{
  "sw": {
    "version": 0,
    "ports": [
      {
        "logicalID": 1,
        "speed": "HUNDREDG",
        "name": "eth1/1/1",
        ...
      }
    ],
    ...
  }
}
```

NOS-4057 #done
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.

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
```

```
[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": [
       {
```
# Summary

Implements new fboss2-dev CLI commands for configuring PFC (Priority Flow
Control) settings on individual interfaces. This allows enabling/disabling
PFC, setting watchdog parameters, and associating priority group policies
with ports.

The command uses a key-value pair syntax that allows setting multiple
attributes in a single command:

```
config interface <port> pfc-config <attr> <value> [<attr> <value> ...]
```

Valid attributes:
- `tx enabled|disabled` - Enable/disable PFC transmission
- `rx enabled|disabled` - Enable/disable PFC reception
- `tx-duration enabled|disabled` - Enable/disable TX duration
- `rx-duration enabled|disabled` - Enable/disable RX duration
- `priority-group-policy <name>` - Set priority group policy
- `watchdog-detection-time <ms>` - Set watchdog detection time
- `watchdog-recovery-time <ms>` - Set watchdog recovery time
- `watchdog-recovery-action drop|no-drop` - Set watchdog recovery action

# Test Plan

End-to-end tests on fboss101:
```
======================================================================
CLI E2E Test: PFC Configuration
======================================================================

[Step 0] Cleaning up any existing test config...
[...]
  Cleanup complete

[Step 1] Configuring buffer pool 'cli_e2e_test_buffer_pool'...
[...]
  Buffer pool configured

[Step 2] Configuring priority group policy 'cli_e2e_test_pg_policy'...
[...]
  All priority groups configured

[Step 3] Configuring PFC on port 'eth1/1/1'...
  Using single-attribute commands for tx, rx, priority-group-policy...
[CLI] Running: config interface eth1/1/1 pfc-config tx enabled
[CLI] Completed in 0.07s: config interface eth1/1/1 pfc-config tx enabled
[CLI] Running: config interface eth1/1/1 pfc-config rx enabled
[CLI] Completed in 0.06s: config interface eth1/1/1 pfc-config rx enabled
[CLI] Running: config interface eth1/1/1 pfc-config priority-group-policy cli_e2e_test_pg_policy
[CLI] Completed in 0.06s: config interface eth1/1/1 pfc-config priority-group-policy cli_e2e_test_pg_policy
  Using multi-attribute command for all watchdog settings...
[CLI] Running: config interface eth1/1/1 pfc-config watchdog-detection-time 150 watchdog-recovery-time 1000 watchdog-recovery-action no-drop
[CLI] Completed in 0.06s: config interface eth1/1/1 pfc-config watchdog-detection-time 150 watchdog-recovery-time 1000 watchdog-recovery-action no-drop
  Port PFC configured

[Step 4] Committing configuration...
[CLI] Running: config session commit
[CLI] Completed in 11.84s: config session commit
  Configuration committed successfully

[Step 5] Verifying configuration...
  Buffer pool 'cli_e2e_test_buffer_pool' verified
  Priority group policy 'cli_e2e_test_pg_policy' verified
  Port 'eth1/1/1' PFC config verified

======================================================================
TEST PASSED
======================================================================

[Step 6] Cleaning up test config...
[...]
  Cleanup complete
```

## Sample usage

Setting multiple attributes at once:
```
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config interface eth1/1/1 pfc-config tx enabled rx enabled priority-group-policy sample_pg_policy
Successfully configured PFC for interface(s) eth1/1/1

[admin@fboss101 ~]$ ~/benoit/fboss2-dev config interface eth1/1/1 pfc-config watchdog-detection-time 150 watchdog-recovery-time 1000 watchdog-recovery-action no-drop
Successfully configured PFC for interface(s) eth1/1/1

[admin@fboss101 ~]$ ~/benoit/fboss2-dev config session diff
--- current live config
+++ session config
@@ -2218,6 +2218,16 @@
           "rx": false,
           "tx": false
         },
+        "pfc": {
+          "portPgConfigName": "sample_pg_policy",
+          "rx": true,
+          "tx": true,
+          "watchdog": {
+            "detectionTimeMsecs": 150,
+            "recoveryAction": 0,
+            "recoveryTimeMsecs": 1000
+          }
+        },
         "portType": 0,
         "profileID": 39,
         "queues_DEPRECATED": [],
```
# Summary

Implements new fboss2-dev CLI commands for configuring port queue configs
(PortQueue) under queuing policies. This allows setting queue scheduling,
weights, buffer sizes, and other queue-related parameters.

Command syntax uses key-value pairs to set multiple attributes at once:
```
config qos queuing-policy <name> queue-id <id> <attr> <value> [<attr> <value> ...]
```

Valid attributes:
- scheduling: WRR, SP, DRR (or full names: WEIGHTED_ROUND_ROBIN, STRICT_PRIORITY, DEFICIT_ROUND_ROBIN)
- weight: queue weight (integer)
- shared-bytes: shared buffer bytes (integer)
- reserved-bytes: reserved buffer bytes (integer)
- scaling-factor: MMU scaling factor (e.g., TWO, FOUR, ONE_HALF)
- stream-type: stream type (UNICAST, MULTICAST, ALL, FABRIC_TX)
- buffer-pool-name: name of buffer pool to use

All enum values (scheduling, stream-type, scaling-factor) are case-insensitive,
so both "wrr" and "WRR" are accepted.

Also refactors the cleanup_config() helper function into cli_test_lib.py to
reduce code duplication between test_config_pfc.py and test_config_portqueuecfg.py.

# Test Plan

End to end tests:
```
======================================================================
CLI E2E Test: Port Queue Configuration
======================================================================

[Step 0] Cleaning up any existing test config...
  Copying system config to session config...
  Removing port queue 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.82s: 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.07s: 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.06s: config qos buffer-pool cli_e2e_test_buffer_pool headroom-bytes 4405376
  Buffer pool configured

[Step 2] Configuring queuing policy 'cli_e2e_test_queue_policy'...
  Configuring queue-id 2...
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 2 scheduling SP weight 10 shared-bytes 83618832
[CLI] Completed in 0.06s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 2 scheduling SP weight 10 shared-bytes 83618832
  Configuring queue-id 6...
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 6 scheduling SP shared-bytes 83618832 scaling-factor TWO
[CLI] Completed in 0.07s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 6 scheduling SP shared-bytes 83618832 scaling-factor TWO
  Configuring queue-id 7...
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 scheduling WRR weight 20 reserved-bytes 5000 buffer-pool-name cli_e2e_test_buffer_pool
[CLI] Completed in 0.06s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 scheduling WRR weight 20 reserved-bytes 5000 buffer-pool-name cli_e2e_test_buffer_pool
  Configuring queue-id 3...
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 3 scheduling WRR weight 15 stream-type MULTICAST
[CLI] Completed in 0.07s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 3 scheduling WRR weight 15 stream-type MULTICAST
  All queues configured

[Step 3] Committing configuration...
[CLI] Running: config session commit
[CLI] Completed in 16.45s: config session commit
  Configuration committed successfully

[Step 4] Verifying configuration...
  Buffer pool 'cli_e2e_test_buffer_pool' verified
  Queuing policy 'cli_e2e_test_queue_policy' verified

======================================================================
TEST PASSED
======================================================================

[Step 5] Cleaning up test config...
  Copying system config to session config...
  Removing port queue configs...
  Updating metadata for AGENT_RESTART...
  Committing cleanup...
[CLI] Running: config session commit
[CLI] Completed in 6.32s: config session commit
  Cleanup complete
```

## Sample usage (showing case-insensitive enum values)

```
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos queuing-policy test-policy queue-id 0 scheduling wrr weight 10 stream-type multicast
Successfully configured queuing-policy 'test-policy' queue-id 0

[admin@fboss101 ~]$ ~/benoit/fboss2-dev config session diff
--- current live config
+++ session config
@@ -2197,7 +2197,16 @@
     "maxNeighborProbes": 300,
     "mirrorOnDropReports": [],
     "mirrors": [],
-    "portQueueConfigs": {},
+    "portQueueConfigs": {
+      "test-policy": [
+        {
+          "id": 0,
+          "scheduling": 0,
+          "streamType": 1,
+          "weight": 10
+        }
+      ]
+    },
     "ports": [
       {
         "conditionalEntropyRehash": false,
```
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.

2 participants