Skip to content

Conversation

@benoit-nexthop
Copy link
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

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.

Note: this change is part of a series, the previous one is #805.

Test Plan

New unit tests added.

Sample usage

[admin@fboss101 ~]$ ~/benoit/fboss2-dev config interface eth1/1/1 description this is a test.
Successfully set description for interface(s) eth1/1/1
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config interface eth1/1/1 mtu 1500
Successfully set MTU for interface(s) eth1/1/1 to 1500
[admin@fboss101 ~]$ ls -l ~/.fboss2/
total 216
-rw-r--r-- 1 admin admin 213174 Jan 13 13:00 agent.conf
-rw-r--r-- 1 admin admin    141 Jan 13 13:00 conf_metadata.json
[admin@fboss101 ~]$ cat ~/.fboss2/conf_metadata.json 
{
  "action": {},
  "commands": [
    "config interface eth1/1/1 description this is a test.",
    "config interface eth1/1/1 mtu 1500"
  ]
}
[admin@fboss101 ~]$ ~/benoit/fboss2-dev config session commit
Config session committed successfully as r6 and config reloaded.
[admin@fboss101 ~]$ ls -l /etc/coop/cli/
total 1292
-rw-r--r-- 1 root  root  213185 Jan 13 12:52 agent-r1.conf
-rw-r--r-- 1 admin admin 213194 Jan 13 12:56 agent-r2.conf
-rw-r--r-- 1 admin admin    108 Jan 13 12:56 agent-r2.metadata.json
-rw-r--r-- 1 admin admin 213185 Jan 13 12:56 agent-r3.conf
-rw-r--r-- 1 admin admin     99 Jan 13 12:56 agent-r3.metadata.json
-rw-r--r-- 1 admin admin 213185 Jan 13 12:58 agent-r4.conf
-rw-r--r-- 1 admin admin     80 Jan 13 12:58 agent-r4.metadata.json
-rw-r--r-- 1 admin admin 213185 Jan 13 12:58 agent-r5.conf
-rw-r--r-- 1 admin admin     80 Jan 13 12:58 agent-r5.metadata.json
-rw-r--r-- 1 admin admin 213174 Jan 13 13:00 agent-r6.conf
-rw-r--r-- 1 admin admin    141 Jan 13 13:00 agent-r6.metadata.json
[admin@fboss101 ~]$ cat /etc/coop/cli/agent-r6.metadata.json 
{
  "action": {},
  "commands": [
    "config interface eth1/1/1 description this is a test.",
    "config interface eth1/1/1 mtu 1500"
  ]
}

benoit-nexthop and others added 9 commits January 14, 2026 22:07
Add some helper code to process interface-list arguments.
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.
@benoit-nexthop benoit-nexthop force-pushed the fboss2-cli-prototype_part14 branch from 9f7b8c3 to 8a91261 Compare January 14, 2026 21:30
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