[Nexthop][fboss2-dev] Add some end-to-end tests for the CLI#783
Closed
benoit-nexthop wants to merge 1 commit into
Closed
[Nexthop][fboss2-dev] Add some end-to-end tests for the CLI#783benoit-nexthop wants to merge 1 commit into
benoit-nexthop wants to merge 1 commit into
Conversation
This was referenced Jan 7, 2026
2 tasks
c6c7004 to
96c09a3
Compare
d5d2a39 to
7e7098d
Compare
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
7e7098d to
1f5bbfb
Compare
meta-codesync Bot
pushed a commit
that referenced
this pull request
Jan 22, 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` 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. Pull Request resolved: #761 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 | | ``` Reviewed By: srikrishnagopu Differential Revision: D91169265 Pulled By: joseph5wu fbshipit-source-id: 9e77aded8dc19c1fb6b8ce157a2cd14eb73beceb
1f5bbfb to
30d3de1
Compare
Contributor
|
@benoit-nexthop has updated the pull request. You must reimport the pull request before landing. |
Contributor
|
@joseph5wu has imported this pull request. If you are a Meta employee, you can view this in D91234274. |
Contributor
|
@joseph5wu merged this pull request in 7874753. |
meta-codesync Bot
pushed a commit
that referenced
this pull request
Feb 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` 1. 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> ``` 2. 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/conf_metadata.jso`n at the end of each configuration change. And at the end of the commit, it will perform the agent restart. Current proposal has the `wedge_agent` to be restarted. Other agent restart can be added in future. Note: this change is part of a series, the previous one is #783. Pull Request resolved: #789 Test Plan: 1. Tests for the new commands are added in `CmdConfigQosBufferPool`. ``` Test project /var/FBOSS/tmp_bld_dir/build/fboss Start 25: CmdConfigQosBufferPoolTestFixture.bufferPoolNameValidation 1/8 Test #25: CmdConfigQosBufferPoolTestFixture.bufferPoolNameValidation .......... Passed 0.01 sec Start 26: CmdConfigQosBufferPoolTestFixture.bufferBytesValueValidation 2/8 Test #26: CmdConfigQosBufferPoolTestFixture.bufferBytesValueValidation ........ Passed 0.01 sec Start 27: CmdConfigQosBufferPoolTestFixture.sharedBytesCreatesBufferPool 3/8 Test #27: CmdConfigQosBufferPoolTestFixture.sharedBytesCreatesBufferPool ...... Passed 0.02 sec Start 28: CmdConfigQosBufferPoolTestFixture.headroomBytesCreatesBufferPool 4/8 Test #28: CmdConfigQosBufferPoolTestFixture.headroomBytesCreatesBufferPool .... Passed 0.02 sec Start 29: CmdConfigQosBufferPoolTestFixture.reservedBytesCreatesBufferPool 5/8 Test #29: CmdConfigQosBufferPoolTestFixture.reservedBytesCreatesBufferPool .... Passed 0.02 sec Start 30: CmdConfigQosBufferPoolTestFixture.updateExistingBufferPool 6/8 Test #30: CmdConfigQosBufferPoolTestFixture.updateExistingBufferPool .......... Passed 0.03 sec Start 31: CmdConfigQosBufferPoolTestFixture.commandsHaveColdBootActionLevel 7/8 Test #31: CmdConfigQosBufferPoolTestFixture.commandsHaveColdBootActionLevel ... Passed 0.01 sec Start 32: CmdConfigQosBufferPoolTestFixture.printOutputSharedBytes 8/8 Test #32: CmdConfigQosBufferPoolTestFixture.printOutputSharedBytes ............ Passed 0.01 sec 100% tests passed, 0 tests failed out of 8 Total Test time (real) = 0.14 sec ``` 2. Tests for the action on commit are added to existing test `ConfigSessionTestFixture`. ``` Test project /var/FBOSS/tmp_bld_dir/build/fboss Start 45: ConfigSessionTestFixture.sessionInitialization 1/18 Test #45: ConfigSessionTestFixture.sessionInitialization ............... Passed 0.01 sec Start 46: ConfigSessionTestFixture.sessionConfigModified 2/18 Test #46: ConfigSessionTestFixture.sessionConfigModified ............... Passed 0.02 sec Start 47: ConfigSessionTestFixture.sessionCommit 3/18 Test #47: ConfigSessionTestFixture.sessionCommit ....................... Passed 0.12 sec Start 48: ConfigSessionTestFixture.multipleChangesInOneSession 4/18 Test #48: ConfigSessionTestFixture.multipleChangesInOneSession ......... Passed 0.02 sec Start 49: ConfigSessionTestFixture.sessionPersistsAcrossCommands 5/18 Test #49: ConfigSessionTestFixture.sessionPersistsAcrossCommands ....... Passed 0.01 sec Start 50: ConfigSessionTestFixture.symlinkRollbackOnFailure 6/18 Test #50: ConfigSessionTestFixture.symlinkRollbackOnFailure ............ Passed 0.04 sec Start 51: ConfigSessionTestFixture.atomicRevisionCreation 7/18 Test #51: ConfigSessionTestFixture.atomicRevisionCreation .............. Passed 0.05 sec Start 52: ConfigSessionTestFixture.concurrentSessionCreationSameUser 8/18 Test #52: ConfigSessionTestFixture.concurrentSessionCreationSameUser ... Passed 0.04 sec Start 53: ConfigSessionTestFixture.revisionNumberExtraction 9/18 Test #53: ConfigSessionTestFixture.revisionNumberExtraction ............ Passed 0.01 sec Start 54: ConfigSessionTestFixture.rollbackCreatesNewRevision 10/18 Test #54: ConfigSessionTestFixture.rollbackCreatesNewRevision .......... Passed 0.05 sec Start 55: ConfigSessionTestFixture.rollbackToPreviousRevision 11/18 Test #55: ConfigSessionTestFixture.rollbackToPreviousRevision .......... Passed 0.04 sec Start 56: ConfigSessionTestFixture.actionLevelDefaultIsHitless 12/18 Test #56: ConfigSessionTestFixture.actionLevelDefaultIsHitless ......... Passed 0.01 sec Start 57: ConfigSessionTestFixture.actionLevelUpdateAndGet 13/18 Test #57: ConfigSessionTestFixture.actionLevelUpdateAndGet ............. Passed 0.01 sec Start 58: ConfigSessionTestFixture.actionLevelHigherTakesPrecedence 14/18 Test #58: ConfigSessionTestFixture.actionLevelHigherTakesPrecedence .... Passed 0.01 sec Start 59: ConfigSessionTestFixture.actionLevelReset 15/18 Test #59: ConfigSessionTestFixture.actionLevelReset .................... Passed 0.02 sec Start 60: ConfigSessionTestFixture.actionLevelPersistsToMetadataFile 16/18 Test #60: ConfigSessionTestFixture.actionLevelPersistsToMetadataFile ... Passed 0.01 sec Start 61: ConfigSessionTestFixture.actionLevelLoadsFromMetadataFile 17/18 Test #61: ConfigSessionTestFixture.actionLevelLoadsFromMetadataFile .... Passed 0.01 sec Start 62: ConfigSessionTestFixture.actionLevelPersistsAcrossSessions 18/18 Test #62: ConfigSessionTestFixture.actionLevelPersistsAcrossSessions ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 18 Total Test time (real) = 0.51 sec ``` Reviewed By: kevin645 Differential Revision: D91714907 Pulled By: joseph5wu fbshipit-source-id: 7f11ebbe1984247a6c1005d8599858033cfebfbe
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 facebook#761, the next one is facebook#789. Pull Request resolved: facebook#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
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 runSummary
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.
Test Plan
New end-to-end test coverage for
fboss2-dev config interface <name> mtu <N>andfboss2-dev config interface <name> description <string>Sample output of
run_test.py cli:Detailed output of each test suite: