[Nexthop][fboss2-dev] Add fboss2-dev config acl CLI subcommands#1370
Open
benoit-nexthop wants to merge 1 commit into
Open
[Nexthop][fboss2-dev] Add fboss2-dev config acl CLI subcommands#1370benoit-nexthop wants to merge 1 commit into
benoit-nexthop wants to merge 1 commit into
Conversation
Add two new subcommands under `config acl`:
config acl table-group <group-name> stage <stage-value>
Sets AclTableGroup.stage (AclStage enum: ingress, ingress-macsec,
egress-macsec, ingress-post-lookup, or numeric 0-3).
config acl table <group-name> <table-name> priority <value>
Sets AclTable.priority (non-negative i16).
Both commands target sw.aclTableGroups (field 56, the preferred form);
the deprecated aclTableGroup (field 45) is not supported. When
FLAGS_enable_acl_table_group is set, both changes are applied at
runtime via processAclTableGroupDelta in SaiSwitch with no
warmboot-prohibited guard, so the CLI marks them HITLESS. When that
flag is off (the default on some platforms today), aclTableGroups
changes take a different code path in SaiSwitch; this PR only adds the
CLI plumbing and was validated against a DUT with the flag off, so the
flag-on runtime path is not covered by the included tests.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
joseph5wu
requested changes
Jul 15, 2026
joseph5wu
left a comment
Contributor
There was a problem hiding this comment.
Let's support create if not exist for both acl table group and acl table
| * 45, is not supported). Throws std::runtime_error if aclTableGroups is | ||
| * unset/empty, or if no group with that name exists. | ||
| */ | ||
| cfg::AclTableGroup& findAclTableGroupOrThrow( |
Contributor
There was a problem hiding this comment.
Can we consider to create a new acl table group if it doesn't exist?
| if (it != kAclStageByName.end()) { | ||
| return it->second; | ||
| } | ||
| // Numeric fallback. |
Contributor
There was a problem hiding this comment.
I wouldn't recommend to use Numeric fallback cause they're not straightforward.
Let's just enforce the string values as the only options
| std::find_if(tables.begin(), tables.end(), [&](const cfg::AclTable& t) { | ||
| return *t.name() == args.getTableName(); | ||
| }); | ||
| if (tableIt == tables.end()) { |
Contributor
There was a problem hiding this comment.
Let's also support create an acl table if it doesn't exist
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
Adds two new subcommands under
config aclfor configuring ACL table groups and tables:config acl table-group <group-name> stage <stage-value>— setsAclTableGroup.stage(enum:ingress,ingress-macsec,egress-macsec,ingress-post-lookup, or numeric 0–3)config acl table <group-name> <table-name> priority <value>— setsAclTable.priority(non-negative i16)The Thrift model has a two-level key structure (AclTableGroup → AclTable). Both commands target
sw.aclTableGroups(field 56, the preferred form); the deprecatedaclTableGroup(field 45) is not supported.When
FLAGS_enable_acl_table_groupis set, both changes are applied at runtime viaprocessAclTableGroupDeltain SaiSwitch with no warmboot-prohibited guard, so the CLI marks them HITLESS. When that flag is off (the default on some platforms today),aclTableGroupschanges take a different code path in SaiSwitch; this PR only adds the CLI plumbing and was validated against a DUT with the flag off, so the flag-on runtime path is not covered by the included tests (see Test Plan).Group/table lookup logic shared between the two subcommand handlers lives in
AclConfigUtils.{h,cpp}rather than being duplicated between thetableandtable-grouphandlers.Test Plan
Unit tests (19/19 passing)
The seed config includes two table groups (the first with two tables), so tests can assert that mutating the targeted group/table leaves its siblings untouched, and dedicated tests target the non-first group/table by name — with only one group/table, or only ever mutating index 0, a
find_ifbug that matched "first element" instead of "match by name" would pass undetected. A separate fixture with noaclTableGroupsat all covers the "no aclTableGroups configured" error branch shared by both handlers.Integration tests (NH-4010-F — skipped: DUT has no sw.aclTableGroups)
The NH-4010-F DUT used for testing uses a single flat ACL map without ACL table groups (
FLAGS_enable_acl_table_groupis off / field 56 absent). The integration tests detect this and skip gracefully:Sample CLI transcript (NH-4010-F)