Repository navigation
[Nexthop][fboss2-dev] Add CLI commands: config vlan port taggingMode and config l2 learning-mode - #896
[Nexthop][fboss2-dev] Add CLI commands: config vlan port taggingMode and config l2 learning-mode#896benoit-nexthop wants to merge 1 commit into
Conversation
b62bedf to
05ea674
Compare
|
mode needs to include priority-tagging as well once switch config starts supporting it |
05ea674 to
2d3ae08
Compare
2d3ae08 to
13a7bfc
Compare
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 change enables running multiple CLI commands within a single process, which is required for C++ end-to-end tests. The first two end-to-end tests that were originally written in Python, along with helper functions, have been rewritten in C++, and can now run as a self-contained gtest binary, without depending on the fboss2-dev binary. Some fixes were necessary to make this work, so the CLI could be re-used as a library instead of being invoked as a subprocess: 1. Remove the `hasRun` static variable from `CmdHandler` - Previously, a static `hasRun` flag prevented commands from executing more than once per process - Now we wrap callbacks in `CmdSubcommands` to check `get_subcommands().empty()` to detect leaf commands, eliminating the need for static state 2. Throw exceptions instead of calling `exit(1)` in `CmdHandler` - `CmdHandler::run()` now rethrows exceptions instead of calling `exit(1)` - This allows tests to catch errors and verify exit codes - `Main.cpp` catches exceptions and returns exit code 1 3. Factor out `CLI::App` initialization into `CliAppInit.h` - Header-only `initApp()` function shared between `Main.cpp` and tests - Eliminates code duplication for CLI setup - This couldn't be packaged into a library of its own without going into circular dependency hell, hence why it's a header-only helper 4. Reset state in `ConfigSession::initializeSession()` - Clear `ConfigSession` attributes when creating a new session (when session file doesn't exist) - Allows re-using the same `ConfigSession` singleton after `commit()` 5. Update state in `ConfigSession::commit()` - Set `base_` to the new commit SHA after successful commit - Set `configLoaded_ = false` to force config reload on next access - Allows re-using the same `ConfigSession` singleton after `commit()` 6. Automatically initialize session in `ConfigSession::loadConfig()` - If session file doesn't exist (e.g., after commit deleted it), call `initializeSession()` to create a fresh session These changes allow the ConfigSession singleton to be properly reused across multiple CLI command invocations within the same process. Note: this change is part of a series, the previous one is #881, the next one is #896. Pull Request resolved: #893 Test Plan: Added new end-to-end tests in C++ that replace `test_config_interface_mtu.py` and `test_config_interface_description.py` (the Python scripts will be removed in a future PR soon). Sample output (simplified, without timestamps and other noise): ``` [==========] Running 2 tests from 2 test suites. [----------] 1 test from ConfigInterfaceDescriptionTest [ RUN ] ConfigInterfaceDescriptionTest.SetAndVerifyDescription [Step 1] Finding an interface to test... Using interface: eth1/1/1 (VLAN: 2001) [Step 2] Getting current description... Current description: 'CLI_E2E_TEST_DESCRIPTION_ALT' [Step 3] Setting description to 'CLI_E2E_TEST_DESCRIPTION'... Description set to 'CLI_E2E_TEST_DESCRIPTION' [Step 4] Verifying description via 'show interface'... Verified: Description is 'CLI_E2E_TEST_DESCRIPTION' [Step 5] Restoring original description ('CLI_E2E_TEST_DESCRIPTION_ALT')... Restored description to 'CLI_E2E_TEST_DESCRIPTION_ALT' TEST PASSED [ OK ] ConfigInterfaceDescriptionTest.SetAndVerifyDescription (412 ms) [----------] 1 test from ConfigInterfaceMtuTest [ RUN ] ConfigInterfaceMtuTest.SetAndVerifyMtu [Step 1] Finding an interface to test... Using interface: eth1/1/1 (VLAN: 2001) [Step 2] Getting current MTU... Current MTU: 9000 [Step 3] Setting MTU to 1500... MTU set to 1500 [Step 4] Verifying MTU via 'show interface'... Verified: MTU is 1500 [Step 5] Verifying kernel interface MTU... Verified: Kernel interface fboss2001 has MTU 1500 [Step 6] Restoring original MTU (9000)... Restored MTU to 9000 TEST PASSED [ OK ] ConfigInterfaceMtuTest.SetAndVerifyMtu (384 ms) [==========] 2 tests from 2 test suites ran. (797 ms total) [ PASSED ] 2 tests. ``` Reviewed By: KevinYakar Differential Revision: D97513684 Pulled By: joseph5wu fbshipit-source-id: d859acf8b875fb09bc215c22b49bac4e0a0321df
e28d152 to
687ddcc
Compare
…-mode Implements two new fboss2-dev CLI commands for switch configuration. Configures the VLAN tagging mode for a port within a VLAN. This controls whether packets are tagged or untagged when egressing the port. Where `<mode>` can be: - `tagged` - Packets egress with VLAN tag - `untagged` - Packets egress without VLAN tag This is a hitless configuration change (no agent restart required). Configures the L2 learning mode (`l2LearningMode` in `SwitchSettings`). This controls how the switch learns MAC addresses. Where `<mode>` can be: - `hardware` - MAC learning is performed by the hardware ASIC - `software` - MAC learning is performed by the software agent - `disabled` - MAC learning is disabled Note: Changing L2 learning mode requires an agent restart (not hitless) because the FBOSS agent does not permit changing this setting after initial config application. **config vlan port taggingMode** (15 test cases): - Argument validation, mode conversion, error handling **config l2 learning-mode** (14 test cases): - Argument validation, mode conversion, error handling **config vlan port taggingMode:** ``` ============================================================ CLI E2E Test: config vlan <id> port <port> taggingMode ============================================================ [Step 1] Finding an interface to test... Using CLI from FBOSS_CLI_PATH: /home/admin/manoharan/fboss2-dev [CLI] Running: show interface [CLI] Completed in 0.08s: show interface Using interface: eth1/1/1 (VLAN: 2001) [Step 2] Getting current tagging mode... [CLI] Running: show running-config [CLI] Completed in 0.07s: show running-config Current mode: untagged [Step 3] Setting tagging mode to 'tagged'... [CLI] Running: config vlan 2001 port eth1/1/1 taggingMode tagged [CLI] Completed in 0.08s: config vlan 2001 port eth1/1/1 taggingMode tagged [CLI] Running: config session commit [CLI] Completed in 0.16s: config session commit Tagging mode set to 'tagged' [Step 4] Verifying tagging mode is 'tagged'... [CLI] Running: show running-config [CLI] Completed in 0.06s: show running-config Verified: Tagging mode is 'tagged' [Step 5] Setting tagging mode to 'untagged'... [CLI] Running: config vlan 2001 port eth1/1/1 taggingMode untagged [CLI] Completed in 0.08s: config vlan 2001 port eth1/1/1 taggingMode untagged [CLI] Running: config session commit [CLI] Completed in 0.15s: config session commit Tagging mode set to 'untagged' [Step 6] Verifying tagging mode is 'untagged'... [CLI] Running: show running-config [CLI] Completed in 0.06s: show running-config Verified: Tagging mode is 'untagged' ============================================================ TEST PASSED ============================================================ ``` **config l2 learning-mode:** ``` ============================================================ CLI E2E Test: config l2 learning-mode <mode> ============================================================ [Step 1] Getting current L2 learning mode... Using CLI from FBOSS_CLI_PATH: /home/admin/manoharan/fboss2-dev [CLI] Running: show running-config [CLI] Completed in 0.06s: show running-config Current mode: hardware [Step 2] Setting L2 learning mode to 'software'... [CLI] Running: config l2 learning-mode software [CLI] Completed in 0.07s: config l2 learning-mode software [CLI] Running: config session commit [CLI] Completed in 2.88s: config session commit Waiting for agent to be ready after restart... Sleeping 30s for agent restart... L2 learning mode set to 'software' [Step 3] Verifying L2 learning mode is 'software'... [CLI] Running: show running-config [CLI] Completed in 0.06s: show running-config Verified: L2 learning mode is 'software' [Step 4] Setting L2 learning mode to 'hardware'... [CLI] Running: config l2 learning-mode hardware [CLI] Completed in 0.08s: config l2 learning-mode hardware [CLI] Running: config session commit [CLI] Completed in 3.51s: config session commit Waiting for agent to be ready after restart... Sleeping 30s for agent restart... L2 learning mode set to 'hardware' [Step 5] Verifying L2 learning mode is 'hardware'... [CLI] Running: show running-config [CLI] Completed in 0.06s: show running-config Verified: L2 learning mode is 'hardware' ============================================================ TEST PASSED ============================================================ ``` ``` [admin@fboss101 ~]$ fboss2-dev config vlan 2001 port eth1/1/1 taggingMode untagged Successfully set tagging mode for port 'eth1/1/1' in VLAN 2001 to 'untagged' [admin@fboss101 ~]$ fboss2-dev config l2 learning-mode software Successfully set L2 learning mode to 'software' [admin@fboss101 ~]$ fboss2-dev config session commit wedge_agent restarted, config committed ```
687ddcc to
c9fa106
Compare
|
@joseph5wu has imported this pull request. If you are a Meta employee, you can view this in D98023658. |
joseph5wu
left a comment
There was a problem hiding this comment.
The way that you handle kAdditionalCommandTree() is wrong.
https://github.com/facebook/fboss/blob/main/fboss/cli/fboss2/utils/CmdInitUtils.cpp#L25
We can only use one definition of kAdditionalCommandTree() to init CmdSubcommands::getInstance().
And if we implement such functions in multiple cpp, each fboss2 binary(fboss2 or fboss2-dev) can only include one implementation cpp only.
I'm already seeing this issue in our internal buck build. As you can see, I would expect both fboss2 and fboss2-dev should have 4 different set commands. However, because you made "fboss2-dev" to include "oss/CmdListConfig.cpp",; this dropped all our existing meta internal implementation of kAdditionalCommandTree()
> buck run fbcode//fboss/cli/fboss2:fboss2-dev -- set --help
Options:
-h,--help Print this help message and exit
Subcommands:
interface Set Interface information
port Set Port information
> fboss2 set --help
Set object
Usage: fboss2 set [OPTIONS] [SUBCOMMAND]
Options:
-h,--help Print this help message and exit
Subcommands:
interface Set Interface information
port Set Port information
debug Set debug level
fanhold Set fan hold PWM
| # CLI tests are platform/SAI independent - they test the CLI binary which | ||
| # communicates with the agent via Thrift, without running the actual fboss2-dev | ||
| # binary. | ||
| # These tests require a live FBOSS agent running on the device and should |
There was a problem hiding this comment.
Let's also keep the old comment
| fboss/cli/fboss2/CmdHandlerImpl.cpp | ||
| fboss/cli/fboss2/CmdArgsLists.cpp | ||
| fboss/cli/fboss2/CmdList.cpp | ||
| fboss/cli/fboss2/oss/CmdListShowConfig.cpp |
There was a problem hiding this comment.
Move it after line 529: fboss/cli/fboss2/oss/CmdList.cpp
|
@joseph5wu merged this pull request in 06c3d2b. |
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 CLI commands to configure the dscpMaps, expMaps, and pcpMaps attributes of the QosMap object within a QosPolicy. These commands allow configuring bidirectional mappings between codepoint values and internal traffic classes. New CLI commands: - DSCP maps (RFC 2474, values 0-63): - `config qos policy <name> map dscp <value> traffic-class <tc>` - `config qos policy <name> map traffic-class <tc> dscp <value>` - MPLS EXP maps (RFC 3032/5462, values 0-7): - `config qos policy <name> map mpls-exp <value> traffic-class <tc>` - `config qos policy <name> map traffic-class <tc> mpls-exp <value>` - DOT1P/PCP maps (802.1Q, values 0-7): - `config qos policy <name> map dot1p <value> traffic-class <tc>` - `config qos policy <name> map traffic-class <tc> dot1p <value>` The first command in each pair is additive (ingress classification - multiple codepoints can map to the same traffic class), while the second is not additive (egress rewrite - one traffic class maps to one codepoint value). Note: this change is part of a series, the previous one is #896, the next one is #919. Pull Request resolved: #900 Add CLI commands to configure the dscpMaps, expMaps, and pcpMaps attributes of the QosMap object within a QosPolicy. These commands allow configuring bidirectional mappings between codepoint values and internal traffic classes. New CLI commands: - DSCP maps (RFC 2474, values 0-63): - `config qos policy <name> map dscp <value> traffic-class <tc>` - `config qos policy <name> map traffic-class <tc> dscp <value>` - MPLS EXP maps (RFC 3032/5462, values 0-7): - `config qos policy <name> map mpls-exp <value> traffic-class <tc>` - `config qos policy <name> map traffic-class <tc> mpls-exp <value>` - DOT1P/PCP maps (802.1Q, values 0-7): - `config qos policy <name> map dot1p <value> traffic-class <tc>` - `config qos policy <name> map traffic-class <tc> dot1p <value>` The first command in each pair is additive (ingress classification - multiple codepoints can map to the same traffic class), while the second is not additive (egress rewrite - one traffic class maps to one codepoint value). Test Plan: New end to end tests: ``` Note: Google Test filter = *ConfigQosPolicyMapTest* [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from ConfigQosPolicyMapTest [ RUN ] ConfigQosPolicyMapTest.CreateSamplePolicy I0204 18:36:53.719844 63663 CliTest.cpp:35] CliTest::SetUp - starting CLI test I0204 18:36:53.719979 63663 ConfigQosPolicyMapTest.cpp:63] Using test policy name: cli_e2e_test_qos_policy_1770259013719 I0204 18:36:53.719994 63663 ConfigQosPolicyMapTest.cpp:229] ======================================== I0204 18:36:53.719999 63663 ConfigQosPolicyMapTest.cpp:230] ConfigQosPolicyMapTest::CreateSamplePolicy I0204 18:36:53.720004 63663 ConfigQosPolicyMapTest.cpp:231] ======================================== I0204 18:36:53.720008 63663 ConfigQosPolicyMapTest.cpp:242] [Step 1] Configuring DOT1P/PCP maps... I0204 18:36:53.720016 63663 CliTest.cpp:118] Running CLI command: config qos policy cli_e2e_test_qos_policy_1770259013719 map dot1p 0 traffic-class 0 I0204 18:36:53.761480 63663 ConfigQosPolicyMapTest.cpp:102] Command: dot1p 0 traffic-class 0 I0204 18:36:53.761503 63663 ConfigQosPolicyMapTest.cpp:104] stdout: {"localhost":"Successfully set QoS policy 'cli_e2e_test_qos_policy_1770259013719' pcpMaps.fromPcpToTrafficClass [tc=0] = 0"} [... additional map configuration commands ...] I0204 18:36:53.985447 63663 ConfigQosPolicyMapTest.cpp:276] DOT1P maps configured I0204 18:36:53.985452 63663 ConfigQosPolicyMapTest.cpp:279] [Step 2] Configuring traffic-class-to-queue mappings... I0204 18:36:53.985462 63663 CliTest.cpp:118] Running CLI command: config qos policy cli_e2e_test_qos_policy_1770259013719 map tc-to-queue 0 0 I0204 18:36:54.002140 63663 ConfigQosPolicyMapTest.cpp:128] Command: tc-to-queue 0 0 I0204 18:36:54.002164 63663 ConfigQosPolicyMapTest.cpp:129] stdout: {"localhost":"Successfully set QoS policy 'cli_e2e_test_qos_policy_1770259013719' trafficClassToQueueId [0] = 0"} [... additional tc-to-queue commands ...] I0204 18:36:54.091056 63663 ConfigQosPolicyMapTest.cpp:286] TC-to-queue mappings configured I0204 18:36:54.091071 63663 ConfigQosPolicyMapTest.cpp:289] [Step 3] Committing config... I0204 18:36:54.091084 63663 CliTest.cpp:118] Running CLI command: config session commit I0204 18:36:54.316841 63663 ConfigQosPolicyMapTest.cpp:291] Config committed I0204 18:36:54.316868 63663 ConfigQosPolicyMapTest.cpp:294] [Step 4] Verifying config was applied... I0204 18:36:54.326264 63663 ConfigQosPolicyMapTest.cpp:297] Got running config from agent I0204 18:36:54.326306 63663 ConfigQosPolicyMapTest.cpp:303] Found test policy in running config I0204 18:36:54.326319 63663 ConfigQosPolicyMapTest.cpp:314] Verified pcpMaps has 6 entries I0204 18:36:54.326344 63663 ConfigQosPolicyMapTest.cpp:329] All pcpMap entries verified I0204 18:36:54.326363 63663 ConfigQosPolicyMapTest.cpp:347] trafficClassToQueueId verified I0204 18:36:54.326374 63663 ConfigQosPolicyMapTest.cpp:349] TEST PASSED [ OK ] ConfigQosPolicyMapTest.CreateSamplePolicy (607 ms) [----------] 1 test from ConfigQosPolicyMapTest (607 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (607 ms total) [ PASSED ] 1 test. ``` ## Sample usage CLI: Add DSCP, EXP, and DOT1P map configuration commands New end to end tests: ``` Note: Google Test filter = *ConfigQosPolicyMapTest* [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from ConfigQosPolicyMapTest [ RUN ] ConfigQosPolicyMapTest.CreateSamplePolicy I0204 18:36:53.719844 63663 CliTest.cpp:35] CliTest::SetUp - starting CLI test I0204 18:36:53.719979 63663 ConfigQosPolicyMapTest.cpp:63] Using test policy name: cli_e2e_test_qos_policy_1770259013719 I0204 18:36:53.719994 63663 ConfigQosPolicyMapTest.cpp:229] ======================================== I0204 18:36:53.719999 63663 ConfigQosPolicyMapTest.cpp:230] ConfigQosPolicyMapTest::CreateSamplePolicy I0204 18:36:53.720004 63663 ConfigQosPolicyMapTest.cpp:231] ======================================== I0204 18:36:53.720008 63663 ConfigQosPolicyMapTest.cpp:242] [Step 1] Configuring DOT1P/PCP maps... I0204 18:36:53.720016 63663 CliTest.cpp:118] Running CLI command: config qos policy cli_e2e_test_qos_policy_1770259013719 map dot1p 0 traffic-class 0 I0204 18:36:53.761480 63663 ConfigQosPolicyMapTest.cpp:102] Command: dot1p 0 traffic-class 0 I0204 18:36:53.761503 63663 ConfigQosPolicyMapTest.cpp:104] stdout: {"localhost":"Successfully set QoS policy 'cli_e2e_test_qos_policy_1770259013719' pcpMaps.fromPcpToTrafficClass [tc=0] = 0"} [... additional map configuration commands ...] I0204 18:36:53.985447 63663 ConfigQosPolicyMapTest.cpp:276] DOT1P maps configured I0204 18:36:53.985452 63663 ConfigQosPolicyMapTest.cpp:279] [Step 2] Configuring traffic-class-to-queue mappings... I0204 18:36:53.985462 63663 CliTest.cpp:118] Running CLI command: config qos policy cli_e2e_test_qos_policy_1770259013719 map tc-to-queue 0 0 I0204 18:36:54.002140 63663 ConfigQosPolicyMapTest.cpp:128] Command: tc-to-queue 0 0 I0204 18:36:54.002164 63663 ConfigQosPolicyMapTest.cpp:129] stdout: {"localhost":"Successfully set QoS policy 'cli_e2e_test_qos_policy_1770259013719' trafficClassToQueueId [0] = 0"} [... additional tc-to-queue commands ...] I0204 18:36:54.091056 63663 ConfigQosPolicyMapTest.cpp:286] TC-to-queue mappings configured I0204 18:36:54.091071 63663 ConfigQosPolicyMapTest.cpp:289] [Step 3] Committing config... I0204 18:36:54.091084 63663 CliTest.cpp:118] Running CLI command: config session commit I0204 18:36:54.316841 63663 ConfigQosPolicyMapTest.cpp:291] Config committed I0204 18:36:54.316868 63663 ConfigQosPolicyMapTest.cpp:294] [Step 4] Verifying config was applied... I0204 18:36:54.326264 63663 ConfigQosPolicyMapTest.cpp:297] Got running config from agent I0204 18:36:54.326306 63663 ConfigQosPolicyMapTest.cpp:303] Found test policy in running config I0204 18:36:54.326319 63663 ConfigQosPolicyMapTest.cpp:314] Verified pcpMaps has 6 entries I0204 18:36:54.326344 63663 ConfigQosPolicyMapTest.cpp:329] All pcpMap entries verified I0204 18:36:54.326363 63663 ConfigQosPolicyMapTest.cpp:347] trafficClassToQueueId verified I0204 18:36:54.326374 63663 ConfigQosPolicyMapTest.cpp:349] TEST PASSED [ OK ] ConfigQosPolicyMapTest.CreateSamplePolicy (607 ms) [----------] 1 test from ConfigQosPolicyMapTest (607 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (607 ms total) [ PASSED ] 1 test. ``` ## Sample usage ``` admin@fboss101:~/benoit$ ./fboss2-dev config qos policy test-policy map dscp 10 traffic-class 1 Successfully set QoS policy 'test-policy' dscpMaps.fromDscpToTrafficClass [tc=1] = 10 admin@fboss101:~/benoit$ ./fboss2-dev config qos policy test-policy map dscp 20 traffic-class 1 Successfully set QoS policy 'test-policy' dscpMaps.fromDscpToTrafficClass [tc=1] = 20 admin@fboss101:~/benoit$ ./fboss2-dev config qos policy test-policy map traffic-class 1 dscp 10 Successfully set QoS policy 'test-policy' dscpMaps.fromTrafficClassToDscp [tc=1] = 10 admin@fboss101:~/benoit$ ./fboss2-dev config qos policy test-policy map mpls-exp 3 traffic-class 2 Successfully set QoS policy 'test-policy' expMaps.fromExpToTrafficClass [tc=2] = 3 admin@fboss101:~/benoit$ ./fboss2-dev config qos policy test-policy map traffic-class 2 mpls-exp 3 Successfully set QoS policy 'test-policy' expMaps.fromTrafficClassToExp [tc=2] = 3 admin@fboss101:~/benoit$ ./fboss2-dev config qos policy test-policy map dot1p 5 traffic-class 3 Successfully set QoS policy 'test-policy' pcpMaps.fromPcpToTrafficClass [tc=3] = 5 admin@fboss101:~/benoit$ ./fboss2-dev config qos policy test-policy map traffic-class 3 dot1p 5 Successfully set QoS policy 'test-policy' pcpMaps.fromTrafficClassToPcp [tc=3] = 5 admin@fboss101:~/benoit$ ./fboss2-dev config session diff --- current live config +++ session config @@ -6244,6 +6244,41 @@ } }, "rules": [] + }, + { + "name": "test-policy", + "qosMap": { + "dscpMaps": [ + { + "fromDscpToTrafficClass": [ + 10, + 20 + ], + "fromTrafficClassToDscp": 10, + "internalTrafficClass": 1 + } + ], + "expMaps": [ + { + "fromExpToTrafficClass": [ + 3 + ], + "fromTrafficClassToExp": 3, + "internalTrafficClass": 2 + } + ], + "pcpMaps": [ + { + "fromPcpToTrafficClass": [ + 5 + ], + "fromTrafficClassToPcp": 5, + "internalTrafficClass": 3 + } + ], + "trafficClassToQueueId": {} + }, + "rules": [] } ], "sFlowCollectors": [], [...] ``` Reviewed By: srikrishnagopu Differential Revision: D98233654 Pulled By: joseph5wu fbshipit-source-id: 4c036620bd08935f3ac5535d244b51293fb8d542
Summary: In PR #896 (commit 06c3d2b) I forgot to move new test files to `fboss/cli/fboss2/test/config` as well as adjust the tests to the use the new base class. Pull Request resolved: #1036 Test Plan: Existing tests still pass. Reviewed By: KevinYakar Differential Revision: D98312988 Pulled By: joseph5wu fbshipit-source-id: 4e57cf8c6f6ac933f6e8242c4d387ae45e3d94e0
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit installpre-commit runSummary
Implements two new fboss2-dev CLI commands for switch configuration.
1. config vlan port taggingMode
Configures the VLAN tagging mode for a port within a VLAN. This controls whether packets are tagged or untagged when egressing the port. Where
<mode>can be:tagged- Packets egress with VLAN taguntagged- Packets egress without VLAN tagThis is a hitless configuration change (no agent restart required).
2. config l2 learning-mode
Configures the L2 learning mode (
l2LearningModeinSwitchSettings). This controls how the switch learns MAC addresses. Where<mode>can be:hardware- MAC learning is performed by the hardware ASICsoftware- MAC learning is performed by the software agentdisabled- MAC learning is disabledNote: Changing L2 learning mode requires an agent restart (not hitless) because the FBOSS agent does not permit changing this setting after initial config application.
Note: this change is part of a series, the previous one is #893, the next one is #900.
This change was originally developed by @manoharan-nexthop
Test Plan
Unit tests
End-to-end tests
config vlan port taggingMode:
config l2 learning-mode:
Sample usage
CLI: Add DSCP, EXP, and DOT1P map configuration commands
Summary
Add CLI commands to configure the dscpMaps, expMaps, and pcpMaps
attributes of the QosMap object within a QosPolicy. These commands
allow configuring bidirectional mappings between codepoint values
and internal traffic classes.
New CLI commands:
config qos policy <name> map dscp <value> traffic-class <tc>config qos policy <name> map traffic-class <tc> dscp <value>config qos policy <name> map mpls-exp <value> traffic-class <tc>config qos policy <name> map traffic-class <tc> mpls-exp <value>config qos policy <name> map dot1p <value> traffic-class <tc>config qos policy <name> map traffic-class <tc> dot1p <value>The first command in each pair is additive (ingress classification -
multiple codepoints can map to the same traffic class), while the
second is not additive (egress rewrite - one traffic class maps to
one codepoint value).
Test Plan
New end to end tests:
Sample usage