Skip to content

[acl/tc]: Add SET_TC (TC_ACTION) ACL rule action tests#26099

Open
AnantKishorSharma wants to merge 1 commit into
sonic-net:masterfrom
AnantKishorSharma:acl-set-tc-mgmt-test
Open

[acl/tc]: Add SET_TC (TC_ACTION) ACL rule action tests#26099
AnantKishorSharma wants to merge 1 commit into
sonic-net:masterfrom
AnantKishorSharma:acl-set-tc-mgmt-test

Conversation

@AnantKishorSharma

@AnantKishorSharma AnantKishorSharma commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Why I did it

Add end-to-end tests for the TC_ACTION ACL rule action (SAI SAI_ACL_ENTRY_ATTR_ACTION_SET_TC) added in sonic-net/sonic-swss#4726.

How I did it

Add tests/acl/tc:

  • test_acl_tc_action_programmed (ipv4/ipv6): a FORWARD + TC_ACTION rule goes Active and the ASIC_DB ACL entry carries SAI_ACL_ENTRY_ATTR_ACTION_SET_TC.
  • test_acl_tc_action_invalid_rejected: an out-of-range (256) or non-numeric (ABC) TC value is rejected and never becomes Active.
  • test_acl_tc_action_dataplane (ipv4/ipv6): matched traffic egresses on the TC-mapped unicast queue (e.g. UC3 for TC 3), while an unmatched control flow does not.

A custom TC_L3 ACL table type advertises TC_ACTION (the built-in L3 types do not); tc_acl_table.json / tc_acl_rules.json define the table type and the FORWARD + TC_ACTION rules.

How to verify it

Run on a t0 testbed: ./run_tests.sh -c acl/tc/test_acl_tc.py -n <testbed> -d <dut>.

Validated on a Broadcom TH5 (QFX5241) — 5/5 passed:

================= 5 passed, 358 warnings in 307.18s (0:05:07) =================
tc dataplane [ipv4]: forwarded=1000 UC3(after match)=1000
tc dataplane [ipv4]: ctrl_forwarded=1000 UC3(after ctrl)=0
tc dataplane [ipv6]: forwarded=1000 UC3(after match)=1000
tc dataplane [ipv6]: ctrl_forwarded=1000 UC3(after ctrl)=0

A composed FORWARD + TC_ACTION rule goes Active with ASIC_DB SAI_ACL_ENTRY_ATTR_ACTION_SET_TC = 3, invalid TC values are rejected, and all matched IPv4/IPv6 traffic lands on queue UC3.


Related PRs:

Repo PR title State
sonic-swss aclorch: Support SET_TC (traffic class) ACL rule action state
SONiC doc/acl: Add TC_ACTION (set traffic class) ACL rule action state
sonic-buildimage sonic-yang-models: Add TC_ACTION to sonic-acl state

Cover the TC_ACTION action (SAI SET_TC):
- programmed (ipv4/ipv6): a FORWARD + TC_ACTION rule goes Active with
  SAI_ACL_ENTRY_ATTR_ACTION_SET_TC in ASIC_DB.
- invalid_rejected: an out-of-range or non-numeric TC never goes Active.
- dataplane (ipv4/ipv6): matched traffic egresses on the TC-mapped queue
  (UC<tc>); an unmatched flow does not.

A custom TC_L3 table type advertises TC_ACTION (built-in L3 types do not).

Signed-off-by: Anant Kishor Sharma <anant.kishor-sharma@hpe.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants