You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[UDF HLD] Expand section 10 with detailed test scenarios
Replaces the high-level test categories in section 10 with explicit
test scenarios drawn from the sonic-mgmt UDF suite, following the
Step / Goal / Expected results format used in the Overlay ECMP HLD.
10.2 System Tests now covers:
- Baseline programming
- End-to-end traffic
- UDF/ACL dependency and teardown order
- ACL rule priority
- Forward reference resolution
- Multiple selectors per group
- SAI attribute correctness (all 4 match types, 3 bases, auto-mask,
match-presence regressions)
- Match-type traffic filtering (L2 / L4 / IPv6)
- Reference counting (UDF_MATCH dedup, UDF_GROUP refcount layers,
ACL_RULE refcount on selectors)
- Immutability and idempotency
- Validation edge cases
10.3 Negative Tests:
- Invalid CONFIG_DB
- Selector field validation
Each subsection references the corresponding test class(es) in the
sonic-mgmt suite (tests/udf/test_udf.py, parallel PR -- Open Item #9).
Addresses prsunny review comment.
Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
-**ACL Integration**: UDF fields in ACL tables/rules, dynamic resolution
648
-
-**Error Handling**: SAI failures, invalid configs, missing dependencies
649
-
-**Scale**: Max objects, performance (< 1s for 100 objects)
649
+
650
+
System tests live in `sonic-net/sonic-mgmt` at `tests/udf/test_udf.py` (sonic-mgmt PR — Open Item #9). Topology: one DUT + PTF (`pytest.mark.topology("t0", "t1")`). All CONFIG_DB writes go through `sonic-cfggen -j -w`; SAI object correctness is verified by diffing ASIC_DB OID sets before and after each operation.
651
+
652
+
Module baseline (programmed by the suite's setup fixture):
| Send 500 UDP packets `sport=0x3232 dport=0x3232`| UDF mask check | No match (mask 0xff requires exact 0x33) |
683
+
| Delete `RULE_UDP` from CONFIG_DB | ACL rule remove |`ACL_ENTRY` OID for `RULE_UDP` removed; G0 selectors retained |
684
+
685
+
#### 10.2.3 UDF/ACL dependency and teardown order
686
+
687
+
| Step | Goal | Expected results |
688
+
|-|-|-|
689
+
| Delete `UDF\|G0` while selectors and rules still reference it | Wrong-order delete — recoverable | UDF_GROUP retained; orchagent logs error; correct-order delete after still succeeds |
690
+
| Top-down teardown: rules → selectors → group | Ordered teardown | All ACL_ENTRY / UDF / UDF_GROUP OIDs removed in dependency order; recreate works |
691
+
692
+
#### 10.2.4 ACL rule priority
693
+
694
+
| Step | Goal | Expected results |
695
+
|-|-|-|
696
+
| Install `R_LOW` (priority=50, G0=0x33) and `RULE_UDP` (priority=200, G0=0x33); send matching UDP | Higher rule priority wins |`RULE_UDP` counter increments; `R_LOW` does not |
697
+
698
+
#### 10.2.5 Forward reference resolution
699
+
700
+
| Step | Goal | Expected results |
701
+
|-|-|-|
702
+
| Write `ACL_TABLE_TYPE\|T_FWD` (references `G_FWD`) before `UDF\|G_FWD` and `UDF_SELECTOR\|G_FWD\|test` exist; then create them | Forward reference resolves | TABLE_TYPE OID appears only after `G_FWD` + selector arrive |
703
+
704
+
#### 10.2.6 Multiple selectors per group
705
+
706
+
| Step | Goal | Expected results |
707
+
|-|-|-|
708
+
| Baseline: G0 with 2 selectors, G1 with 1 selector | Distinct selectors — distinct OIDs | ≥ 2 SAI UDF OIDs for G0, ≥ 1 for G1; distinct match configs produce distinct UDF_MATCH OIDs |
709
+
710
+
#### 10.2.7 SAI attribute correctness
711
+
712
+
Covers all four match-type round-trips, all three base round-trips, auto-mask fill, and match-presence regressions.
713
+
714
+
| Step | Goal | Expected results |
715
+
|-|-|-|
716
+
| Selector `match_l2_type=0x0800`| L2_TYPE attr round-trip | UDF_MATCH OID has `SAI_UDF_MATCH_ATTR_L2_TYPE = 0x0800`|
717
+
| Selector `match_l3_type=0x06`| L3_TYPE attr round-trip | UDF_MATCH OID has `SAI_UDF_MATCH_ATTR_L3_TYPE = 0x06`|
718
+
| Selector `match_gre_type=0x6558`| GRE_TYPE attr round-trip | UDF_MATCH OID has `SAI_UDF_MATCH_ATTR_GRE_TYPE = 0x6558`|
719
+
| Selector `match_l4_dst_port=0x12B7`| L4_DST_PORT attr round-trip | UDF_MATCH OID has `SAI_UDF_MATCH_ATTR_L4_DST_PORT_TYPE = 0x12B7`|
720
+
| Selector `match_l3_type=0x06` with no explicit mask | Auto-mask fill | UDF_MATCH `L3_TYPE` mask = 0xFF |
721
+
| Selector `select_base=L2 select_offset=12`| L2 base round-trip | UDF OID has `SAI_UDF_ATTR_BASE = SAI_UDF_BASE_L2`|
722
+
| Selector `select_base=L3 select_offset=4`| L3 base round-trip | UDF OID has BASE = `SAI_UDF_BASE_L3`|
723
+
| Selector `select_base=L4 select_offset=0`| L4 base round-trip | UDF OID has BASE = `SAI_UDF_BASE_L4`|
724
+
| Selector `match_l4_dst_port=0` with explicit `mask=0xFFFF`| Port-0 match — explicit | UDF_MATCH OID has L4_DST_PORT=0, MASK=0xFFFF |
725
+
| Selector `match_l4_dst_port=0` with no mask | Port-0 match — auto-fill | UDF_MATCH OID present; port-0 is matchable |
726
+
| Selector with only `match_l2_type=0x0800` (no other match fields) | Single-field match | UDF_MATCH OID created with L2_TYPE attr |
Covers UDF_MATCH dedup across groups, UDF_GROUP refcount across ACL layers, and ACL_RULE refcount on selectors.
740
+
741
+
| Step | Goal | Expected results |
742
+
|-|-|-|
743
+
| Two selectors in different groups with identical match config | UDF_MATCH dedup | One shared UDF_MATCH OID; removing one selector retains it; removing both frees it |
744
+
|`ACL_TABLE_TYPE\|T1` references G0 (no TABLE or rules) | TABLE_TYPE refcount holds | Deleting G0 rejected |
0 commit comments