
PTP-notification was treating clockClass values 7 and 135 as indicators of a locked status, which is incorrect as per ITU-T G.8275.1. This was resulting in ptp-notification delivering locked status to clients when it should instead be transitioning to holdover/freerun. Removed clockClass 7 and 135 from the list of valid locked clockClasses. PTP-notification is now able to properly transition states when these classes are observed. Test plan: PASS: Build and deploy image PASS: Verify correct state transitions when clockClass 6, 7, 135 are observed Partial-Bug: 1995014 Signed-off-by: Cole Walker <cole.walker@windriver.com> Change-Id: If68df991c3d6555f09e19a0d11f2c71e077c2587
75 lines
2.2 KiB
Python
75 lines
2.2 KiB
Python
#
|
|
# Copyright (c) 2021-2022 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
from os import path
|
|
|
|
# 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"
|
|
CLOCK_IDENTITY = "clockIdentity"
|
|
GRANDMASTER_IDENTITY = "grandmasterIdentity"
|
|
CLOCK_CLASS = "clockClass"
|
|
# expected values for valid ptp state
|
|
SLAVE_MODE = "slave"
|
|
MASTER_MODE = "master"
|
|
TIME_IS_TRACEABLE1 = "1"
|
|
TIME_IS_TRACEABLE2 = "true"
|
|
GM_IS_PRESENT = "true"
|
|
CLOCK_CLASS_VALUE6 = "6"
|
|
# ts2phc constants
|
|
NMEA_SERIALPORT = "ts2phc.nmea_serialport"
|
|
GNSS_PIN = "GNSS-1PPS"
|
|
GNSS_LOCKED_HO_ACK = 'locked_ho_ack'
|
|
GNSS_DPLL_0 = "DPLL0"
|
|
GNSS_DPLL_1 = "DPLL1"
|
|
|
|
UTC_OFFSET = "37"
|
|
|
|
if path.exists('/ptp/linuxptp/ptpinstance'):
|
|
LINUXPTP_CONFIG_PATH = '/ptp/linuxptp/ptpinstance/'
|
|
elif path.exists('/ptp/ptpinstance'):
|
|
LINUXPTP_CONFIG_PATH = '/ptp/ptpinstance/'
|
|
else:
|
|
LINUXPTP_CONFIG_PATH = '/ptp/'
|
|
PTP_CONFIG_PATH = LINUXPTP_CONFIG_PATH
|
|
PHC2SYS_CONFIG_PATH = LINUXPTP_CONFIG_PATH
|
|
TS2PHC_CONFIG_PATH = LINUXPTP_CONFIG_PATH
|
|
PHC_CTL_PATH = "/usr/sbin/phc_ctl"
|
|
PHC2SYS_DEFAULT_CONFIG = PHC2SYS_CONFIG_PATH + "phc2sys-phc2sys-legacy.conf"
|
|
|
|
CLOCK_REALTIME = "CLOCK_REALTIME"
|
|
|
|
PHC2SYS_TOLERANCE_LOW = 36999999000
|
|
PHC2SYS_TOLERANCE_HIGH = 37000001000
|
|
|
|
PTP_V1_KEY = "ptp_notification_v1"
|
|
|
|
SPEC_VERSION = "1.0"
|
|
DATA_VERSION = "1.0"
|
|
DATA_TYPE_NOTIFICATION = "notification"
|
|
DATA_TYPE_METRIC = "metric"
|
|
VALUE_TYPE_ENUMERATION = "enumeration"
|
|
VALUE_TYPE_METRIC = "metric"
|
|
|
|
SOURCE_SYNC_ALL = '/sync'
|
|
SOURCE_SYNC_GNSS_SYNC_STATUS = '/sync/gnss-status/gnss-sync-status'
|
|
SOURCE_SYNC_PTP_CLOCK_CLASS = '/sync/ptp-status/clock-class'
|
|
SOURCE_SYNC_PTP_LOCK_STATE = '/sync/ptp-status/lock-state'
|
|
SOURCE_SYNC_OS_CLOCK = '/sync/sync-status/os-clock-sync-state'
|
|
SOURCE_SYNC_SYNC_STATE = '/sync/sync-status/sync-state'
|
|
SOURCE_SYNCE_CLOCK_QUALITY = '/sync/synce-status/clock-quality'
|
|
SOURCE_SYNCE_LOCK_STATE_EXTENDED = '/sync/synce-status/lock-state-extended'
|
|
SOURCE_SYNCE_LOCK_STATE = '/sync/synce-status/lock-state'
|