The attached program psa-unicast-or-drop-2-bmv2.p4, which is a small modification of the already-checked-in and working test program psa-unicast-or-drop-bmv2.p4, gives an error not when compiling it, but when psa_switch attempts to read the BMv2 JSON file:
$ p4c-bm2-psa testdata/p4_16_samples/psa-unicast-or-drop-2-bmv2.p4 -o psa-unicast-or-drop-2-bmv2.json
$ psa_switch --log-console psa-unicast-or-drop-2-bmv2.json
Calling target program-options parser
Invalid reference to object of type 'header' with name 'scalars'
I have not dug into exactly what is going wrong, but I suspect that perhaps the BMv2 JSON file is incorrect, and in particular has no fields anywhere to represent the field parser_ingress_port inside of the struct of type metadata_t in the P4 program.
I suspect this is a problem specific to the PSA back end for p4c, since there are very likely v1model architecture test programs that assign values to metadata fields within parsers, and use them in the ingress control.
Just doing a status check on the PSA implementation in BMv2. This issue is still true of the latest version of p4c-bm2-ss and psa_switch executables built from source as of 2024-oct-31.
With the versions listed below of p4c and behavioral-model sourcec ode:
The attached program psa-unicast-or-drop-2-bmv2.p4, which is a small modification of the already-checked-in and working test program psa-unicast-or-drop-bmv2.p4, gives an error not when compiling it, but when psa_switch attempts to read the BMv2 JSON file:
I have not dug into exactly what is going wrong, but I suspect that perhaps the BMv2 JSON file is incorrect, and in particular has no fields anywhere to represent the field parser_ingress_port inside of the struct of type metadata_t in the P4 program.
I suspect this is a problem specific to the PSA back end for p4c, since there are very likely v1model architecture test programs that assign values to metadata fields within parsers, and use them in the ingress control.
p4c-psa-issue.zip