Hi,
I am having trouble running the GNMI client/sever example. I tried to trace the issue: The details are below. It seems I am missing something.
I am looking for sample commands for client and server to go with the uploaded example-config.pb.txt
Please see below what I have been trying, the issue I am seeing, and related debugging.
Please help to share if you have any general suggestions in this regard.
Many Thanks for your time and help!
Best Regards,
Nilesh
Here are two versions of example-configs I have been trying to get working
$ cat example-config.pb.txt
target: "foo"
client_type: GRPC_GNMI
$ cat example-config-cred.pb.txt
target: "foo"
client_type: GRPC_GNMI
credentials: {username: "grpc", password: "grpc"}
I run server as follows:
./cmd --config=example-config.pb.txt --text --port=57400
./cmd --config=example-config.pb.txt --text --port=57400 --server_key ~/z/keys/server.key --server_crt ~/z/keys/server.crt --ca_crt ~/z/keys/ca.crt
[I am new to golang; I did 'go install' in directory server.go; the binary in the $GOPATH/bin is cmd.]
I tried running client in several ways
./gnmi_cli --address localhost:57400 --query state/port[port-id=*]/statistics --with_user_pass -qt s -dt p -insecure
./gnmi_cli --address localhost:57400 --query state/port[port-id=*]/statistics --with_user_pass -qt s -dt p --ca_crt ~/z/keys/ca.crt --client_crt ~/z/keys/client.crt --client_key ~/z/keys/client.key
For client, I tried changing query to everything:
./gnmi_cli --address localhost:57400 --query * --with_user_pass -qt s -dt p -insecure
Here is what issue the code is running into with the above config-files, server commands, client commands:
./cmd --config=example-config.pb.txt --text --port=57400
./gnmi_cli --address localhost:57400 --query state/port[port-id=*]/statistics --with_user_pass -qt s -dt p -insecure
-
The client is able to connect to the server.
Under wireshark I do see packets being exchanged between the client and server.
-
I have not been able to get the verbose logs working. (a side question is how to enable verbose logs?) so I added several debug prints in the GNMI and underlying GRPC source code.
I am attaching a file, if you would like to see the trace with my debug-prints.
Summarizing, under GRPC, it goes inside serveHTTP2Transport() from grpc/server.go and then calls serveStreams(), and then HandleStreams() from http2_server.go
In here, it closes the connection from the condition preface != clientPreface
errorf("transport: http2Server.HandleStreams received bogus greeting from client: %q", preface)
-
Under Wireshark, I see that the server is resetting the two (Guess, one connection is for GNMI based channel and other one is Openconfig based channel as mentioned in client documentation) connections.
Next, I used the second config file with credentials as well, and there is no change in behavior.
Next, I used certificates, the server is closing the connection
./cmd --config=example-config.pb.txt --text --port=57400 --server_key ~/z/keys/server.key --server_crt ~/z/keys/server.crt --ca_crt ~/z/keys/ca.crt
./gnmi_cli --address localhost:57400 --query state/port[port-id=*]/statistics --with_user_pass -qt s -dt p --ca_crt ~/z/keys/ca.crt --client_crt ~/z/keys/client.crt --client_key ~/z/keys/client.key
In this case, the handleRawConn() returns with error (from the very first if condition which says Handshake failed) from grpc/server.go
Again, I think, I may be missing something very basic and if I could get an example
- sample config file
- what parameters to pass to server
- what parameters to pass to client
to get the GitHub code working on my local PC working, it would be great!! Really appreciate your help and time!
Thanks,
Best Regards,
Nilesh
grpc_client_server_connection_errors.txt