Add support for GNMI DecimalVal type (#7173)
This commit is contained in:
parent
9d7f56052e
commit
064247a345
|
@ -1,9 +1,8 @@
|
||||||
# Cisco GNMI Telemetry
|
# Cisco GNMI Telemetry
|
||||||
|
|
||||||
Cisco GNMI Telemetry is an input plugin that consumes telemetry data similar to the [GNMI specification](https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md).
|
Cisco GNMI Telemetry is an input plugin that consumes telemetry data based on the [GNMI](https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md) Subscribe method. TLS is supported for authentication and encryption.
|
||||||
This GRPC-based protocol can utilize TLS for authentication and encryption.
|
|
||||||
|
|
||||||
This plugin has been developed to support GNMI telemetry as produced by Cisco IOS XR (64-bit) version 6.5.1 and later.
|
It has been optimized to support GNMI telemetry as produced by Cisco IOS XR (64-bit) version 6.5.1, Cisco NX-OS 9.3 and Cisco IOS XE 16.12 and later.
|
||||||
|
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"math"
|
||||||
"net"
|
"net"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -332,7 +333,7 @@ func (c *CiscoTelemetryGNMI) handleTelemetryField(update *gnmi.Update, tags map[
|
||||||
case *gnmi.TypedValue_BytesVal:
|
case *gnmi.TypedValue_BytesVal:
|
||||||
value = val.BytesVal
|
value = val.BytesVal
|
||||||
case *gnmi.TypedValue_DecimalVal:
|
case *gnmi.TypedValue_DecimalVal:
|
||||||
value = val.DecimalVal
|
value = float64(val.DecimalVal.Digits) / math.Pow(10, float64(val.DecimalVal.Precision))
|
||||||
case *gnmi.TypedValue_FloatVal:
|
case *gnmi.TypedValue_FloatVal:
|
||||||
value = val.FloatVal
|
value = val.FloatVal
|
||||||
case *gnmi.TypedValue_IntVal:
|
case *gnmi.TypedValue_IntVal:
|
||||||
|
|
Loading…
Reference in New Issue