pmc_protocol
PMC (PTP Management Client) protocol dataclasses for parsing PTP management messages.
This module defines dataclasses that correspond to PTP management TLV (Type-Length-Value) types. Each dataclass uses the @regex_from_tlv decorator to automatically generate a regex pattern for parsing PMC output.
Classes:
-
AlternateTimeOffsetEnable–PTP alternate time offset enable TLV.
-
AlternateTimeOffsetName–PTP alternate time offset name TLV.
-
AlternateTimeOffsetProperties–PTP alternate time offset properties TLV.
-
AnnounceReceiptTimeout–PTP announce receipt timeout TLV.
-
ClockAccuracy–PTP clock accuracy TLV.
-
ClockDescription–PTP clock description TLV.
-
CmldsInfoNp–LinuxPTP CMLDS info TLV.
-
CurrentDataSet–PTP current data set TLV.
-
DefaultDataSet–PTP default data set TLV.
-
DelayMechanism–PTP delay mechanism TLV.
-
Domain–PTP domain TLV.
-
Empty–Empty TLV placeholder.
-
GrandmasterSettingsNp–LinuxPTP grandmaster settings TLV.
-
LogAnnounceInterval–PTP log announce interval TLV.
-
LogMinPdelayReqInterval–PTP log min pdelay request interval TLV.
-
LogSyncInterval–PTP log sync interval TLV.
-
ManagementErrorStatusTlv–PMC management error status TLV.
-
ManagementTlv–PMC management TLV wrapper.
-
MasterOnly–PTP master-only TLV.
-
NullManagement–Null management TLV.
-
ParentDataSet–PTP parent data set TLV.
-
PortDataSet–PTP port data set TLV.
-
PortDataSetNp–LinuxPTP port data set TLV.
-
PortHwclockNp–LinuxPTP port hardware clock TLV.
-
PortIdentity–PTP port identity consisting of clock ID and port number.
-
PortPropertiesNp–LinuxPTP port properties TLV.
-
PortServiceStatsNp–LinuxPTP port service statistics TLV.
-
PortStatsNp–LinuxPTP port statistics TLV.
-
PowerProfileSettingsNp–LinuxPTP power profile settings TLV.
-
Priority1–PTP priority1 TLV.
-
Priority2–PTP priority2 TLV.
-
Request–A parsed PMC request message.
-
Response–A parsed PMC response message.
-
SlaveOnly–PTP slave-only TLV.
-
SubscribeEventsNp–LinuxPTP subscribe events TLV.
-
SynchronizationUncertainNp–LinuxPTP synchronization uncertain TLV.
-
TimePropertiesDataSet–PTP time properties data set TLV.
-
TimeStatusNp–LinuxPTP time status TLV.
-
TimescaleProperties–PTP timescale properties TLV.
-
TraceabilityProperties–PTP traceability properties TLV.
-
UnknownTlv–Unknown TLV placeholder.
-
UserDescription–PTP user description TLV.
-
VersionNumber–PTP version number TLV.
Functions:
-
multiline_regex_from_keys–Generate a multiline regex pattern from dataclass field names.
-
regex_from_tlv–Decorator that adds a regex attribute to a TLV dataclass.
-
regex_from_tlv_union–Combine regex patterns from a union of TLV types.
AlternateTimeOffsetEnable
dataclass
PTP alternate time offset enable TLV.
AlternateTimeOffsetName
dataclass
PTP alternate time offset name TLV.
AlternateTimeOffsetProperties
dataclass
AlternateTimeOffsetProperties(
keyField: int,
currentOffset: int,
jumpSeconds: int,
timeOfNextJump: int,
)
PTP alternate time offset properties TLV.
AnnounceReceiptTimeout
dataclass
AnnounceReceiptTimeout(announceReceiptTimeout: int)
PTP announce receipt timeout TLV.
ClockDescription
dataclass
ClockDescription(
clockType: int,
physicalLayerProtocol: str,
physicalAddress: str,
protocolAddress: str,
manufacturerId: str,
productDescription: str,
revisionData: str,
userDescription: str,
profileId: str,
)
PTP clock description TLV.
CmldsInfoNp
dataclass
LinuxPTP CMLDS info TLV.
CurrentDataSet
dataclass
DefaultDataSet
dataclass
GrandmasterSettingsNp
dataclass
GrandmasterSettingsNp(
clockClass: int,
clockAccuracy: int,
offsetScaledLogVariance: int,
currentUtcOffset: int,
leap61: int,
leap59: int,
currentUtcOffsetValid: int,
ptpTimescale: int,
timeTraceable: int,
frequencyTraceable: int,
timeSource: int,
)
LinuxPTP grandmaster settings TLV.
LogAnnounceInterval
dataclass
LogAnnounceInterval(logAnnounceInterval: int)
PTP log announce interval TLV.
LogMinPdelayReqInterval
dataclass
LogMinPdelayReqInterval(logMinPdelayReqInterval: int)
PTP log min pdelay request interval TLV.
ParentDataSet
dataclass
ParentDataSet(
parentPortIdentity: PortIdentity,
parentStats: int,
observedParentOffsetScaledLogVariance: int,
observedParentClockPhaseChangeRate: int,
grandmasterPriority1: int,
gm__ClockClass: int,
gm__ClockAccuracy: int,
gm__OffsetScaledLogVariance: int,
grandmasterPriority2: int,
grandmasterIdentity: str,
)
PortDataSet
dataclass
PortDataSetNp
dataclass
LinuxPTP port data set TLV.
PortHwclockNp
dataclass
PortHwclockNp(
portIdentity: PortIdentity, phcIndex: int, flags: int
)
LinuxPTP port hardware clock TLV.
PortIdentity
dataclass
PortPropertiesNp
dataclass
PortPropertiesNp(
portIdentity: PortIdentity,
portState: str,
timestamping: str,
interface: str,
)
LinuxPTP port properties TLV.
PortServiceStatsNp
dataclass
PortServiceStatsNp(
portIdentity: PortIdentity,
announce_timeout: int,
sync_timeout: int,
delay_timeout: int,
unicast_service_timeout: int,
unicast_request_timeout: int,
master_announce_timeout: int,
master_sync_timeout: int,
qualification_timeout: int,
sync_mismatch: int,
followup_mismatch: int,
)
LinuxPTP port service statistics TLV.
PortStatsNp
dataclass
PortStatsNp(
portIdentity: PortIdentity,
rx_Sync: int,
rx_Delay_Req: int,
rx_Pdelay_Req: int,
rx_Pdelay_Resp: int,
rx_Follow_Up: int,
rx_Delay_Resp: int,
rx_Pdelay_Resp_Follow_Up: int,
rx_Announce: int,
rx_Signaling: int,
rx_Management: int,
tx_Sync: int,
tx_Delay_Req: int,
tx_Pdelay_Req: int,
tx_Pdelay_Resp: int,
tx_Follow_Up: int,
tx_Delay_Resp: int,
tx_Pdelay_Resp_Follow_Up: int,
tx_Announce: int,
tx_Signaling: int,
tx_Management: int,
)
LinuxPTP port statistics TLV.
PowerProfileSettingsNp
dataclass
PowerProfileSettingsNp(
version: int,
grandmasterID: int,
grandmasterTimeInaccuracy: int,
networkTimeInaccuracy: int,
totalTimeInaccuracy: int,
)
LinuxPTP power profile settings TLV.
Response
dataclass
Response(
source_port: PortIdentity,
seq: int,
action: str,
tlv: ResponseTlvPayload,
)
A parsed PMC response message.
SubscribeEventsNp
dataclass
SubscribeEventsNp(
duration: int,
NOTIFY_PORT_STATE: str,
NOTIFY_TIME_SYNC: str,
NOTIFY_PARENT_DATA_SET: str,
NOTIFY_CMLDS: str,
)
LinuxPTP subscribe events TLV.
SynchronizationUncertainNp
dataclass
SynchronizationUncertainNp(uncertain: int)
LinuxPTP synchronization uncertain TLV.
TimePropertiesDataSet
dataclass
TimePropertiesDataSet(
currentUtcOffset: int,
leap61: int,
leap59: int,
currentUtcOffsetValid: int,
ptpTimescale: int,
timeTraceable: int,
frequencyTraceable: int,
timeSource: int,
)
PTP time properties data set TLV.
TimeStatusNp
dataclass
TimeStatusNp(
master_offset: int,
ingress_time: int,
cumulativeScaledRateOffset: float,
scaledLastGmPhaseChange: int,
gmTimeBaseIndicator: int,
lastGmPhaseChange: float,
gmPresent: str,
gmIdentity: str,
)
LinuxPTP time status TLV.
TraceabilityProperties
dataclass
PTP traceability properties TLV.
multiline_regex_from_keys
Generate a multiline regex pattern from dataclass field names.
regex_from_tlv
Decorator that adds a regex attribute to a TLV dataclass.
The dataclass must have a tlv_type class attribute.
Parameters:
-
cls(T) –The dataclass to decorate.
Raises:
Returns:
-
T–The decorated class with a regex attribute.