p4lang / p4runtime-shell

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

connection error #45

Open P4-WCZ opened 4 years ago

P4-WCZ commented 4 years ago

connection error The scenario I want to achieve is: execute p4runtime-shell in the ubuntu virtual machine to achieve normal communication with the P4 commercial switch (the switch has been installed with the runtime-server service normally, port 50051). You mentioned at the end that it can support P4 commercial Switch. But I cannot establish a connection normally. The above is the error of the package when executing the script Can you help me take a look。

antoninbas commented 4 years ago

I cannot provide technical help with the Tofino switch as I no longer work at Barefoot / Intel, and I no longer have access to the software. I recommend reaching out to customer support if you are having issues using P4Runtime with Tofino. You may want to try and troubleshoot yourself as well, by looking at available logs on the switch.

Mtze commented 3 years ago

I had similar problems. Here is what worked for me (SDE 9.4.0 with P4RT support):

  1. Compile your p4 program on the switch using the provided compiler. Generate the p4info.
  2. Modify the run_switchd.sh - Add the --p4rt-server 0.0.0.0:50051 parameter to the actual bf_switchd call
  3. Start the switch with ./run_switchd.sh --skip-p4 -p <yourProgram> (Important to start it with your actual binary AND --skip-p4 - Otherwise the switch seg-faults - don't ask me why 🤷‍♂️)
  4. Optional: Copy context.json, tofino.bin, <program>.p4info.pb.txt to your runtime-shell host
  5. Use the generator script in the repo to create the necessary<yourBin>.bin
  6. Call python3 -m p4runtime_sh --grpc-addr <IP>:50051 --device-id 0 --election-id 0,1 --config <program>.p4info.pb.txt,<yourBin>.bin

Hope that helps :)

P4-WCZ commented 3 years ago

Hello,     Wow, I was surprised to receive your email. My guess is that my SDE version(8.9.1) is too low and the Runtime function is not adapted. I may need to contact the device manufacturer to update the SDE. Finally, thank you very much for sending me an email and telling me the operation steps in detail, thank you. = =

Thanks, wang

------------------ 原始邮件 ------------------ 发件人: "p4lang/p4runtime-shell" @.>; 发送时间: 2021年3月25日(星期四) 凌晨3:29 @.>; @.**@.>; 主题: Re: [p4lang/p4runtime-shell] connection error (#45)

I had similar problems. Here is what worked for me (SDE 9.4.0 with P4RT support):

Compile your p4 program on the switch using the provided compiler. Generate the p4info.

Modify the run_switchd.sh - Add the --p4rt-server 0.0.0.0:50051 parameter to the actual bf_switchd call

Start the switch with ./run_switchd.sh --skip-p4 -p <yourProgram> (Important to start it with your actual binary AND --skip-p4 - Otherwise the switch seg-faults - don't ask me why 🤷‍♂️)

Optional: Copy context.json, tofino.bin, <program>.p4info.pb.txt to your runtime-shell host

Use the generator script in the repo to create the necessary<yourBin>.bin

Call python3 -m p4runtime_sh --grpc-addr <IP>:50051 --device-id 0 --election-id 0,1 --config <program>.p4info.pb.txt,<yourBin>.bin

Hope that helps :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

mehdiazf commented 1 year ago

Hello,

I'm facing a similar problem (with SDE 9.7.0). Could you figure out how to resolve the problem @P4-WCZ? I followed your instructions @Mtze, and here is the status and the error I'm getting.

After "Add the --p4rt-server 0.0.0.0:50051 parameter to the actual bf_switchd call Start the switch with ./run_switchd.sh --skip-p4 -p \<yourProgram>" the P4Runtime is listening: image

Now, when I try to run p4runtime-shell (python3 -m p4runtime_sh --grpc-addr localhost:50051 --device-id 0 --election-id 0,1 --config p4info.pb.txt,out.bin), I get: image

Then the switch seg-faults with the following error: image

Can you help me to resolve the issue. Thanks.

niloysh commented 9 months ago

Hello,

I'm facing a similar problem (with SDE 9.7.0). Could you figure out how to resolve the problem @P4-WCZ? I followed your instructions @Mtze, and here is the status and the error I'm getting.

After "Add the --p4rt-server 0.0.0.0:50051 parameter to the actual bf_switchd call Start the switch with ./run_switchd.sh --skip-p4 -p " the P4Runtime is listening: image

Now, when I try to run p4runtime-shell (python3 -m p4runtime_sh --grpc-addr localhost:50051 --device-id 0 --election-id 0,1 --config p4info.pb.txt,out.bin), I get: image

Then the switch seg-faults with the following error: image

Can you help me to resolve the issue. Thanks.

I am facing the same issue. @mehdiazf were you able to resolve this?