sonic-net / sonic-pins

P4 Integrated Network Stack (PINS)
Apache License 2.0
29 stars 24 forks source link

Device ID for SONiC Virtual Switch with P4RT #232

Open pantmal opened 3 months ago

pantmal commented 3 months ago

Hello everyone, I am new to SONiC and I would like some assistance regarding some config related operations. This issue is more of a theoretical question regarding SONiC and PINS and not directly related to the sonic-pins repo, but I hope someone from here may be able to assist.

I have used the sonic-buildimage repo to create a custom SONiC Virtual Switch image. I have used the flag INCLUDE_P4RT = y so I may have a P4 runtime container.

I have deployed this VS using GNS3 and I am able to connect to the switch and the P4RT gRPC port with the P4 runtime shell with: python3 -m p4runtime_sh --grpc-addr <Switch-IP>:9559.

However when I connect I am receiving the following error:

CRITICAL:root:P4Runtime RPC error (FAILED_PRECONDITION): Switch does not have a Device ID. Has a config been pushed?

I understand that the P4 runtime shell needs the Device ID to complete the connection, but it has not been set. Can someone assist me with this issue? How am I supposed to set the Device ID and push the config in question? Can this operation be performed by GNS3? I can't see any related option in the sonic-buildimage repo.

Any assistance would be greatly appreciated.

(On another note, I have noticed that the P4rt container does not run by default and needs to be enabled manually with: /usr/bin/p4rt.sh start. Is this behavior expected?)

shengminhe commented 3 months ago

I also encountered the same problem, did you solve it?

pantmal commented 3 months ago

No, I wasn't able to solve it thus far. I have given you a detailed response of my findings in the other issue I created: https://github.com/sonic-net/sonic-buildimage/issues/19328#issuecomment-2188145788