Tara Subedi 5ae719a36e PTP: Change overall sync-state behavior
Currently overall sync-state (/sync/sync-status/sync-state) represents
degraded (HOLDOVER/FREERUN) when any state is degraded: os-clock-sync-
state, ptp-status/lock-state, gnss-status/gnss-sync-status.

This commit changes overall sync-state to represent whether the os-clock
is synced or not to the timing source.

Overall sync-state should only be degraded if the timing sources
involved in providing the end-to-end timing is degraded or lost (i.e. it
should represent the overall timing chain status). ptp4l instances that
perform timing distribution only and are not part of the host timing
chain must not impact the overall sync-state. os-clock-state should only
represent the status of the OS clock sync state to the primary clock
source in an HA configuration.

Unit tests has been added and unit test's python interpreter has been
changed to python3.9 to inline with base-image's python version (3.9.2).

TEST PLAN:
   PASS: T-GM deployment with two ptp4l instances
         trigger different events (stop/start ptp4l/phc2sys/ts2phc
         instances, change clockClass, skew clocks, disable GNSS)
         overall sync-state is not affected by ptp-inst1 and ptp-inst2
         states.
   PASS: T-BC deployment with two ptp4l instances
         trigger different events (stop/start ptp4l/phc2sys instances,
         change clockClass, skew clocks)
         overall sync-state is not affected by secondary ptp instance
         state.

   PASS: Hybrid (T-GM/T-BC) HA deployement: HA with GNSS and PTP source
         trigger different events
         overall sync-state is result of chained relation to chosen
         primary source

Story: 2011370
Task: 51774

Change-Id: Ibfb7fa0f9f8ad09584a5f28b60b0e4649976932c
Signed-off-by: Tara Nath Subedi <tara.subedi@windriver.com>
2025-04-10 16:03:35 -04:00

76 lines
2.0 KiB
INI

[tox]
envlist = linters,py39
minversion = 2.3
skipsdist = True
sitepackages=False
[testenv]
install_command = pip install -U {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_DEBUG=1
OS_LOG_CAPTURE=1
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
allowlist_externals =
bash
[testenv:py39]
basepython = python3.9
setenv =
TESTPATH=./notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/tests/
commands =
unit2 discover -s ./notificationservice-base-v2/docker/ptptrackingfunction
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:bashate]
# Treat all E* codes as Errors rather than warnings using: -e 'E*'
commands =
bash -c "find {toxinidir} \
-not \( -type d -name .?\* -prune \) \
-type f \
-not -name \*~ \
-not -name \*.md \
-name \*.sh \
-print0 | xargs -r -n 1 -0 bashate -v \
-e 'E*'"
[testenv:linters]
commands =
{[testenv:bashate]commands}
[testenv:docs]
basepython = python3
install_command = pip install -U {opts} {packages}
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
allowlist_externals = rm
[testenv:api-ref]
basepython = python3
install_command = pip install -U {opts} {packages}
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
allowlist_externals = rm
[testenv:pylint]
basepython = python3
description = Dummy environment to allow pylint to be run in subdir tox
[testenv:flake8]
basepython = python3
description = Dummy environment to allow flake8 to be run in subdir tox
[testenv:metadata]
basepython = python3
description = Dummy environment to allow sysinv-app to be run in subdir tox