Skip to content

[Nexthop][fboss2-dev] Add a "fboss2 config interface <name> mtu <N>" command. - #761

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

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

Conversation

@benoit-nexthop

@benoit-nexthop benoit-nexthop commented Dec 18, 2025 •

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

This command allows setting the MTU on the given interface.

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

Test Plan

Unit tests. New end to end tests for this command are in #783.

Sample usage

[admin@fboss101 benoit]$ ./fboss2-dev show interface | head
+-----------+--------+-------+------+------+------------------------------+----------------------------+
| Interface | Status | Speed | VLAN | MTU  | Addresses                    | Description                |
--------------------------------------------------------------------------------------------------------
| eth1/1/1  | down   | 800G  | 2001 | 1500 | 10.0.0.0/24                  | Test port for diff command |
|           |        |       |      |      | 2400::/64                    |                            |
|           |        |       |      |      | fe80::b4db:91ff:fe95:ff07/64 |                            |
+-----------+--------+-------+------+------+------------------------------+----------------------------+
| eth1/2/1  | down   | 200G  | 2003 | 9216 | 11.0.0.0/24                  | Another test description   |
|           |        |       |      |      | 2401::/64                    |                            |
|           |        |       |      |      | fe80::b4db:91ff:fe95:ff07/64 |                            |
[admin@fboss101 benoit]$ ./fboss2-dev config interface eth1/1/1 mtu 9000
Successfully set MTU for interface(s) eth1/1/1 to 9000
[admin@fboss101 benoit]$ ./fboss2-dev config session diff
--- /etc/coop/agent.conf	2025-11-05 12:49:14.497415902 -0800
+++ /home/admin/.fboss2/agent.conf	2025-11-05 12:57:27.123758309 -0800
@@ -369,7 +369,7 @@
         ],
         "isStateSyncDisabled": true,
         "isVirtual": false,
-        "mtu": 1500,
+        "mtu": 9000,
         "routerID": 0,
         "scope": 0,
         "type": 1,
[admin@fboss101 benoit]$ ./fboss2-dev config session commit
Config session committed successfully and config reloaded.
[admin@fboss101 benoit]$ ./fboss2-dev show interface | head
+-----------+--------+-------+------+------+------------------------------+----------------------------+
| Interface | Status | Speed | VLAN | MTU  | Addresses                    | Description                |
--------------------------------------------------------------------------------------------------------
| eth1/1/1  | down   | 800G  | 2001 | 9000 | 10.0.0.0/24                  | Test port for diff command |
|           |        |       |      |      | 2400::/64                    |                            |
|           |        |       |      |      | fe80::b4db:91ff:fe95:ff07/64 |                            |
+-----------+--------+-------+------+------+------------------------------+----------------------------+
| eth1/2/1  | down   | 200G  | 2003 | 9216 | 11.0.0.0/24                  | Another test description   |
|           |        |       |      |      | 2401::/64                    |                            |
|           |        |       |      |      | fe80::b4db:91ff:fe95:ff07/64 |                            |

@meta-cla meta-cla Bot added the CLA Signed label Dec 18, 2025
@benoit-nexthop
benoit-nexthop marked this pull request as ready for review December 18, 2025 00:38
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part09 branch 2 times, most recently from f31295b to aba1d32 Compare December 23, 2025 21:40
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part09 branch 5 times, most recently from 273e0db to 082ed58 Compare December 30, 2025 15:53
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part09 branch 3 times, most recently from dcec2f0 to 1b6db6b Compare January 7, 2026 06:29
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part09 branch 5 times, most recently from 6f63db5 to b1318c9 Compare January 15, 2026 21:36
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part09 branch 2 times, most recently from f9a5948 to 87aec94 Compare January 21, 2026 18:03
meta-codesync Bot pushed a commit that referenced this pull request Jan 21, 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`

Add some helper code to process interface-list arguments.

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

Pull Request resolved: #760

Test Plan:
Unit tests. New end to end tests for this command are in #783.

## Sample usage

```
[admin@fboss101 benoit]$ ./fboss2-dev show interface | head
+-----------+--------+-------+------+------+------------------------------+----------------------------+
| Interface | Status | Speed | VLAN | MTU  | Addresses                    | Description                |
--------------------------------------------------------------------------------------------------------
| eth1/1/1  | down   | 800G  | 2001 | 1500 | 10.0.0.0/24                  | Test port for diff command |
|           |        |       |      |      | 2400::/64                    |                            |
|           |        |       |      |      | fe80::b4db:91ff:fe95:ff07/64 |                            |
+-----------+--------+-------+------+------+------------------------------+----------------------------+
| eth1/2/1  | down   | 200G  | 2003 | 9216 | 11.0.0.0/24                  | Another test description   |
|           |        |       |      |      | 2401::/64                    |                            |
|           |        |       |      |      | fe80::b4db:91ff:fe95:ff07/64 |                            |
[admin@fboss101 benoit]$ ./fboss2-dev config interface eth1/2/1 description 'This is a test.'
Successfully set description for interface(s) eth1/2/1
[admin@fboss101 benoit]$ ./fboss2-dev config session diff
 --- /etc/coop/agent.conf	2025-11-05 12:49:14.497415902 -0800
+++ /home/admin/.fboss2/agent.conf	2025-11-05 12:57:27.123758309 -0800
@@ -2230,7 +2230,7 @@
       },
       {
         "conditionalEntropyRehash": false,
-        "description": "Another test description",
+        "description": "This is a test.",
         "drainState": 0,
         "expectedLLDPValues": {
           "2": "eth1/6/1"
[admin@fboss101 benoit]$ ./fboss2-dev config session commit
Config session committed successfully and config reloaded.
[admin@fboss101 benoit]$ ./fboss2-dev show interface | head
+-----------+--------+-------+------+------+------------------------------+----------------------------+
| Interface | Status | Speed | VLAN | MTU  | Addresses                    | Description                |
--------------------------------------------------------------------------------------------------------
| eth1/1/1  | down   | 800G  | 2001 | 1500 | 10.0.0.0/24                  | Test port for diff command |
|           |        |       |      |      | 2400::/64                    |                            |
|           |        |       |      |      | fe80::b4db:91ff:fe95:ff07/64 |                            |
+-----------+--------+-------+------+------+------------------------------+----------------------------+
| eth1/2/1  | down   | 200G  | 2003 | 9216 | 11.0.0.0/24                  | This is a test.            |
|           |        |       |      |      | 2401::/64                    |                            |
|           |        |       |      |      | fe80::b4db:91ff:fe95:ff07/64 |                            |
```
Changing two interfaces (or more) at the same time:
```
[admin@fboss101 benoit]$ ./fboss2-dev config interface eth1/1/1 eth1/2/1 description "two at once"
Successfully set description for interface(s) eth1/1/1, eth1/2/1
[admin@fboss101 benoit]$ ./fboss2-dev config session diff
 --- current live config
+++ session config
@@ -2200,7 +2200,7 @@
     "ports": [
       {
         "conditionalEntropyRehash": false,
-        "description": "two",
+        "description": "two at once",
         "drainState": 0,
         "expectedLLDPValues": {
           "2": "eth1/5/1"
@@ -2230,7 +2230,7 @@
       },
       {
         "conditionalEntropyRehash": false,
-        "description": "two",
+        "description": "two at once",
         "drainState": 0,
         "expectedLLDPValues": {
           "2": "eth1/6/1"
[admin@fboss101 benoit]$ ./fboss2-dev config session commit
Config session committed successfully as ede5a52 and config reloaded.
[admin@fboss101 benoit]$ ./fboss2-dev show interface eth1/1/1 eth1/2/1
+-----------+--------+-------+------+------+------------------------------+-------------+
| Interface | Status | Speed | VLAN | MTU  | Addresses                    | Description |
-----------------------------------------------------------------------------------------
| eth1/1/1  | down   | 800G  | 2001 | 9000 | 10.0.0.0/24                  | two at once |
|           |        |       |      |      | 2400::/64                    |             |
|           |        |       |      |      | fe80::b4db:91ff:fe95:ff07/64 |             |
+-----------+--------+-------+------+------+------------------------------+-------------+
| eth1/2/1  | down   | 200G  | 2003 | 9216 | 11.0.0.0/24                  | two at once |
|           |        |       |      |      | 2401::/64                    |             |
|           |        |       |      |      | fe80::b4db:91ff:fe95:ff07/64 |             |
+-----------+--------+-------+------+------+------------------------------+-------------+
```
Referencing an interface that doesn't exist:
```
[admin@fboss101 benoit]$ ./fboss2-dev config interface eth1/9/42 description oopsy
Invalid argument: Port(s) or interface(s) not found in configuration: eth1/9/42. Ports must exist in the hardware platform mapping and be defined in the configuration before they can be configured.
```
Nothing changes when mixing valid and nonexistent interface names:
```
[admin@fboss101 benoit]$ ./fboss2-dev config interface eth1/1/1 eth1/9/42 description oopsy
Invalid argument: Port(s) or interface(s) not found in configuration: eth1/9/42. Ports must exist in the hardware platform mapping and be defined in the configuration before they can be configured.

E0120 14:32:19.177613 42717 CmdHandler.cpp:280] localhost - Error in command execution: Invalid argument: Port(s) or interface(s) not found in configuration: eth1/9/42. Ports must exist in the hardware platform mapping and be defined in the configuration before they can be configured.
[admin@fboss101 benoit]$ ./fboss2-dev config session diff
No differences between current live config and session config.
```

Reviewed By: shiva-menta

Differential Revision: D91058688

Pulled By: joseph5wu

fbshipit-source-id: 0d8cafe136f120a7b1163c3dfdb16fced8a2b605
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part09 branch from 87aec94 to 77eb691 Compare January 21, 2026 21:35
@meta-codesync

meta-codesync Bot commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

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

@joseph5wu joseph5wu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the PR looks good to me.
Have some comments about the valid MTU changes. Please let me know what you think

Comment thread fboss/cli/fboss2/CmdSubcommands.cpp Resolved
@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part09 branch from 77eb691 to 9a7fd16 Compare January 22, 2026 00:56
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part09 branch from 9a7fd16 to ea31d42 Compare January 22, 2026 00:58
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@benoit-nexthop
benoit-nexthop force-pushed the fboss2-cli-prototype_part09 branch from ea31d42 to 2d6a76b Compare January 22, 2026 01:09
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@meta-codesync

meta-codesync Bot commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

@joseph5wu merged this pull request in efa27ae.

meta-codesync Bot pushed a commit that referenced this pull request Jan 28, 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`

Add end-to-end tests to be run on an FBOSS DUT to validate CLI commands.

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

Pull Request resolved: #783

Test Plan:
New end-to-end test coverage for `fboss2-dev config interface <name> mtu <N>` and `fboss2-dev config interface <name> description <string>`

Sample output of `run_test.py cli`:

```
Setting fboss environment variables
Running CLI end-to-end tests...

########## Running CLI test: test_config_interface_description.py
[  PASSED  ] test_config_interface_description.py (84.0s)

########## Running CLI test: test_config_interface_mtu.py
[  PASSED  ] test_config_interface_mtu.py (71.8s)

============================================================
CLI Test Summary
============================================================
  Passed: 2
  Failed: 0
  Total:  2
  Time:   155.8s
```

Detailed output of each test suite:

```
============================================================
CLI E2E Test: config interface <name> description <string>
============================================================

[Step 1] Finding an interface to test...
  Using CLI from FBOSS_CLI_PATH: /home/admin/benoit/fboss2-dev
[CLI] Running: show interface
[CLI] Completed in 18.14s: show interface
  Using interface: eth1/1/1 (VLAN: 2001)

[Step 2] Getting current description...
[CLI] Running: show interface eth1/1/1
[CLI] Completed in 17.78s: show interface eth1/1/1
  Current description: 'Test revision 2'

[Step 3] Setting description to 'CLI_E2E_TEST_DESCRIPTION'...
[CLI] Running: config interface eth1/1/1 description CLI_E2E_TEST_DESCRIPTION
[CLI] Completed in 0.06s: config interface eth1/1/1 description CLI_E2E_TEST_DESCRIPTION
[CLI] Running: config session commit
[CLI] Completed in 7.43s: config session commit
  Description set to 'CLI_E2E_TEST_DESCRIPTION'

[Step 4] Verifying description via 'show interface'...
[CLI] Running: show interface eth1/1/1
[CLI] Completed in 21.38s: show interface eth1/1/1
  Verified: Description is 'CLI_E2E_TEST_DESCRIPTION'

[Step 5] Restoring original description ('Test revision 2')...
[CLI] Running: config interface eth1/1/1 description Test revision 2
[CLI] Completed in 0.05s: config interface eth1/1/1 description Test revision 2
[CLI] Running: config session commit
[CLI] Completed in 6.34s: config session commit
  Restored description to 'Test revision 2'
[CLI] Running: show interface eth1/1/1
[CLI] Completed in 19.31s: show interface eth1/1/1

============================================================
TEST PASSED
============================================================
```
```
============================================================
CLI E2E Test: config interface <name> mtu <N>
============================================================

[Step 1] Finding an interface to test...
  Using CLI from FBOSS_CLI_PATH: /home/admin/benoit/fboss2-dev
[CLI] Running: show interface
[CLI] Completed in 21.35s: show interface
  Using interface: eth1/1/1 (VLAN: 2001)

[Step 2] Getting current MTU...
[CLI] Running: show interface eth1/1/1
[CLI] Completed in 19.47s: show interface eth1/1/1
  Current MTU: 9000

[Step 3] Setting MTU to 1500...
[CLI] Running: config interface eth1/1/1 mtu 1500
[CLI] Completed in 0.06s: config interface eth1/1/1 mtu 1500
[CLI] Running: config session commit
[CLI] Completed in 6.52s: config session commit
  MTU set to 1500

[Step 4] Verifying MTU via 'show interface'...
[CLI] Running: show interface eth1/1/1
[CLI] Completed in 19.33s: show interface eth1/1/1
  Verified: MTU is 1500

[Step 5] Verifying kernel interface MTU...
Running: ip link show fboss2001
  Verified: Kernel interface fboss2001 has MTU 1500

[Step 6] Restoring original MTU (9000)...
[CLI] Running: config interface eth1/1/1 mtu 9000
[CLI] Completed in 0.05s: config interface eth1/1/1 mtu 9000
[CLI] Running: config session commit
[CLI] Completed in 5.60s: config session commit
  Restored MTU to 9000

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

Reviewed By: KevinYakar

Differential Revision: D91234274

Pulled By: joseph5wu

fbshipit-source-id: c17fd9fa5f63b59ceb61bf82f18fc0eee2606dc2
dzarista pushed a commit to dzarista/fboss that referenced this pull request Feb 19, 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`

Add end-to-end tests to be run on an FBOSS DUT to validate CLI commands.

Note: this change is part of a series, the previous one is meta#761, the next one is meta#789.

Pull Request resolved: meta#783

Test Plan:
New end-to-end test coverage for `fboss2-dev config interface <name> mtu <N>` and `fboss2-dev config interface <name> description <string>`

Sample output of `run_test.py cli`:

```
Setting fboss environment variables
Running CLI end-to-end tests...

########## Running CLI test: test_config_interface_description.py
[  PASSED  ] test_config_interface_description.py (84.0s)

########## Running CLI test: test_config_interface_mtu.py
[  PASSED  ] test_config_interface_mtu.py (71.8s)

============================================================
CLI Test Summary
============================================================
  Passed: 2
  Failed: 0
  Total:  2
  Time:   155.8s
```

Detailed output of each test suite:

```
============================================================
CLI E2E Test: config interface <name> description <string>
============================================================

[Step 1] Finding an interface to test...
  Using CLI from FBOSS_CLI_PATH: /home/admin/benoit/fboss2-dev
[CLI] Running: show interface
[CLI] Completed in 18.14s: show interface
  Using interface: eth1/1/1 (VLAN: 2001)

[Step 2] Getting current description...
[CLI] Running: show interface eth1/1/1
[CLI] Completed in 17.78s: show interface eth1/1/1
  Current description: 'Test revision 2'

[Step 3] Setting description to 'CLI_E2E_TEST_DESCRIPTION'...
[CLI] Running: config interface eth1/1/1 description CLI_E2E_TEST_DESCRIPTION
[CLI] Completed in 0.06s: config interface eth1/1/1 description CLI_E2E_TEST_DESCRIPTION
[CLI] Running: config session commit
[CLI] Completed in 7.43s: config session commit
  Description set to 'CLI_E2E_TEST_DESCRIPTION'

[Step 4] Verifying description via 'show interface'...
[CLI] Running: show interface eth1/1/1
[CLI] Completed in 21.38s: show interface eth1/1/1
  Verified: Description is 'CLI_E2E_TEST_DESCRIPTION'

[Step 5] Restoring original description ('Test revision 2')...
[CLI] Running: config interface eth1/1/1 description Test revision 2
[CLI] Completed in 0.05s: config interface eth1/1/1 description Test revision 2
[CLI] Running: config session commit
[CLI] Completed in 6.34s: config session commit
  Restored description to 'Test revision 2'
[CLI] Running: show interface eth1/1/1
[CLI] Completed in 19.31s: show interface eth1/1/1

============================================================
TEST PASSED
============================================================
```
```
============================================================
CLI E2E Test: config interface <name> mtu <N>
============================================================

[Step 1] Finding an interface to test...
  Using CLI from FBOSS_CLI_PATH: /home/admin/benoit/fboss2-dev
[CLI] Running: show interface
[CLI] Completed in 21.35s: show interface
  Using interface: eth1/1/1 (VLAN: 2001)

[Step 2] Getting current MTU...
[CLI] Running: show interface eth1/1/1
[CLI] Completed in 19.47s: show interface eth1/1/1
  Current MTU: 9000

[Step 3] Setting MTU to 1500...
[CLI] Running: config interface eth1/1/1 mtu 1500
[CLI] Completed in 0.06s: config interface eth1/1/1 mtu 1500
[CLI] Running: config session commit
[CLI] Completed in 6.52s: config session commit
  MTU set to 1500

[Step 4] Verifying MTU via 'show interface'...
[CLI] Running: show interface eth1/1/1
[CLI] Completed in 19.33s: show interface eth1/1/1
  Verified: MTU is 1500

[Step 5] Verifying kernel interface MTU...
Running: ip link show fboss2001
  Verified: Kernel interface fboss2001 has MTU 1500

[Step 6] Restoring original MTU (9000)...
[CLI] Running: config interface eth1/1/1 mtu 9000
[CLI] Completed in 0.05s: config interface eth1/1/1 mtu 9000
[CLI] Running: config session commit
[CLI] Completed in 5.60s: config session commit
  Restored MTU to 9000

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

Reviewed By: KevinYakar

Differential Revision: D91234274

Pulled By: joseph5wu

fbshipit-source-id: c17fd9fa5f63b59ceb61bf82f18fc0eee2606dc2
@benoit-nexthop
benoit-nexthop deleted the fboss2-cli-prototype_part09 branch March 20, 2026 09:40
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.

3 participants