openconfig / gnmi

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

gnmi_cli display_type single or group return display error #8

Closed wisotzky closed 6 years ago

wisotzky commented 7 years ago

I am using the latest version of gnmi_cli against my gNMI server (using spec v0.3.1). When trying to set the display type to single or group, I am getting a displaying error:

# gnmi_cli -a pe1:57400 -with_user_pass -ca_crt CAcert.pem -qt s -dt s -pi 10s -q state/port[port-id=1/1/1]/ethernet/statistics/out-utilization
username: grpc
password: E0919 13:53:47.398923    5101 gnmi_cli.go:186] cli.QueryDisplay:
        sendQueryAndDisplay(ctx, {Addrs:[pe1:57400] Target: Replica:0 Discard:false Queries:[[state port[port-id=1/1/1] ethernet statistics out-utilization]] Type:stream Timeout:30s NotificationHandler:<nil> ProtoHandler:<nil> Credentials:0xc420152460 TLS:0xb78020 Extra:map[]}, &{PollingInterval:10s StreamingDuration:0s Count:0 countExhausted:false Delimiter:/ Display:0x7c6040 DisplayPrefix: DisplayIndent:   DisplayType:s DisplayPeer:false Timestamp: DisplaySize:false Latency:false ClientTypes:[]}):
        client had error while displaying results:
        non-scalar type &{JsonVal:[48]}

As long I am using proto everything works without problems:

#  gnmi_cli -a pe1: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: update: <
  timestamp: 1505822251599627652
  prefix: <
    element: "state"
    element: "port[port-id=1/1/1]"
    element: "ethernet"
    element: "statistics"
  >
  update: <
    path: <
      element: "out-utilization"
    >
    val: <
      json_val: "0"
    >
  >
>

sync_response: true
gcsl commented 7 years ago

The spec was updated to include a TypedValue message to enable per leaf explicit types which is the recommended value format. The json_val is retained for setting configuration but shouldn't be used for telemetry as there are encoding problems in JSON that require workarounds, most notably the handling of 64bit counters and loss of precision. Numeric values should use their respective types explicitly.

On Tue, Sep 19, 2017 at 4:58 AM, wiso notifications@github.com wrote:

I am using the latest version of gnmi_cli against my gNMI server (using spec v0.3.1). When trying to set the display type to single or group, I am getting a displaying error:

gnmi_cli -a pe1:57400 -with_user_pass -ca_crt CAcert.pem -qt s -dt s -pi 10s -q state/port[port-id=1/1/1]/ethernet/statistics/out-utilization

username: grpc password: E0919 13:53:47.398923 5101 gnmi_cli.go:186] cli.QueryDisplay: sendQueryAndDisplay(ctx, {Addrs:[pe1:57400] Target: Replica:0 Discard:false Queries:[[state port[port-id=1/1/1] ethernet statistics out-utilization]] Type:stream Timeout:30s NotificationHandler: ProtoHandler: Credentials:0xc420152460 TLS:0xb78020 Extra:map[]}, &{PollingInterval:10s StreamingDuration:0s Count:0 countExhausted:false Delimiter:/ Display:0x7c6040 DisplayPrefix: DisplayIndent: DisplayType:s DisplayPeer:false Timestamp: DisplaySize:false Latency:false ClientTypes:[]}): client had error while displaying results: non-scalar type &{JsonVal:[48]}

As long I am using proto everything works without problems:

gnmi_cli -a pe1: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: update: < timestamp: 1505822251599627652 prefix: < element: "state" element: "port[port-id=1/1/1]" element: "ethernet" element: "statistics"

update: < path: < element: "out-utilization"

val: < json_val: "0"

sync_response: true

— 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/8, or mute the thread https://github.com/notifications/unsubscribe-auth/ARfILxHjxqTISnJ-IlI4lL5utXn1QbRhks5sj6xPgaJpZM4PcR5c .

awly commented 6 years ago

Per Carl's comment, non-proto display_type expects TypedValue in responses.