p4runtime-shell icon indicating copy to clipboard operation
p4runtime-shell copied to clipboard

Failed to establish session with the server

Open SergiVera opened this issue 5 years ago • 8 comments

Hi everyone,

I have some issues when trying to run the p4runtime shell, as shown in the following figure: p4runtime-shell-error I have used the following command: sudo ./p4runtime-sh-docker --grpc-addr 0.0.0.0:50001 --device-id 0 --election-id 0,1 --config ../p4-tutorial/basic-forwarding/build/basic.p4.p4info.txt,../p4-tutorial/basic-forwarding/build/basic.json I guess the error is in the --grpc-addr but I don't know how to proceed. I have tested it with addresses 0.0.0.0 and localhost but I always obtain the same error. Thanks in advance!

SergiVera avatar Nov 03 '20 16:11 SergiVera

0.0.0.0:50001 is not a valid address - you need to pass the address of the P4Runtime server. 0.0.0.0 is used in a server when you want to listen on every available interface. p4runtime-sh-docker is a client. Because you are using the Docker wrapper, the following information from the README may also apply:

If you are using the Docker image to run p4runtime-shell and you are trying to connect to a P4Runtime server running natively on the same system and listening on the localhost interface, you will not be able to connect to the server using --grpc-addr localhost: or --grpc-addr 127.0.0.1:. Instead, you should have your P4Runtime server listen on all interfaces (0.0.0.0) and you will need to use the IP address assigned to the Docker bridge (docker0 by default) or the IP address assigned to the local network management interface (e.g. eth0).

antoninbas avatar Nov 03 '20 16:11 antoninbas

Yes, I have already read the README but I don't understand it. Which is the IP address assigned to the Docker bridge?

SergiVera avatar Nov 03 '20 16:11 SergiVera

I think I have found the error. The file p4runtime-sh-docker lacks of --grpc-addr argument to pass on. Since neither IP nor port is specified, the error is: Failed to connect to all addresses

SergiVera avatar Nov 03 '20 16:11 SergiVera

Hi @SergiVera I have same issue. Did you solve this problem?

fatihusta avatar Jan 27 '21 17:01 fatihusta

When running the P4 Switch Container, you need to expose ports with the -p 50001:50001 flag. This way, you can run p4runtime-shell for localhost: 50001.

For example, if you run a topology with mn-stratum, you can run p4runtime-shell for localhost:50001, localhost:50002, and localhost:50003, as your host's port has been bound to your container. Check this example:

docker run --privileged --rm -it -p 50001-50003:50001-50003 opennetworking/mn-stratum --topo linear,3

emdneto avatar Mar 31 '21 12:03 emdneto

Hi @SergiVera I have same issue. Did you solve this problem?

Hello, thanks @fatihusta @emdneto for your time, I've been able to solve the problem.

Regards

SergiVera avatar Mar 31 '21 12:03 SergiVera

Hi @SergiVera

I have the same problem. How did you solve it?

Many thanks

belenbrandino avatar Jun 02 '21 19:06 belenbrandino

Hello @belenbrandino,

In the end, I haven't used p4 in my project, but I'm sure I solve it too but I don't remember it well. I'm glad that you've solved it too!

Thanks

SergiVera avatar Jun 03 '21 06:06 SergiVera