Skip to content

[meta]: Enable validation for SAI_ATTR_VALUE_TYPE_ACL_FIELD_DATA_UINT8_LIST#1856

Open
srodd-nexthop wants to merge 6 commits into
sonic-net:masterfrom
nexthop-ai:srodd.nexthopai.udf
Open

[meta]: Enable validation for SAI_ATTR_VALUE_TYPE_ACL_FIELD_DATA_UINT8_LIST#1856
srodd-nexthop wants to merge 6 commits into
sonic-net:masterfrom
nexthop-ai:srodd.nexthopai.udf

Conversation

@srodd-nexthop
Copy link
Copy Markdown

@srodd-nexthop srodd-nexthop commented Apr 17, 2026

HLD: sonic-net/SONiC#2299

Why I did it

SAI_ATTR_VALUE_TYPE_ACL_FIELD_DATA_UINT8_LIST is the value type used for ACL fields backed by UDF (user-defined field) groups — the byte pattern and mask live in aclfield.data.u8list. In meta/Meta.cpp the validation cases for this type were commented out in all five paths (create, set, get, post_get, post_remove), so UDF ACL matches were being silently skipped by the meta layer.

This blocks the UDF feature being added to orchagent (companion PR: sonic-net/sonic-swss#<4493#>) — without metadata validation, UDF ACL rules don't round-trip correctly through sairedis.

Work item tracking
  • Microsoft ADO (number only): N/A

How I did it

meta/Meta.cpp — uncommented and enabled the SAI_ATTR_VALUE_TYPE_ACL_FIELD_DATA_UINT8_LIST case in:

  • meta_generic_validation_createVALIDATION_LIST(md, value.aclfield.data.u8list) when aclfield.enable is set.
  • meta_generic_validation_set — same, for SET operations.
  • meta_generic_validation_get — unconditional VALIDATION_LIST on get.
  • meta_generic_validation_post_getVALIDATION_LIST_GET when enabled.
  • meta_generic_validation_post_remove — no-op (no object references to decrement for u8list), but the case is now present rather than falling through.

meta/SaiSerialize.cpp — added serialization support for the u8list field so it round-trips through the sairedis record/replay layer.

How to verify it

Build:

  • sairedis builds cleanly (make).
  • Existing meta unit tests pass (make check in meta/ and unittest/).

Runtime (with the companion orchagent PR):

  • Create a UDF group + UDF match via config_db.json; verify sairedis accepts the CREATE for an ACL_ENTRY referencing the UDF group as a match field (visible in sairedis.rec).
  • Confirm syncd receives and applies the ACL_ENTRY attributes including the u8list byte pattern.
  • Without this PR, the same flow silently drops the UDF match validation — any malformed u8list would reach syncd unchecked.

Which release branch to backport (provide reason below if selected)

Not a backport — enables a new feature (UDF ACL matching).

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Tested branch (Please provide the tested image version)

  • master

Description for the changelog

Enable meta validation for SAI_ATTR_VALUE_TYPE_ACL_FIELD_DATA_UINT8_LIST (ACL fields with uint8 list values, used by UDF).

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Apr 17, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@srodd-nexthop
Copy link
Copy Markdown
Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 1856 in repo sonic-net/sonic-sairedis

srodd-nexthop added a commit to nexthop-ai/sonic-mgmt that referenced this pull request May 11, 2026
Adds tests/udf/test_udf.py covering the UDF feature added in
sonic-net/sonic-swss#4493 (UdfOrch), sonic-net/sonic-buildimage#26874
(YANG), and sonic-net/sonic-sairedis#1856 (meta validation).

Registers the suite under t0 and t1-lag in .azure-pipelines/pr_test_scripts.yaml.

Coverage (18 test classes, 30+ test methods):

  - Baseline ASIC_DB programming and CONFIG_DB schema
  - UDP traffic match through UDF-backed ACL fields
  - ACL rule create/delete with UDF dependencies
  - UDF/ACL teardown ordering (correct-order and wrong-order recovery)
  - ACL rule priority shadowing
  - Forward reference resolution (TABLE_TYPE configured before SELECTOR)
  - Multiple selectors per UDF group, distinct OIDs
  - Invalid CONFIG_DB rejection (negative tests)
  - SAI UDF_MATCH/UDF attribute round-trip from CONFIG_DB
  - L3-type auto-mask, L4-port-zero match presence detection
  - Match type filtering at packet level
  - Selector field validation (missing/unknown base, missing match)
  - Selector immutability and idempotent SET handling
  - UDF_MATCH refcount sharing across selectors (dedup)
  - UDF_GROUP refcount layering (TABLE_TYPE / TABLE / multi-table)
  - ACL rule blocking selector deletion
  - Edge cases (rule with UDF not in table, double-delete, type-vs-table
    deletion ordering)
  - End-to-end traffic with full UDF + ACL pipeline

All config done directly via sonic-cfggen -j -w; SAI object lifecycle
verified via ASIC_DB OID diffing.  Module-scoped LogAnalyzer captures
unexpected orchagent errors in non-failing mode (negative tests
deliberately trigger SWSS_LOG_ERRORs that are ignored via regex).

conftest.py overrides yang_validation_check with a UDF-scoped equivalent
that validates only UDF/UDF_SELECTOR tables against sonic-udf.yang
(avoids spurious failures from FLEX_COUNTER_TABLE entries not covered by
installed YANG models on some platforms).

Signed-off-by: satishkumar <srodd@nexthop.ai>
srodd-nexthop added a commit to nexthop-ai/sonic-mgmt that referenced this pull request May 11, 2026
Adds tests/udf/test_udf.py covering the UDF feature added in
sonic-net/sonic-swss#4493 (UdfOrch), sonic-net/sonic-buildimage#26874
(YANG), and sonic-net/sonic-sairedis#1856 (meta validation).

Registers the suite under t0 and t1-lag in .azure-pipelines/pr_test_scripts.yaml.

Coverage (18 test classes, 30+ test methods):

  - Baseline ASIC_DB programming and CONFIG_DB schema
  - UDP traffic match through UDF-backed ACL fields
  - ACL rule create/delete with UDF dependencies
  - UDF/ACL teardown ordering (correct-order and wrong-order recovery)
  - ACL rule priority shadowing
  - Forward reference resolution (TABLE_TYPE configured before SELECTOR)
  - Multiple selectors per UDF group, distinct OIDs
  - Invalid CONFIG_DB rejection (negative tests)
  - SAI UDF_MATCH/UDF attribute round-trip from CONFIG_DB
  - L3-type auto-mask, L4-port-zero match presence detection
  - Match type filtering at packet level
  - Selector field validation (missing/unknown base, missing match)
  - Selector immutability and idempotent SET handling
  - UDF_MATCH refcount sharing across selectors (dedup)
  - UDF_GROUP refcount layering (TABLE_TYPE / TABLE / multi-table)
  - ACL rule blocking selector deletion
  - Edge cases (rule with UDF not in table, double-delete, type-vs-table
    deletion ordering)
  - End-to-end traffic with full UDF + ACL pipeline

All config done directly via sonic-cfggen -j -w; SAI object lifecycle
verified via ASIC_DB OID diffing.  Module-scoped LogAnalyzer captures
unexpected orchagent errors in non-failing mode (negative tests
deliberately trigger SWSS_LOG_ERRORs that are ignored via regex).

Signed-off-by: satishkumar <srodd@nexthop.ai>
srodd-nexthop added a commit to nexthop-ai/sonic-mgmt that referenced this pull request May 11, 2026
Adds tests/udf/test_udf.py covering the UDF feature added in
sonic-net/sonic-swss#4493 (UdfOrch), sonic-net/sonic-buildimage#26874
(YANG), and sonic-net/sonic-sairedis#1856 (meta validation).

Registers the suite under t0 and t1-lag in .azure-pipelines/pr_test_scripts.yaml.

Coverage (18 test classes, 30+ test methods):

  - Baseline ASIC_DB programming and CONFIG_DB schema
  - UDP traffic match through UDF-backed ACL fields
  - ACL rule create/delete with UDF dependencies
  - UDF/ACL teardown ordering (correct-order and wrong-order recovery)
  - ACL rule priority shadowing
  - Forward reference resolution (TABLE_TYPE configured before SELECTOR)
  - Multiple selectors per UDF group, distinct OIDs
  - Invalid CONFIG_DB rejection (negative tests)
  - SAI UDF_MATCH/UDF attribute round-trip from CONFIG_DB
  - L3-type auto-mask, L4-port-zero match presence detection
  - Match type filtering at packet level
  - Selector field validation (missing/unknown base, missing match)
  - Selector immutability and idempotent SET handling
  - UDF_MATCH refcount sharing across selectors (dedup)
  - UDF_GROUP refcount layering (TABLE_TYPE / TABLE / multi-table)
  - ACL rule blocking selector deletion
  - Edge cases (rule with UDF not in table, double-delete, type-vs-table
    deletion ordering)
  - End-to-end traffic with full UDF + ACL pipeline

All config done directly via sonic-cfggen -j -w; SAI object lifecycle
verified via ASIC_DB OID diffing.  Module-scoped LogAnalyzer captures
unexpected orchagent errors in non-failing mode (negative tests
deliberately trigger SWSS_LOG_ERRORs that are ignored via regex).

Signed-off-by: satishkumar <srodd@nexthop.ai>
Signed-off-by: satishkumar rodd <srodd@nexthop.ai>
@srodd-nexthop srodd-nexthop force-pushed the srodd.nexthopai.udf branch from fa97379 to 12393d8 Compare May 11, 2026 17:09
srodd-nexthop added a commit to nexthop-ai/sonic-mgmt that referenced this pull request May 12, 2026
Adds tests/udf/test_udf.py covering the UDF feature added in
sonic-net/sonic-swss#4493 (UdfOrch), sonic-net/sonic-buildimage#26874
(YANG), and sonic-net/sonic-sairedis#1856 (meta validation).

Registers the suite under t0 and t1-lag in .azure-pipelines/pr_test_scripts.yaml.

Coverage (18 test classes, 30+ test methods):

  - Baseline ASIC_DB programming and CONFIG_DB schema
  - UDP traffic match through UDF-backed ACL fields
  - ACL rule create/delete with UDF dependencies
  - UDF/ACL teardown ordering (correct-order and wrong-order recovery)
  - ACL rule priority shadowing
  - Forward reference resolution (TABLE_TYPE configured before SELECTOR)
  - Multiple selectors per UDF group, distinct OIDs
  - Invalid CONFIG_DB rejection (negative tests)
  - SAI UDF_MATCH/UDF attribute round-trip from CONFIG_DB
  - L3-type auto-mask, L4-port-zero match presence detection
  - Match type filtering at packet level
  - Selector field validation (missing/unknown base, missing match)
  - Selector immutability and idempotent SET handling
  - UDF_MATCH refcount sharing across selectors (dedup)
  - UDF_GROUP refcount layering (TABLE_TYPE / TABLE / multi-table)
  - ACL rule blocking selector deletion
  - Edge cases (rule with UDF not in table, double-delete, type-vs-table
    deletion ordering)
  - End-to-end traffic with full UDF + ACL pipeline

All config done directly via sonic-cfggen -j -w; SAI object lifecycle
verified via ASIC_DB OID diffing.  Module-scoped LogAnalyzer captures
unexpected orchagent errors in non-failing mode (negative tests
deliberately trigger SWSS_LOG_ERRORs that are ignored via regex).

Signed-off-by: satishkumar <srodd@nexthop.ai>
Note that the UINT8_LIST ACL field value type is consumed by UDF-backed
ACL match fields, where the byte pattern lives in aclfield.data.u8list.

Signed-off-by: satishkumar rodd <srodd@nexthop.ai>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: satishkumar rodd <srodd@nexthop.ai>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Fixes Build amd64 / BuildAsan amd64 failure:
  aspellcheck.pl: WARNING: Word 'UDF' is misspelled ../meta/Meta.cpp

Signed-off-by: satishkumar rodd <srodd@nexthop.ai>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Fixes SaiSerialize.sai_serialize_attr_value unit test failure:
  C++ exception with description ':- sai_deserialize_list: invalid
  list' thrown in the test body.

The earlier guard (12393d8, a2bdcfa) skipped the '&mask:' portion
when mask.u8list was empty. That broke round-trip: deserialize still
expects the suffix and throws on an empty smask. Reverting to the
unconditional form (matching master and all other ACL field types)
restores symmetry. sai_serialize_number_list handles empty lists
without crashing, as proven by master where this test passes.

Signed-off-by: satishkumar rodd <srodd@nexthop.ai>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: satishkumar rodd <srodd@nexthop.ai>
@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