Skip to content

UDF yang model definition.#26874

Draft
srodd-nexthop wants to merge 1 commit intosonic-net:masterfrom
nexthop-ai:srodd.nexthopai.udf.yang
Draft

UDF yang model definition.#26874
srodd-nexthop wants to merge 1 commit intosonic-net:masterfrom
nexthop-ai:srodd.nexthopai.udf.yang

Conversation

@srodd-nexthop
Copy link
Copy Markdown

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

Why I did it

Adds the YANG model for the new UDF (User-Defined Field) feature in SONiC. UDF allows ACLs to match on arbitrary byte offsets within a packet, enabling classification of protocols not covered by standard ACL fields (e.g., RoCEv2 BTH, GRE inner headers).

The companion orchagent implementation is in [sonic-net/sonic-swss#<4493#>]. This PR adds only the YANG schema.

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

How I did it

Added src/sonic-yang-models/yang-models/sonic-udf.yang defining two CONFIG_DB tables:

  • UDF — UDF field definition. Keys: UDF_NAME. Fields: length (1–20), field_type (GENERIC|HASH), description.
  • UDF_SELECTOR — per-packet-type extraction rule. Keys: UDF_NAME|SELECTOR_NAME. Fields: select and match, each a JSON-encoded object:
    • select{ base: L2|L3|L4, offset: 0–255 }
    • match{ l2_type, l2_type_mask, l3_type, l3_type_mask, gre_type, gre_type_mask, l4_dst_port, l4_dst_port_mask, priority }

UDF_SELECTOR.UDF_NAME is a leafref to UDF.UDF_NAME.

Also updated:

  • src/sonic-yang-models/setup.py to register the new module.
  • src/sonic-yang-models/tests/files/sample_config_db.json with a UDF + UDF_SELECTOR example for validation.

How to verify it

cd src/sonic-yang-models
python3 setup.py test

The sample_config_db.json additions exercise the new leafrefs and the JSON-string fields; validation should pass cleanly.

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

Not a backport — new feature.

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

Tested branch (Please provide the tested image version)

  • master

Description for the changelog

Add YANG model for UDF (UDF and UDF_SELECTOR tables) to support ACL matching on user-defined byte offsets.

@linux-foundation-easycla
Copy link
Copy Markdown

CLA Not Signed

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@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