genieparser
genieparser copied to clipboard
[IOS-XE] "show ntp assocations" parser does not correctly summarize clock state
The value of the clock_state.system_status.clock_state
key in the IOS-XE show ntp associations
has an incorrect value with some permutations of output.
For example, with the below output:
address ref clock st when poll reach delay offset disp
*~192.0.2.1 192.0.2.2 2 676 1024 377 0.117 -3.705 1.090
+~192.0.2.10 .GNSS. 1 811 1024 377 0.319 -3.649 1.053
~192.0.2.20 127.0.0.1 16 375 1024 0 0.000 0.000 15937.
* sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
Results in the below parsed data:
{
"clock_state": {
"system_status": {
"associations_address": "192.0.2.1",
"associations_local_mode": "client",
"clock_offset": -3.705,
"clock_refid": "192.0.2.2",
"clock_state": "unsynchronized",
"clock_stratum": 2,
"root_delay": 0.117,
},
},
"peer": {
"192.0.2.1": {
"local_mode": {
"client": {
"configured": True,
"delay": 0.117,
"jitter": 1.09,
"local_mode": "client",
"mode": "synchronized",
"offset": -3.705,
"poll": 1024,
"reach": 377,
"receive_time": 676,
"refid": "192.0.2.2",
"remote": "192.0.2.1",
"stratum": 2,
},
},
},
"192.0.2.10": {
"local_mode": {
"client": {
"configured": True,
"delay": 0.319,
"jitter": 1.053,
"local_mode": "client",
"mode": "candidate",
"offset": -3.649,
"poll": 1024,
"reach": 377,
"receive_time": 811,
"refid": ".GNSS.",
"remote": "192.0.2.10",
"stratum": 1,
},
},
},
"192.0.2.20": {
"local_mode": {
"client": {
"configured": True,
"delay": 0.0,
"jitter": 15937.0,
"local_mode": "client",
"mode": "unsynchronized",
"offset": 0.0,
"poll": 1024,
"reach": 0,
"receive_time": 375,
"refid": "127.0.0.1",
"remote": "192.0.2.20",
"stratum": 16,
},
},
},
},
}
We can see that the value of the clock_state.system_status.clock_state
indicates the device is unsychronized, even though it's synchronized.