Skip to content

[P4Testgen]: Support action selectors and action profiles for P4Testgen v1model PTF tests#5544

Open
Copilot wants to merge 4 commits intomainfrom
copilot/fix-keyless-tables-issue
Open

[P4Testgen]: Support action selectors and action profiles for P4Testgen v1model PTF tests#5544
Copilot wants to merge 4 commits intomainfrom
copilot/fix-keyless-tables-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

  • Add one-shot action profile and selector configuration support to P4Testgen.
  • Make sure that the base_test.py PTF module supports valid action profile and selector configuration
  • Do not require root for nanomsg PTF tests.

Copilot AI changed the title [WIP] Fix p4testgen for adding entries to keyless tables Draft: Handle selector-only tables as keyless in BMv2 p4testgen and un-xfail affected PTF cases Mar 17, 2026
Copilot AI requested a review from fruffy March 17, 2026 03:32
Copilot AI changed the title Draft: Handle selector-only tables as keyless in BMv2 p4testgen and un-xfail affected PTF cases Handle selector-only BMv2 tables as keyless in p4testgen and unxfail affected PTF cases Mar 17, 2026
Copilot AI changed the title Handle selector-only BMv2 tables as keyless in p4testgen and unxfail affected PTF cases BMv2 testgen: treat selector-only tables as keyless and route action selectors through selector path Mar 17, 2026
Copilot AI changed the title BMv2 testgen: treat selector-only tables as keyless and route action selectors through selector path Fix BMv2 testgen selector state wiring for one-shot action selector paths Mar 17, 2026
Copilot AI changed the title Fix BMv2 testgen selector state wiring for one-shot action selector paths Implement explicit BMv2 PTF action-selector programming (members/groups + table group entries) Mar 17, 2026
Copilot AI changed the title Implement explicit BMv2 PTF action-selector programming (members/groups + table group entries) Generate explicit BMv2 PTF action-selector programming (members, groups, table group bindings) Mar 18, 2026
Copilot AI changed the title Generate explicit BMv2 PTF action-selector programming (members, groups, table group bindings) BMv2 testgen: emit selector-aware PTF control-plane programming for action_selector tables Mar 18, 2026
@jafingerhut
Copy link
Copy Markdown
Contributor

If this thing converges to a solution on its own, that would be pleasantly surprising :-)

@fruffy
Copy link
Copy Markdown
Collaborator

fruffy commented Mar 19, 2026

If this thing converges to a solution on its own, that would be pleasantly surprising :-)

The problem with the free tier is that it has a time limit. Our builds take a while and so it always terminates before doing anything. I'll play around with it a bit more to see whether I can find a functioning approach.

@fruffy fruffy force-pushed the copilot/fix-keyless-tables-issue branch 2 times, most recently from d7393dc to cb52da3 Compare March 22, 2026 23:49
@fruffy fruffy force-pushed the copilot/fix-keyless-tables-issue branch from cb52da3 to b870d72 Compare March 29, 2026 00:17
@fruffy fruffy added bmv2 Topics related to BMv2 or v1model p4tools Topics related to the P4Tools back end labels Mar 29, 2026
@fruffy fruffy requested a review from jafingerhut March 29, 2026 18:39
@fruffy
Copy link
Copy Markdown
Collaborator

fruffy commented Mar 29, 2026

@jafingerhut I had to hand this over to a local GPT 5.3 model. Unfortunately, the online Git models are a bit brain-damaged, because they have a limited time-budget and less context allowed, from what I can tell.

Still, now we actually have action selector programming working for the PTF BMv2 framework. There is some question on the exact semantics for one-shot programming, I tried to follow the ones described here: https://p4lang.github.io/p4runtime/spec/main/P4Runtime-Spec.html#sec-oneshot

Weight must be non-zero. Maybe we should make this configurable.

@fruffy fruffy marked this pull request as ready for review March 29, 2026 18:42
@fruffy fruffy added the breaking-change This change may break assumptions of compiler back ends. label Mar 29, 2026
@fruffy
Copy link
Copy Markdown
Collaborator

fruffy commented Mar 29, 2026

Marking as breaking change because we change the base-test API. I can also split this out into a separate PR.

@jafingerhut
Copy link
Copy Markdown
Contributor

https://p4lang.github.io/p4runtime/spec/main/P4Runtime-Spec.html#sec-oneshot

Is there some benefit to allowing weights in one-shot action selector configuration to be 0? It is not clear to me what that might be.

@jafingerhut
Copy link
Copy Markdown
Contributor

Marking as breaking change because we change the base-test API. I can also split this out into a separate PR.

I have only skimmed through the base_test.py changes so far, but in every case I checked I saw only new optional parameters added to existing method calls. Is there an example of a change in that file you consider breaking?

@fruffy
Copy link
Copy Markdown
Collaborator

fruffy commented Mar 29, 2026

I have only skimmed through the base_test.py changes so far, but in every case I checked I saw only new optional parameters added to existing method calls. Is there an example of a change in that file you consider breaking?

I went back and added _normalize_group_members to make sure we preserve API compatibility, but it might be overkill and make the internals more complicated than necessary. If we drop it the parameters become mandatory and breaking.

Also _validate_selector_weight will now throw errors.

Copy link
Copy Markdown
Contributor

@jafingerhut jafingerhut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me, although I can't claim to have digested every line of change.

@fruffy fruffy changed the title BMv2 testgen: emit selector-aware PTF control-plane programming for action_selector tables [P4Testgen]: Support action selectors and action profiles for P4Testgen v1model PTF tests Apr 6, 2026
@fruffy fruffy force-pushed the copilot/fix-keyless-tables-issue branch from d37888e to 62e7002 Compare April 6, 2026 00:52
fruffy added 4 commits April 8, 2026 18:25
…ck end.

Signed-off-by: fruffy <fruffy@nyu.edu>
Signed-off-by: fruffy <fruffy@nyu.edu>
…eights are positive.

Signed-off-by: fruffy <fruffy@nyu.edu>
Signed-off-by: fruffy <fruffy@nyu.edu>
@fruffy fruffy force-pushed the copilot/fix-keyless-tables-issue branch from 62e7002 to 266c03c Compare April 8, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bmv2 Topics related to BMv2 or v1model breaking-change This change may break assumptions of compiler back ends. p4tools Topics related to the P4Tools back end

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants