openconfig / gnmi

gRPC Network Management Interface
Apache License 2.0
479 stars 197 forks source link

gnmi_cli is not displaying subscribeResponse #19

Closed kboyapa1 closed 6 years ago

kboyapa1 commented 6 years ago

I am still in the initial phase of setting up server and gnmi_cli (go) communication. When the following subscribeReuqest is initiated from the gnmi_cli, my server is receiving the request and able to parse the query string. And am filling the subscribeResponse as needed. This response is not getting displayed on gnmi_cli session and the session just hangs . Can please point me what did I miss in filling the SubscribeResponse message? And also point me how to enable debug verbose in gnmi_cli?

gnmi_cli subscribeRequest:

./gnmi_cli --address rtxscplp124:50051 --ca_crt server.crt --q /system/services -qt "once" --logtostderr

Server SubscribeResponse data:

('subscribe_res', update { timestamp: 1234567 update { path { origin: "Koti" elem { name: "system" } elem { name: "services" } } val { json_val: "{\n \"system:services\": {\n \"ssh-server\": {\n \"ssh-server-enabled\": true,\n \"ssh-server-port\": 22,\n \"algorithms\": {\n \"mac\": [\"hmac-md5\", \"hmac-sha1\", \"hmac-sha2-256\", \"hmac-sha2-512\", \"hmac-sha1-96\", \"hmac-md5-96\"],\n \"encryption\": [\"aes128-ctr\", \"aes192-ctr\", \"aes256-ctr\", \"aes128-cbc\", \"aes256-cbc\", \"3des-cbc\"]\n }\n },\n \"web-server\": {\n \"webgui-enabled\": true,\n \"webgui-timeout\": \"PT30M\",\n \"rest\": {\n \"rest-enabled\": true\n },\n \"http\": {\n \"http-port\": 80\n }\n },\n \"ftp\": {\n \"ftp-server\": {\n \"ftp-server-enabled\": false,\n \"ftp-server-port\": 21\n }\n },\n \"sftp\": {\n \"sftp-server\": {\n \"sftp-server-enabled\": false,\n \"sftp-server-port\": 2202,\n \"algorithms\": {\n \"allowed-mac\": [\"hmac-md5\", \"hmac-sha1\", \"hmac-sha2-256\", \"hmac-sha2-512\", \"hmac-sha1-96\", \"hmac-md5-96\"],\n \"allowed-encryption\": [\"aes128-ctr\", \"aes192-ctr\", \"aes256-ctr\", \"aes128-cbc\", \"aes256-cbc\", \"3des-cbc\"]\n }\n }\n },\n \"telnet\": {\n \"telnet-enabled\": false,\n \"telnet-port\": 23\n },\n \"netconf\": {\n \"netconf-enabled\": true,\n \"netconf-port\": 830,\n \"netconf-timeout\": \"PT30M\"\n },\n \"snmp\": {\n \"snmp-enabled\": true,\n \"snmp-port\": 161,\n \"snmp-ip\": \"0.0.0.0\",\n \"system-snmp:authFailureTrap\": \"enabled\",\n \"system-snmp:alarm-trap\": \"enabled\",\n \"system-snmp:event-trap\": \"enabled\",\n \"system-snmp:tca-trap\": \"enabled\"\n }\n }\n}\n" } } } )

jipanyang commented 6 years ago

I encountered similar problem and put a few lines of code in ToScalar() https://github.com/openconfig/gnmi/blob/master/value/value.go#L92 to get around the problem. It might work for you too.

case *pb.TypedValue_JsonVal:
    var val interface{}
    val = tv.GetJsonVal()
    json.Unmarshal(val.([]byte), &i)
kboyapa1 commented 6 years ago

Thank you @jipanyang for your suggestion.

I have added your change but did not help me to get the problem why client is waiting for the response even server has responded.

I have verified my server response using https://github.com/nokia/pygnmi/blob/master/gNMI_Subscribe.py client, where I could see the response on the client. I am facing the issue with gnmi_cli.

Can please point me what I could have done wrong in filling the server's SubscribeResponse?

gcsl commented 6 years ago

Does your server send a sync response at the end of sending all values? If not, the gnmi_cli will wait forever for the delivery of that message before rendering output. If you want to see the messages as they are delivered, you can switch the output to not aggregate all data into a single tree and render the messages as they come in. The option for -display_type (-dt) can be set to single (s) to see the individual leaves as they are returned, or proto (p) to see the raw protos as they are delivered.

-dt=s

-dt=p

On Mon, Jan 22, 2018 at 8:21 PM, kboyapa1 notifications@github.com wrote:

Thank you @jipanyang https://github.com/jipanyang for your suggestion.

I have added your change but did not help me to get the problem why client is waiting for the response even server has responded.

I have verified my server response using https://github.com/nokia/ pygnmi/blob/master/gNMI_Subscribe.py client, where I could see the response on the client. I am facing the issue with gnmi_cli.

Can please point me what I could have done wrong in filling the server's SubscribeResponse?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openconfig/gnmi/issues/19#issuecomment-359672157, or mute the thread https://github.com/notifications/unsubscribe-auth/ARfIL3xSbzQUyWezNLM99T0NJzxdSasvks5tNV5GgaJpZM4RmNtv .

kboyapa1 commented 6 years ago

Thanks a lot @jipanyang Able to see the response in gnmi_cli go cleint with your suggested options (--dt=p or --dt=s).