Udi Schwager eb4458e37e Fix an incorrect state when multiple ports are configured
The code now reads the state of all the ports configured
and makes a decision upon the condition of at least one Slave port
If there is no Slave port in a state of a Slave, it reports it
as Freerun or Holdover

Partial-Bug: 1924197

Signed-off-by: Udi Schwager <udi.schwager@windriver.com>
Change-Id: I9988459454b9d3cc3333f0268fb05c90e813de3c
2021-05-03 13:33:43 -04:00

27 lines
634 B
Python

#
# Copyright (c) 2021 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# phc states constants
FREERUN_PHC_STATE = "Freerun"
LOCKED_PHC_STATE = "Locked"
HOLDOVER_PHC_STATE = "Holdover"
UNKNOWN_PHC_STATE = "Unknown"
# PMC command constants
PORT_STATE = "portState"
PORT = "port{}"
GM_PRESENT = "gmPresent"
MASTER_OFFSET = "master_offset"
GM_CLOCK_CLASS = "gm.ClockClass"
TIME_TRACEABLE = "timeTraceable"
# expected values for valid ptp state
SLAVE_MODE = "slave"
TIME_IS_TRACEABLE1 = "1"
TIME_IS_TRACEABLE2 = "true"
GM_IS_PRESENT = "true"
CLOCK_CLASS_VALUE1 = "6"
CLOCK_CLASS_VALUE2 = "7"
CLOCK_CLASS_VALUE3 = "135"