openconfig / gnmi

gRPC Network Management Interface
Apache License 2.0
464 stars 196 forks source link

gnmi_cli does not support gNMI version 0.4 / 0.5 #16

Closed wisotzky closed 6 years ago

wisotzky commented 6 years ago

Unfortunately the Path encoding has changed since gNMI version 0.4: https://github.com/openconfig/gnmi/commit/09cf23da6f4e669a4a11e334c6208b787fed7f22#diff-2c94239e729daff1e1db0c192c4d4eda

While repeated string element was used until version 0.3, this attribute is now deprecated. Instead repeated PathElem elem is used. The main difference is, that in the old encoding, the keys have been part of the string - such as "port[port-id=1/1/1]" while now the keys are properly encoded using map <string, string>.

This change impacts compatibility between gNMI servers and client. The current gnmi_cli client produces the following errors when running against a gnmi 0.4/0.5 server (e.g. NOKIA routers running SR OS 15.1).

$ gnmi_cli -a 192.168.33.2:57400 -with_user_pass -ca_crt CAcert.pem -qt s -dt p -pi 10s -q state/port[port-id=1/1/1]/ethernet/statistics/out-utilization
username: grpc
password: ********
E1204 20:32:25.622019   31975 gnmi_cli.go:190] cli.QueryDisplay:
        sendQueryAndDisplay(ctx, {Addrs:[192.168.33.2:57400] Target: Replica:0 UpdatesOnly:false Queries:[[state port[port-id=1/1/1] ethernet statistics out-utilization]] Type:stream Timeout:30s NotificationHandler:<nil> ProtoHandler:<nil> Credentials:0xc42019aa40 TLS:0xc0c9c0 Extra:map[]}, &{PollingInterval:10s StreamingDuration:0s Count:0 countExhausted:false Delimiter:/ Display:0x815710 DisplayPrefix: DisplayIndent:   DisplayType:p DisplayPeer:false Timestamp: DisplaySize:false Latency:false ClientTypes:[]}):
        client had error while displaying results:
        rpc error: code = InvalidArgument desc = MINOR: GMI #2004: / - Invalid path syntax - deprecated path format

I've already changed my Python client accordingly: https://www.github.com/nokia/pygnmi

awly commented 6 years ago

Duplicate of https://github.com/openconfig/gnmi/issues/11

I have a pending change that fixes this which was blocked on https://github.com/openconfig/ygot/pull/122 (coincidentally, just merged). Will hopefully push it today/tomorrow.