-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gnmi_collector with tunnel_request option is not communicating with tunnel client running on target #94
Comments
When c.addTargetHandler is called, it will pass the target to the channel c.chAddTarget, which is expected to be picked up by by the goroutine in c.start. Here it monitors the c.chAddTarget channel and should create a tunnel session. You probably want to check whether the target in the handler is picked up in the c.start and if there is any error before NewSession (via tunnel.ServerConn) is called. |
Thanks for pointing it , i see that i was getting error in addTargetHandler , as i had given Target id same in gnmi_collector configuration file as well as tunnel client side target id. NewQuery(%s): %v input is nil ./gnmi_collector -port 50052 -v 4 -tunnel_request "/oc-if:interfaces/oc-if:interface[name=GIGECLIENTCTP.2-*]" -config_file ./testdata/iqnos.cfg -cert_file ./testdata/selfsigned.crt -key_file ./testdata/selfsigned.key -stderrthreshold 6 -v 6 -logtostderr once New Session is requested from gnmi_collector to tunnel client |
Are you able to check what is passed into the client.NewQuery? In |
Yes i already checked that , qr := c.config.Request[target.Request] before this line i printed target.Request which is |
The request should be a named request in your config file as it gets added to a Tunnel target dynamically. |
thanks for information, after providing named request which is present in gnmi_collector config file, i see that Request is sent toward tunnel_client side, but immediately connection is getting closed , i have enabled gnmi_collector logs I0318 09:42:17.021600 8233 register.go:113] Attempting client types: [gnmi] tunnel_client logs 2021/03/18 04:39:04 http2: Framer 0xac80580: wrote PING flags=ACK len=8 ping="\x02\x04\x10\x10\t\x0e\a\a" my internal grpc server is running on port 50051 on NE i see that there connection is going for timewait netstat -an | grep -i 50051 |
I looked further and i see that at grpcserver side, i am getting following message in debug logs For tunnel request as command line option only name request needs to be given , so can someone suggest how to pass username and password also for authentication. |
Are you able to test grpc-tunnel and gnmi-collector separately to see if they are working? Does the client (grpc server) require login? |
yes i am able to test grpc-tunnel and gnmi-collector seperately, |
The grpc tunnel hands over the connection to the collector/target once its server/client connection is established. We should expect all the operations following that unchanged compared to the case without the tunnel. I am afraid that I don't have knowledge about your target (grpc server), so cannot comment on that. I suggest find the place where the tunnel session is handled on the target side (possibly on the collector side as well), and make sure the tunnel is up. |
After a closer look, I might have misunderstood your question. When using the tunnel, you probably can add the credential in collector.addTarget, which is used to construct the target when it receives a target from collector.chAddTarget. |
i tried it adding in cfg file , which is read by gnmi_collector, in following format. target: < but if i do so , then this target is considered as dial in target in gnmi_collector, and dialin request goes for this target. |
For testing, you can just add the credential in collector.addTarget, e.g., by passing a target_password/username flags. As you have more targets to collect from, I image that you probably need to add the credentials to a config, but here you will need to distinguish the targets fully configured in the file vs those only configured for their credentials. Think you will need to add additional logic for that. For security purpose, sending credential form tunnel client defers its purpose. |
Hi,
Objective :- try to see working of grpctunnel using gnmi_collector with tunnel_request option and example client code.
gnmi_collector (running on host machine ) <----> grpctunnel client on NE --------> C++ grpc server on NE
Issue :-
On host machine gnmi_collector with tunnel_request option following command has been used
./gnmi_collector -port 50052 -v 1 -tunnel_request "true" -config_file ./testdata/iqnos.cfg -cert_file ./testdata/selfsigned.crt -key_file ./testdata/selfsigned.key -stderrthreshold 6 -v 6 -logtostderr
target machine is running with tunnel client example given in grpctunnel package using (tunnelAddress configured as host machine ip)
At client side register rpc is called and and further Target and Subscribe messages has been received from gnmi_collector.
Peer target also has been added both side tunnel client as well as gnmi_collector side.
gnmi_collector side addTargetHandler is called and target has been added after running tunnel client.
But now further gnmi_collector is not sending any NewSession request towards tunnel client , because of that gnmi_collector as well as tunnel client both are stuck.
gnmi_collector is waiting in select for one of case to happen ie. inside
func (c *collector) start(ctx context.Context) {
case target := <-c.chAddTarget: or case target := <-c.chDeleteTarget:
}
Following configuration file has been used.
cat ./testdata/iqnos.cfg
request: <
key: "interfaces"
value: <
subscribe: <
prefix: <
origin: "openconfig"
>
subscription: <
path: <
elem: <
name: "oc-if:interfaces"
>
elem: <
name: "oc-if:interface"
key: <
key: "name"
value: "GIGECLIENTCTP.2-*"
>
>
>
>
>
target: <
key: "TARGET1"
value: <
addresses: ":50052"
request: "interfaces"
credentials: <
username: "username"
password: "some password"
>
Can someone suggest what i am missing here or is it a problem ?
Thanks
The text was updated successfully, but these errors were encountered: