Skip to content

[Nexthop][fboss2-dev] Add CLI commands for configuring port queue configs (queuing-policy) - #863

Closed
benoit-nexthop wants to merge 1 commit into
meta:mainfrom
nexthop-ai:fboss2-cli-prototype_part21
Closed

benoit-nexthop wants to merge 1 commit into
meta:mainfrom
nexthop-ai:fboss2-cli-prototype_part21

Conversation

@benoit-nexthop

@benoit-nexthop benoit-nexthop commented Jan 28, 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

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,

@meta-cla meta-cla Bot added the CLA Signed label Jan 28, 2026
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part21 branch 2 times, most recently from 2105df5 to 2013a57 Compare January 29, 2026 02:06
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part21 branch from 2013a57 to 79c607d Compare February 2, 2026 16:37
meta-codesync Bot pushed a commit that referenced this pull request Mar 17, 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 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

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

Pull Request resolved: #862

Test Plan:
New end-to-end tests:
```
======================================================================
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": [],
```

Reviewed By: srikrishnagopu, AarjunC

Differential Revision: D96549936

Pulled By: joseph5wu

fbshipit-source-id: 0cf88e5db3fdcf3bd4a70ffb98a4f4bb6c1d7cc1
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part21 branch from 79c607d to 14cc675 Compare March 17, 2026 17:26
@benoit-nexthop
benoit-nexthop requested review from a team as code owners March 17, 2026 17:26
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part21 branch 3 times, most recently from c31302d to 8f2fd75 Compare March 17, 2026 19:24
# 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.

New commands:
- `config qos queuing-policy <name> queue-id <id> scheduling <WRR|SP|DRR>`
- `config qos queuing-policy <name> queue-id <id> weight <weight>`
- `config qos queuing-policy <name> queue-id <id> shared-bytes <bytes>`
- `config qos queuing-policy <name> queue-id <id> reserved-bytes <bytes>`
- `config qos queuing-policy <name> queue-id <id> scaling-factor <factor>`
- `config qos queuing-policy <name> queue-id <id> buffer-pool-name <name>`

# Test Plan

New 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.77s: 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
[CLI] Completed in 0.07s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 2 scheduling SP
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 2 weight 10
[CLI] Completed in 0.07s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 2 weight 10
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 2 shared-bytes 83618832
[CLI] Completed in 0.07s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 2 shared-bytes 83618832
  Configuring queue-id 6...
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 6 scheduling SP
[CLI] Completed in 0.07s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 6 scheduling SP
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 6 shared-bytes 83618832
[CLI] Completed in 0.07s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 6 shared-bytes 83618832
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 6 scaling-factor TWO
[CLI] Completed in 0.08s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 6 scaling-factor TWO
  Configuring queue-id 7...
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 scheduling WRR
[CLI] Completed in 0.08s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 scheduling WRR
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 weight 20
[CLI] Completed in 0.07s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 weight 20
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 reserved-bytes 5000
[CLI] Completed in 0.06s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 reserved-bytes 5000
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 buffer-pool-name cli_e2e_test_buffer_pool
[CLI] Completed in 0.07s: config qos queuing-policy cli_e2e_test_queue_policy queue-id 7 buffer-pool-name cli_e2e_test_buffer_pool
  All queues configured

[Step 3] Committing configuration...
[CLI] Running: config session commit
[CLI] Completed in 15.79s: 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.37s: config session commit
  Cleanup complete
```

## Sample usage

```
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos queuing-policy test-queue queue-id 0 scheduling SP
Successfully set scheduling for queuing-policy 'test-queue' queue-id 0 to SP
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos queuing-policy test-queue queue-id 0 weight 10
Successfully set weight for queuing-policy 'test-queue' queue-id 0 to 10
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos queuing-policy test-queue queue-id 0 shared-bytes 83618832
Successfully set shared-bytes for queuing-policy 'test-queue' queue-id 0 to 83618832
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos queuing-policy test-queue queue-id 0 reserved-bytes 5000
Successfully set reserved-bytes for queuing-policy 'test-queue' queue-id 0 to 5000
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos queuing-policy test-queue queue-id 0 scaling-factor TWO
Successfully set scaling-factor for queuing-policy 'test-queue' queue-id 0 to TWO
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config qos queuing-policy test-queue queue-id 0 buffer-pool-name ingress_pool
Successfully set buffer-pool-name for queuing-policy 'test-queue' queue-id 0 to ingress_pool
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config session diff
--- current live config
+++ session config
@@ -2197,7 +2197,20 @@
     "maxNeighborProbes": 300,
     "mirrorOnDropReports": [],
     "mirrors": [],
-    "portQueueConfigs": {},
+    "portQueueConfigs": {
+      "test-queue": [
+        {
+          "bufferPoolName": "ingress_pool",
+          "id": 0,
+          "reservedBytes": 5000,
+          "scalingFactor": 9,
+          "scheduling": 1,
+          "sharedBytes": 83618832,
+          "streamType": 0,
+          "weight": 10
+        }
+      ]
+    },
     "ports": [
       {
         "conditionalEntropyRehash": false,
```
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part21 branch from 8f2fd75 to e9e82ea Compare March 17, 2026 20:32
@meta-codesync

meta-codesync Bot commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

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

@meta-codesync

meta-codesync Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

@joseph5wu merged this pull request in 3acc4b9.

@benoit-nexthop
benoit-nexthop deleted the fboss2-cli-prototype_part21 branch March 18, 2026 02:33
meta-codesync Bot pushed a commit that referenced this pull request Mar 18, 2026
…CLI (#866)

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`

This adds support for configuring Active Queue Management (AQM) attributes
on port queues via the CLI. The AQM configuration includes:
- congestion-behavior: `ECN` or `EARLY_DROP`
- detection linear: with minimum-length, maximum-length, and probability

The active-queue-management keyword must come last in the command as it
consumes all remaining arguments for its nested sub-attributes.

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

Pull Request resolved: #866

Test Plan:
End-to-end test output (new test case with queue-id 4 with AQM):

```
[...]
  Configuring queue-id 4...
[CLI] Running: config qos queuing-policy cli_e2e_test_queue_policy queue-id 4 scheduling SP shared-bytes 83618832 active-queue-management congestion-behavior ECN detection linear minimum-length 120000 maximum-length 120000 probability 100

======================================================================
TEST PASSED
======================================================================
```

## Sample usage

```
$ fboss2 config qos queuing-policy test_policy queue-id 5 scheduling sp \
    active-queue-management congestion-behavior ecn \
    detection linear minimum-length 120000 maximum-length 120000 probability 100
Successfully configured queuing-policy 'test_policy' queue-id 5

$ fboss2 config session diff
+    "portQueueConfigs": {
+      "test_policy": [
+        {
+          "aqms": [
+            {
+              "behavior": 1,
+              "detection": {
+                "linear": {
+                  "maximumLength": 120000,
+                  "minimumLength": 120000,
+                  "probability": 100
+                }
+              }
+            }
+          ],
+          "id": 5,
+          "scheduling": 1,
+          "streamType": 0
+        }
+      ]
+    },
```

Reviewed By: KevinYakar

Differential Revision: D97062791

Pulled By: joseph5wu

fbshipit-source-id: b4a662e5e3b6de2127c7a22a009fcdee8398e6bb
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