Closed nkitchen closed 1 year ago
When a Decimal64 value is between -1.0 and 0.0, the gnmi client displays it as the absolute value. This only occurs when the request includes the node's full path -- values embedded in JSON payloads do not have the issue.
For example:
% gnmi [...] get '/components/component[name=Ethernet54]/transceiver/physical-channels/channel/state/input-power/instant' /components/component[name=Ethernet54]/transceiver/physical-channels/channel[index=0]/state/input-power/instant: 0.571985336820596 /components/component[name=Ethernet54]/transceiver/physical-channels/channel[index=1]/state/input-power/instant: 0.8926890195661912 /components/component[name=Ethernet54]/transceiver/physical-channels/channel[index=2]/state/input-power/instant: 0.289097868628847 /components/component[name=Ethernet54]/transceiver/physical-channels/channel[index=3]/state/input-power/instant: 0.23925268380125786
The actual values are negative (Optical Rx Power):
switch#show interfaces Et54/1 - 54/$ transceiver If device is externally calibrated, only calibrated values are printed. N/A: not applicable, Tx: transmit, Rx: receive. mA: milliamperes, dBm: decibels (milliwatts). Bias Optical Optical Temp Voltage Current Tx Power Rx Power Port (Celsius) (Volts) (mA) (dBm) (dBm) Last Update ----- --------- -------- -------- -------- -------- ------------------- Et54/1 41.95 3.32 7.49 -0.27 -0.59 0:00:03 ago Et54/2 41.95 3.32 7.49 -0.01 -0.89 0:00:03 ago Et54/3 41.95 3.32 7.49 -0.28 -0.29 0:00:03 ago Et54/4 41.95 3.32 7.49 0.01 -0.24 0:00:03 ago
The cause of the issue is here: https://github.com/aristanetworks/goarista/blob/9de84549183ed950/gnmi/operation.go#L223-L225 It doesn't account for the case where i is 0 but d.Digits was negative.
i
d.Digits
Fixed by ecdad064059654c84458003e4b336faea7921432
When a Decimal64 value is between -1.0 and 0.0, the gnmi client displays it as the absolute value. This only occurs when the request includes the node's full path -- values embedded in JSON payloads do not have the issue.
For example:
The actual values are negative (Optical Rx Power):
The cause of the issue is here: https://github.com/aristanetworks/goarista/blob/9de84549183ed950/gnmi/operation.go#L223-L225 It doesn't account for the case where
i
is 0 butd.Digits
was negative.