You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements fboss2-dev config interface <port-list> profile <profile-id> — the command specified in NOS-4544. Profile-id is a PortProfileID enum string (e.g. PROFILE_100G_4_NRZ_RS528_COPPER, case-insensitive). Setting a profile also updates port->speed() to the corresponding speed derived from PlatformMapping, keeping both fields consistent.
This PR also reverts #635 (which implemented speed under NOS-4544 instead of profile). The speed attribute has been removed from the CLI for now; it will be re-added in a follow-up ticket if needed.
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
@hillol-nexthop : FBOSS has been using this PortProfileID concept to program our port/interface for a long time https://github.com/facebook/fboss/blob/main/fboss/agent/switch_config.thrift#L129
Basically this port profile idea is to capture multiple port speed and phy configs into one single profile so we can program such interface with the specified port profile all at once.
Therefore, I highly recommend to continue using the term of profiles to program port speed instead of the single speed here. Otherwise, fboss2 won't be able to tell which exactly profile to use based on the speed, like when you want to use 200G, you won't be able to tell it's PROFILE_200G_4_PAM4_RS544X2N_COPPER or PROFILE_200G_4_PAM4_RS544X2N_OPTICAL.
Please consider to support the following cli instead
@hillol-nexthop : FBOSS has been using this PortProfileID concept to program our port/interface for a long time https://github.com/facebook/fboss/blob/main/fboss/agent/switch_config.thrift#L129 Basically this port profile idea is to capture multiple port speed and phy configs into one single profile so we can program such interface with the specified port profile all at once. Therefore, I highly recommend to continue using the term of profiles to program port speed instead of the single speed here. Otherwise, fboss2 won't be able to tell which exactly profile to use based on the speed, like when you want to use 200G, you won't be able to tell it's PROFILE_200G_4_PAM4_RS544X2N_COPPER or PROFILE_200G_4_PAM4_RS544X2N_OPTICAL.
Please consider to support the following cli instead
The cli can still use getAllPortSupportedProfiles() to check whether the user input profile is valid or not.
> fboss2 -H rsw029.p066.f01.nha6 show interface eth1/8/5 capabilities
Interface Profiles
-------------------------------------------------------------------
eth1/8/5 PROFILE_100G_4_NRZ_RS528_COPPER
PROFILE_100G_4_NRZ_RS528_OPTICAL
PROFILE_200G_4_PAM4_RS544X2N_COPPER
PROFILE_200G_4_PAM4_RS544X2N_OPTICAL
PROFILE_400G_4_PAM4_RS544X2N_OPTICAL
PROFILE_400G_4_PAM4_RS544X2N_COPPER
> fboss2 -H rsw029.p066.f01.nha6 show interface eth1/8/5
+-----------+--------+-------+------+------+------------------------------+-------------+
| Interface | Status | Speed | VLAN | MTU | Addresses | Description |
-----------------------------------------------------------------------------------------
| eth1/8/5 | down | 200G | 3002 | 9000 | fe80::d849:bfff:fe9c:eae9/64 | |
-----------------------------------------------------------------------------------------
> fboss2 -H rsw029.p066.f01.nha6 show port eth1/8/5
ID Name AdminState LinkState ActiveState Transceiver TcvrID Speed ProfileID HwLogicalPortId Drained PeerSwitchDrained PeerPortDrainedOrDown Errors Core Id Virtual device Id Cable Len meters
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
42 eth1/8/5 Enabled Down -- Present 7 200G PROFILE_200G_4_PAM4_RS544X2N_OPTICAL 36 No -- -- -- -- -- --
Okay I will implement
config interface <> profile
instead of speed.
In that case do we need to query qsfp? I think if we just query agent for supportedProfiles, we can see valid/invalid.
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
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.
Summary
Implements
fboss2-dev config interface <port-list> profile <profile-id>— the command specified in NOS-4544. Profile-id is aPortProfileIDenum string (e.g.PROFILE_100G_4_NRZ_RS528_COPPER, case-insensitive). Setting a profile also updatesport->speed()to the corresponding speed derived from PlatformMapping, keeping both fields consistent.This PR also reverts #635 (which implemented
speedunder NOS-4544 instead ofprofile). Thespeedattribute has been removed from the CLI for now; it will be re-added in a follow-up ticket if needed.New command syntax:
Implementation
Added
ProfileValidatorclass (ProfileValidation.h/.cpp) mirroring theSpeedValidatorpattern:FbossCtrl::getPlatformMapping+QsfpService::getAllPortSupportedProfilesonceparseProfile(): case-insensitive viaTEnumTraits<cfg::PortProfileID>::findValue(toUpper(str))validateProfile(): checks requested profile is in supported list;PROFILE_DEFAULTalways passesgetProfileSpeed()called once before the per-port loop (speed is a property of the profile, not the port — avoids rebuildingPlatformMappingper port)Both
port->profileID()andport->speed()are set on apply, keeping them consistent.Test Plan
Unit tests in
CmdConfigInterfaceTest.cpp(21 new test cases):parseProfileValidUppercase/parseProfileValidLowercase— case-insensitive parsingparseProfileDefault— PROFILE_DEFAULT acceptedparseProfileUnknown/parseProfileEmpty— invalid strings rejectedvalidateProfileSupported— supported profile validated and returnedvalidateProfileDefault— PROFILE_DEFAULT bypasses hardware checkvalidateProfileNotSupported— unsupported profile rejected with helpful errorvalidateProfilePortNotFound— unknown port throws runtime_errorvalidateProfileQsfpPrimaryFallback— QSFP primary, PlatformMapping fallback verifiedgetProfileSpeedKnown/getProfileSpeedUnknown— speed lookup from PlatformMappingqueryClientSetsProfile— full command sets both profileID and speedqueryClientSetsProfileDefault— PROFILE_DEFAULT resets both fieldsqueryClientProfileUnsupportedThrows— unsupported profile rejectedqueryClientProfileInvalidStringThrows— bad string rejected before Thrift callsqueryClientSetProfileMultiPort— all ports updated in multi-port commandqueryClientSetProfileAndDescription— combined attributes work correctlyqueryClientNoAttributesErrorMentionsProfile— error message lists profileIntegration tests added in
ConfigInterfaceProfileTest.cpp:SetValidProfileSuccess,SetInvalidProfileFails,SetProfileDefaultResetsSpeed,SetProfileMultiInterfacePre-submission checklist
pip install -r requirements-dev.txt && pre-commit installpre-commit run