[Nexthop][fboss2-dev] Add lookup-class CLI to config/delete interface commands#1386
Open
vybhav-nexthop wants to merge 2 commits into
Open
[Nexthop][fboss2-dev] Add lookup-class CLI to config/delete interface commands#1386vybhav-nexthop wants to merge 2 commits into
vybhav-nexthop wants to merge 2 commits into
Conversation
Adds a new attribute, lookup-class, to the existing `fboss2-dev config interface` and `delete interface` command families: fboss2-dev config interface <name> lookup-class <id>[,<id>...] fboss2-dev delete interface <name> lookup-class Each front-panel port carries Port.lookupClasses (a list<AclLookupClass> in switch_config.thrift). When non-empty, the agent tags every neighbor learned on that port with one of the class IDs, and ACLs match on those IDs to steer each host's traffic into a specific egress queue — the queue-per-host mechanism used on multi-host NICs (MH-NIC). Behavior: - Set replaces the port's current list with the given list. Real queue-per-host deployments configure the full class pool (e.g. 10,11,12,13,14); a single id is also accepted. - Delete resets the list to empty, the field's default. Deleting individual ids is intentionally not supported — clear-all covers the use case; an id-list delete form can be added later if needed. - Every id must be an integer matching a value of the AclLookupClass thrift enum. Non-numeric input, out-of-range ids, duplicate ids, and empty list slots (10,,11) are all rejected; the enum error lists every valid ID and its name. - The change is staged in a config session and, on commit, flows through the agent's normal port-settings update path (HITLESS). Verified on hardware: committing reloads the config without restarting the agents or disrupting the port. Test Plan: - Unit tests: set path (parse, apply single id and comma-separated lists, replacing an existing list, multiple ports, rejecting non-numeric / out-of-range / duplicate / empty-slot input) and delete path (clear all, idempotent when already empty, multiple ports); full cmd_config_test suite run to check for regressions. - Integration tests against a real switch (an NH-4010-F lab device): every test verifies the port's lookupClasses in the agent running config — rejected inputs assert it is unchanged; happy-path tests pick an eth port with an empty lookupClasses baseline, commit the staged change and verify, then delete + commit and verify it clears, leaving the device in its original state. fboss_sw_agent / fboss_hw_agent@0 stayed active through all commits (hitless).
vybhav-nexthop
force-pushed
the
interface-lookup-class
branch
from
July 15, 2026 14:18
edf1c5e to
1887962
Compare
- Restrict lookup-class to the queue-per-host classes (CLASS_QUEUE_PER_HOST_QUEUE_0..9, ids 10-19). The other AclLookupClass members (CLASS_DROP, DST_CLASS_L3_LOCAL_*, deprecated values) are assigned by the agent itself; configuring one on a port would make LookupClassUpdater tag neighbors with an agent-reserved class. - Accept enum names (case-insensitive) in addition to numeric ids. The error message already displayed the names, but typing one back was rejected. - Stop leaking folly's exception text into the non-numeric error message, matching the mtu handler's style. - Use apache::thrift::util::enumNameSafe instead of the nullable TEnumTraits::findName when formatting the valid-values list. - List lookup-class as a bare attribute name in kValidConfigAttrs like every other valued attribute. - Drop the redundant `seen` set in parseLookupClassList; duplicate detection scans the (enum-bounded) result vector instead. - Integration tests: reuse portLookupClasses() in findEthPortWithEmptyLookupClasses instead of duplicating the ports walk, and clear a committed lookup-class list in TearDown so a test that fails mid-cycle cannot leave the device modified. - Unit tests: cover name input and reserved-class rejection; the multi-port test now uses a queue-per-host class instead of a reserved one.
vybhav-nexthop
force-pushed
the
interface-lookup-class
branch
from
July 15, 2026 14:27
1887962 to
d93b138
Compare
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.
Summary
This PR adds a new attribute,
lookup-class, to the existingfboss2-dev config interfaceanddelete interfacecommand families:What is a lookup class? Each front-panel port in the agent config carries a list field,
Port.lookupClasses(alist<AclLookupClass>inswitch_config.thrift). When this list is non-empty, the agent tags every neighbor (host) learned on that port with one of the class IDs from the list, and ACLs then match on those class IDs to steer each host's traffic into a specific egress queue. This is the mechanism behind the "queue-per-host" feature used on multi-host NICs (MH-NIC): several hosts share one physical switch port, and lookup classes let the switch give each host its own queue so one host cannot starve the others.How the commands behave:
10,11,12,13,14) so the agent can spread hosts across five queues; a single id is also accepted.[]), the field's default ("no per-host classification on this port"). Deleting individual ids from the list is intentionally not supported — clear-all covers the use case; an id-list delete form can be added later if a real need appears.CLASS_QUEUE_PER_HOST_QUEUE_0..9, ids 10-19) are accepted — the otherAclLookupClassmembers (CLASS_DROP,DST_CLASS_L3_LOCAL_*, ...) are assigned by the agent itself and are rejected as reserved. Ids and enum names (case-insensitive) are both accepted. Unknown values, duplicate ids, and empty list slots (10,,11) are all rejected; the error lists every valid id and its name.fboss_sw_agentwithout restarting the agents or disrupting the port.Changed files:
commands/config/interface/CmdConfigInterface.cpplookup-classattribute; id-list parse/validate (enum check, duplicates, empty slots) + applycommands/delete/interface/CmdDeleteInterface.{h,cpp}lookup-classvalueless delete attribute (clearslookupClasses)test/config/CmdConfigInterfaceTest.cpptest/config/CmdDeleteInterfaceTest.cpptest/integration_test/ConfigInterfaceLookupClassTest.cppcmake/CliFboss2TestIntegrationTest.cmake,test/integration_test/BUCKTest Plan
cmd_config_testsuite run to check for regressionslookupClassesin the agent running config — rejected inputs assert it is unchanged; happy-path tests pick an eth port with an empty lookupClasses baseline, commit the staged change and verify the port'slookupClassesin the agent running config, then delete + commit and verify it clears — the device is restored to its original state;fboss_sw_agent/fboss_hw_agent@0stayed active through all commits (hitless)Sample usage, including the committed result in the live agent config: