openconfig / gnmic

gNMIc is a gNMI CLI client and collector
https://gnmic.openconfig.net
Apache License 2.0
171 stars 55 forks source link

Gnmic tunnel NewSession() missing after target registration #298

Closed ruchakulkarni11 closed 9 months ago

ruchakulkarni11 commented 10 months ago

Hi @karimra I am trying to use gnmic as tunnel-server. Target registration is successful but I don't see any newSession() is called for a tunnel session on gnmic side. Is it expected to be called on tunnel-client?

Once target registeration is done, the rpc is invoked.

Is it on the register stream or tunnel stream? what is the expected code flow with gnmic and https://github.com/openconfig/grpctunnel

karimra commented 10 months ago

Could you share the command and the config file you used to test? gnmic is supposed to invoke a new session and send a gnmi rpc once the tunnel is established.

ruchakulkarni11 commented 10 months ago

Gnmic is sending the rpc as soon as target is registered. As per gnmic doc, https://gnmic.openconfig.net/user_guide/tunnel_server/#stream-subscription, rpc is working.

I can see, the rpc is send when target is registered, but I don't see server calling NewSession(). I want to understand, after target registered, how tunnel session is created?

ruchakulkarni11 commented 10 months ago

Hi @karimra, I have one more question in addition to above question.

Once target is registered, and session is created, can target have another session (newSession) with the same tunnel-server?

karimra commented 10 months ago

The server calls a Register with registration type Session: https://github.com/openconfig/grpctunnel/blob/main/proto/tunnel/tunnel.proto#L47 to instruct the client to invoke a new tunnel.

Yes, the server can request multiple sessions from from the target, i.e multiple tunnels towards the same tunnel-server.

These questions are related to the grpc-tunnel spec, they are better asked here: https://github.com/openconfig/grpctunnel

ruchakulkarni11 commented 10 months ago

Hi @karimra, Thank you for your response. I will ask tunnel related questions on mentioned portal.

But for the gnmic, can you please point me where does the subscribe rpc registers with type session in the code? I am not able to locate that part after target is registered. I am trying to invoke subscribe rpc with dial-out.

karimra commented 10 months ago

gNMIc uses the grpc-tunnel server as a dialer when creating the gNMI client. The code that sends the register type session is in the grpc-tunnel project. This is where the NewSession() function call you are looking for.