Tara Nath Subedi c8a5c86aa8 collectd-extensions: Add tests for secondary NIC clock class handling
Add unit tests for check_clock_class() function to validate clock
class determination when a secondary NIC is locked to an external
source while the primary NIC is in holdover state.

Test coverage includes:
- Clock class 7 when holdover is within threshold
- Clock class 140 when holdover exceeds threshold
- Clock class 248 when no holdover timestamp exists
- Secondary nic locked to an external pin type
- Verification that write_ptp4l_gm_fields() is called correctly

Adds 3 new test methods:
- test_secondary_nic_locked_primary_nic_holdover_within_threshold
- test_secondary_nic_locked_primary_nic_holdover_exceeds_threshold
- test_secondary_nic_locked_primary_nic_holdover_no_timestamp

This validates the code path where a secondary NIC (non-Granite
Rapid-D/Connorsville) with external pin type in LOCKED state
triggers a check of the primary NIC's GNSS connection status,
and the resulting clock class is set based on the primary NIC's
holdover duration.

For secondary NIC locked with GNSS pin type, instead of external
pin type, the following 3 more tests shows clockclass changed to 6,
whatever holdover state primary nic be.

- test_secondary_nic_locked_with_gnss_primary_nic_holdover_within_threshold
- test_secondary_nic_locked_with_gnss_primary_nic_holdover_exceeds_threshold
- test_secondary_nic_locked_with_gnss_primary_nic_holdover_no_timestamp

Test-only change: New tests are added.

TEST PLAN:
PASS: unit tests pass

Story: 2011536
Task: 53805

Change-Id: Ib848ffc96bf59d92e72e87d9b0d127aed173e443
Signed-off-by: Tara Nath Subedi <tara.subedi@windriver.com>
2026-02-10 14:53:09 +00:00
2025-12-20 04:51:22 +00:00
2019-09-09 14:37:23 -05:00
2019-09-09 14:37:23 -05:00
2019-09-09 14:37:23 -05:00
Description
StarlingX system monitoring and repoting tools
4.8 MiB
Languages
Python 85.4%
Perl 13.4%
Makefile 1%
Shell 0.1%