Skip to content

linuxptp_config

Adapter for LinuxPTP configuration parsing.

Classes:

  • LinuxPtpConfig

    Abstract base class for LinuxPTP application configuration.

LinuxPtpConfig dataclass

LinuxPtpConfig(argv: list[str])

Bases: ABC

Abstract base class for LinuxPTP application configuration.

Parses command-line arguments and configuration files in the same way that ptp4l and phc2sys do.

Common config options shared between all LinuxPTP applications are handled here, while additional application-specific options are handled by subclasses.

See Also

https://linux.die.net/man/8/ptp4l

Attributes:

  • config (ConfigParser) –

    The parsed ConfigParser instance.

The default configuration file is expected at /etc/linuxptp/ptp4l.conf and should have been shipped with the LinuxPTP package. An additional configuration file can be specified with the -f command-line argument.

Parameter precedence is as follows (highest to lowest):

  1. Command-line arguments
  2. User-specified configuration file (via -f argument)
  3. Default configuration file (/etc/linuxptp/ptp4l.conf)

Parameters:

  • argv (list[str]) –

    Command-line arguments including program name.

Methods:

add_args_app_specific abstractmethod

add_args_app_specific(parser: ArgumentParser) -> None

Add application-specific arguments to the parser.

override_app_specific

override_app_specific(
    args: Namespace, config: ConfigParser
) -> list[str]

Apply app-specific overrides, return list of handled arg names.

validate_args_app_specific

validate_args_app_specific(args: Namespace) -> None

Validate application-specific arguments.

validate_config_app_specific

validate_config_app_specific(config: ConfigParser) -> None

Validate the final configuration.