p4lang / p4runtime-shell

An interactive Python shell for P4Runtime
Apache License 2.0
79 stars 40 forks source link

[P4RT] Failed to validate P4Info. PacketIO metadata not supported by P4Info. #130

Open pantmal opened 3 months ago

pantmal commented 3 months ago

Hello everyone. I'm trying to use p4runtime-shell in order to connect and push p4 config files to a Virtual Switch that's running SONiC. The image was built using the following repo: https://github.com/sonic-net/sonic-buildimage

Now, while I'm able to connect to the switch using p4runtime-shell with: python3 -m p4runtime_sh --grpc-addr <Switch-Address>:9559 when I try to push the config files (python3 -m p4runtime_sh --grpc-addr <Switch-Address>:9559 --config <path-to-info-file>/p4info.txt,<path-to-bmv2-file>/bmv2.json), I receive the following error:

CRITICAL:root:Error when setting config
CRITICAL:root:P4Runtime RPC error (INVALID_ARGUMENT): [P4RT] Failed to validate P4Info. Details: PacketIO metadata not supported by P4Info. deleted: controller_packet_metadata[0]: { preamble { id: 81826293 name: "packet_in" alias: "packet_in" annotations: "@controller_header(\"packet_in\")" } metadata { id: 1 name: "ingress_port" type_name { name: "port_id_t" } } metadata { id: 2 name: "target_egress_port" type_name { name: "port_id_t" } } }
deleted: controller_packet_metadata[1]: { preamble { id: 76689799 name: "packet_out" alias: "packet_out" annotations: "@controller_header(\"packet_out\")" } metadata { id: 1 name: "egress_port" type_name { name: "port_id_t" } } metadata { id: 2 name: "submit_to_ingress" bitwidth: 1 } metadata { id: 3 name: "unused_pad" bitwidth: 7 } }|

Is anyone familiar with this error and why it occurs? I have also pushed the same p4 config files to a Virtual Switch that's running P4RT using Stratum and the connection as well as the push of the files is successful. I do believe that either the P4RT app that runs on SONiC may be out of date, or that the specific files are unable to be pushed. Yet again, I did try some other files, but I got the same error message.

I would like someone to point me in the right direction. I'm kind of new to P4 and related tasks, so if the error is unrelated to the p4runtime-shell and I should post the issue to a more appropriate repo, please let me know.

I'm attaching the related files, if that may help.

p4info.txt: p4info.txt

bmv2.json: bmv2.json

main.p4: main.p4.txt

jafingerhut commented 3 months ago

I am not familiar with this particular error and combination of software, no.

Looking at the error message a bit, controller_packet_metadata is a sub-message that can legally appear in a P4Info message, e.g. see this line of the .proto file defining P4Info messages: https://github.com/p4lang/p4runtime/blob/main/proto/p4/config/v1/p4info.proto#L35

Note: That is a link to the latest P4Runtime API specification version of the .proto file defining message formats. Particular implementations might be using an older version of that file, or in some case might even customize it more than that.

What confuses me about that error is that if you are truly using the p4info.txt file that you attach, it does not mention controller_packet_metadata anywhere in it, so it is weird that the network device is complaining that it cannot handle such a message. Either that, or some software between you providing the p4info.txt file you attached, and the place the error occurs, is modifying your P4Info data.