openconfig / reference

This repository contains reference implementations, specifications and tooling related to OpenConfig-based network management.
Apache License 2.0
155 stars 88 forks source link

Encoding for telemetry updates #137

Closed sachinholla closed 2 years ago

sachinholla commented 3 years ago

gNMI spec section 3.5 says telemetry updates should be encoded as (path, scalar value) pairs.

When aggregation is not permitted by the client or the schema each update message MUST contain a (key, value) pair - where the key MUST be a path to a single leaf element within the data tree (encoded according to Section 2.2.2). The value MUST encode only the value of the leaf specified. In most cases, this will be a scalar value (i.e., a JSON value if a JSON encoding is utilised)...

By "scalar value" is it referring to scalar types as explained in section 2.2.3? The very next sentence says "a JSON value if a JSON encoding is utilised"; hence the confusion. The ygot.TogNMINotifications utility encodes the updates using scalar types.

sachinholla commented 3 years ago

@aashaikh, @robshakir -- can you please clarify this? Thanks

wenovus commented 3 years ago

By "scalar types", I'm going to guess the authors mean a TypedValue, https://github.com/openconfig/gnmi/blob/master/proto/gnmi/gnmi.proto#L107, which can also hold JSON (bytes json_val = 10;).

TogNMINotifications only supports marshalling to non-JSON TypedValue types, so perhaps "scalar values" can be interpreted to mean those non-JSON types, but strictly I think the term "scalar value" might be too ambiguous here.

gcsl commented 2 years ago

Scalar value refers to the value of an individual leaf so as to disambiguate from a sub-branch with multiple leaves. In a majority of cases, this is the expectation as there are likely cases where the timestamps for multiple leaves in a container are not guaranteed to be the same depending on how they are collected from a given hardware implementation. Aggregation was envisioned only for select circumstances (e.g. where a branch of leaves modeled in OC are actually a single payload at the protocol layer such as an IS-IS LSP).