Caio Bruchert 63ba400fcd Make ptp-notification parameters configurable
To allow more flexibility to the user, The following PTP parameters
are being exposed to Helm Charts overrides configuration:

ptp-notification-v1:
- ptp4lClockClassLockedList

ptp-notification-v2:
- ptp4lClockClassLockedList
- phc2sysToleranceThreshold

Test Plan:
PASS: Build containers and helm charts
PASS: Deploy ptp-notification
PASS: v1 api - test ptp4lClockClassLockedList with the default,
               non-default and invalid lists
PASS: v2 api - test ptp4lClockClassLockedList with the default,
               non-default and invalid lists
PASS: v2 api - test phc2sysToleranceThreshold with commandline option
PASS: v2 api - test phc2sysToleranceThreshold with config file

Closes-bug: 2033539

Change-Id: I7dc915d99a91ff405c4cca4f1e1c1bf3a3559a4e
Signed-off-by: Caio Bruchert <caio.bruchert@windriver.com>
2023-09-11 12:27:14 -03:00

38 lines
1.0 KiB
Python

#
# Copyright (c) 2021-2023 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"
# 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"
CLOCK_CLASS_VALUE7 = "7"
CLOCK_CLASS_LOCKED_LIST = [CLOCK_CLASS_VALUE6, CLOCK_CLASS_VALUE7]
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/'