openconfig / gnmi

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

gnmi_cli still does not support PathElem field of message Path from gnmi.proto v4 #11

Closed dparameswarappa closed 6 years ago

dparameswarappa commented 7 years ago

In this gnmi_cli i was thinking it supports TypedValue val i.e. added in new gnmi.proto 0.4.0 but when i used this client i see this o/p: ./gnmi_cli -a 10.33.101.170:6702 -qt s -dt p -pi 10s -q /hello/system/logical-core-percent[cpu-id=5] -client_types gnmi subscribe:<subscription:<path:<element:"hello" element:"system" element:"logical-core-percent[cpu-id=5]" > > > update: < timestamp: 1508251414 prefix: < element: "hello" element: "system" element: "logical-core-percent[cpu-id=5]" origin: "Hello"

update: < path: < element: "cpu-idle" origin: "Hello"

value: < value: "100"

Am i missing something here? or not using the client in the right way?

awly commented 7 years ago

You are seeing exactly the proto messages that your server (10.33.101.170:6702) is sending. If it's not setting TypedValue fields, the CLI won't show them. It's not doing any auto-conversion with -dt p

dparameswarappa commented 7 years ago

When i used the same gnmi_cli with the different server that is using new proto(0.4.0) i dont receive any reply. o/p: ./gnmi_cli -a 10.33.81.100:6702 -qt s -dt p -pi 10s -q /hello/system/logical-core-percent[cpu-id=5] -client_types gnmi subscribe:<subscription:<path:<element:"hello" element:"system" element:"logical-core-percent[cpu-id=5]" > > >

It just sits here and waits.

To verify we used a home grown tool with same server we received this below reply.

$ ./gnmic Server address: 10.33.81.100 Server port: 6702 Enter sensor names... system logical-core-percent[cpu-id=5] subscribe { prefix { origin: "caxv-gmathur-01" elem { name: "hello" } } subscription { path { origin: "OriginHello" elem { name: "system" } elem { name: "logical-core-percent" key { key: "cpu-id" value: "5" } } } mode: SAMPLE sample_interval: 2000 heartbeat_interval: 10000 } }

update { timestamp: 1508267372968000000 prefix { origin: "Hello" elem { name: "hello" } elem { name: "system" } elem { name: "logical-core-percent" key { key: "cpu-id" value: "5" } } } update { path { origin: "Hello" elem { name: "cpu-idle" } } val { float_val: 100 } } }

awly commented 7 years ago

So, the problem is not TypedValue or anything about the response. The problem is SubscribeRequest, specifically https://github.com/openconfig/gnmi/blob/master/proto/gnmi/gnmi.proto#L123

Your client handles the new PathElem field. gnmi_cli only uses the old deprecated field element. The server likely only looks at the new path structure, which is why nothing is returned.

awly commented 6 years ago

The change finally landed, sorry for the long wait. All gnmi_cli RPCs now include both path formats and handle both formats for responses. Let me know if you find any issues.