After ptp4l instance stopped, collectd log shows: "read-function of
plugin python.ptp failed", with StopIteration exception on next(
iter(upstream_time_status)). PMC query on stopped ptp4l instance
results empty dictionary, causing StopIteration exception.
This commit handles exceptions in check_ptp_regular when upstream
ptp4l instance is down or returns empty responses with 'sending:'
lines.
Changes:
- Strip leading whitespace in query_pmc_indexed before parsing index
to handle indented responses
- Add null check for upstream_identity to prevent StopIteration when
query_pmc_indexed returns empty dict
- Add conditional check before accessing upstream_gm_identity to
prevent KeyError
- Update clock_locked logic to verify upstream_identity exists before
comparison
Unit tests has been added.
- test_with_upstream_instance_down
- test_with_upstream_instance_locked
Test-Plan: PASS
- test_with_upstream_instance_down: Verify nolock alarm raised when
upstream instance is down
- test_with_upstream_instance_locked: Verify clock_locked=True and
time drift check when upstream is locked to remote GM
- Deploy PTP T-BC with ptp4ls and phc2sys instances, with ts2phc
generic and clock instances: upstream and downstream ptp instances
- stopping ptp4l instances has no issue on collectd.log
- stopping upstream ptp instance service, generates no-lock alarm on
downstream ptp instance
- starting upstream ptp service, clears no-lock alarm on downstream
Closes-Bug: 2142143
Change-Id: I8adb217c0331f3819f8e929bd34249dc2f9f7848
Signed-off-by: Tara Nath Subedi <tara.subedi@windriver.com>
Description
StarlingX system monitoring and repoting tools
Languages
Python
85.7%
Perl
13.1%
Makefile
1%
Shell
0.1%