-
Problem report
-
Resolution: Unresolved
-
Major
-
None
-
7.4.5
-
Zabbix Juniper MX Netconf template 7.4-1
-
Support backlog
Steps to reproduce:
- Parsing of returned values of RPC calls for DOM optics details fails on various Juniper hardware with single lane 100G optics such as QSFP28 100G-FR/100GBASE-FR1 and QSFP28 100G-LR/100GBASE-LR1 optics.
When a single lane QSFP optic returns DOM values for a single lane, instead of 4, The output of <optics-diagnostics-lane-values> is treated as a list instead of an array. This results in failure to parse. in the second stage of pre-processing of the DOM: Get data item.
Single Lane optic XML from Junos show interfaces diagnostics optics | display xml
<optics-diagnostics-lane-values> <lane-index>0</lane-index> <laser-bias-current>0.000</laser-bias-current> <laser-output-power>0.000</laser-output-power> <laser-output-power-dbm>-40.04</laser-output-power-dbm> <laser-rx-optical-power>0.000</laser-rx-optical-power> <laser-rx-optical-power-dbm>-40.04</laser-rx-optical-power-dbm> <laser-bias-current-high-alarm>off</laser-bias-current-high-alarm> <laser-bias-current-low-alarm>on</laser-bias-current-low-alarm> <laser-bias-current-high-warn>off</laser-bias-current-high-warn> <laser-bias-current-low-warn>on</laser-bias-current-low-warn> <laser-rx-power-high-alarm>off</laser-rx-power-high-alarm> <laser-rx-power-low-alarm>on</laser-rx-power-low-alarm> <laser-rx-power-high-warn>off</laser-rx-power-high-warn> <laser-rx-power-low-warn>on</laser-rx-power-low-warn> <laser-tx-power-high-alarm>off</laser-tx-power-high-alarm> <laser-tx-power-low-alarm>on</laser-tx-power-low-alarm> <laser-tx-power-high-warn>off</laser-tx-power-high-warn> <laser-tx-power-low-warn>on</laser-tx-power-low-warn> <tx-loss-of-signal-functionality-alarm>off</tx-loss-of-signal-functionality-alarm> <rx-loss-of-signal-alarm>on</rx-loss-of-signal-alarm> <tx-laser-disabled-alarm>on</tx-laser-disabled-alarm> </optics-diagnostics-lane-values> </optics-diagnostics>
Parsed by first stage of pre-processor.
"optics-diagnostics-lane-values": { "lane-index": "0", "laser-bias-current": "65.512", "laser-output-power": "1.722", "laser-output-power-dbm": "2.36", "laser-rx-optical-power": "0.000", "laser-rx-optical-power-dbm": "-40.04", "laser-bias-current-high-alarm": "off", "laser-bias-current-low-alarm": "off", "laser-bias-current-high-warn": "off", "laser-bias-current-low-warn": "off", "laser-rx-power-high-alarm": "off", "laser-rx-power-low-alarm": "on", "laser-rx-power-high-warn": "off", "laser-rx-power-low-warn": "on", "laser-tx-power-high-alarm": "off", "laser-tx-power-low-alarm": "off", "laser-tx-power-high-warn": "off", "laser-tx-power-low-warn": "off", "tx-loss-of-signal-functionality-alarm": "off", "rx-loss-of-signal-alarm": "on", "tx-laser-disabled-alarm": "off" }
If that list is converted to an array of 1 item the 2nd stage parsing continues correctly.
"optics-diagnostics-lane-values": [ { "lane-index": "0", "laser-bias-current": "0.000", "laser-output-power": "0.000", "laser-output-power-dbm": "-40.04", "laser-rx-optical-power": "0.000", "laser-rx-optical-power-dbm": "-40.04", "laser-bias-current-high-alarm": "off", "laser-bias-current-low-alarm": "on", "laser-bias-current-high-warn": "off", "laser-bias-current-low-warn": "on", "laser-rx-power-high-alarm": "off", "laser-rx-power-low-alarm": "on", "laser-rx-power-high-warn": "off", "laser-rx-power-low-warn": "on", "laser-tx-power-high-alarm": "off", "laser-tx-power-low-alarm": "on", "laser-tx-power-high-warn": "off", "laser-tx-power-low-warn": "on", "tx-loss-of-signal-functionality-alarm": "off", "rx-loss-of-signal-alarm": "on", "tx-laser-disabled-alarm": "on" } ]
To do this I inserted this preprocessing step between the existing two existing steps to locate non-array versions of optics-diagnostics-lane-values and correct them.
var jsonData = JSON.parse(value); function normalizeOpticsLaneValues(data) { var interfaces = data.results[1]['rpc-reply']['interface-information']['physical-interface']; interfaces.forEach(function (iface) { var opticsDiag = iface['optics-diagnostics']; if (!opticsDiag) return; if (!opticsDiag['optics-diagnostics-lane-values']) { return; } else { var laneValues = opticsDiag['optics-diagnostics-lane-values']; // If it's a single object, wrap it in an array if (!Array.isArray(laneValues)) opticsDiag['optics-diagnostics-lane-values'] = [laneValues]; } }); return data; } normalizedData = normalizeOpticsLaneValues(jsonData); return JSON.stringify(normalizedData);
Hope this helps,
–
Trent Muldoon
Network Engineering
Cornell University