flync_4_tsn

Time Synchronization (gPTP)

Expand for Schematic
        classDiagram

    class PTPTimeTransmitterConfig {
        type: Literal['time_transmitter'] = 'time_transmitter'
        log_tx_period: int
        two_step: bool | None = True
        tlv: list[str] | None = []
    }

    class PTPTimeReceiverConfig {
        type: Literal['time_receiver'] = 'time_receiver'
        sync_timeout: int
        sync_followup_timeout: int
    }

    class FLYNCBaseModel {
    }

    class PTPConfig {
        cmlds_linkport_enabled: bool = False
        ptp_ports: list[PTPPort] = []
    }

    class PTPPdelayConfig {
        log_tx_period: int
    }

    class PTPPort {
        domain_id: int
        src_port_identity: int
        sync_config: PTPTimeTransmitterConfig | PTPTimeReceiverConfig
        pdelay_config: PTPPdelayConfig | None = None
    }

    PTPPort ..> PTPTimeTransmitterConfig
    PTPPort ..> PTPTimeReceiverConfig
    PTPPort ..> PTPPdelayConfig
    PTPConfig ..> PTPPort


    

Hint

Find a YAML example for gPTP inside the Switch example (key ptp_config).

class PTPTimeTransmitterConfig

Bases: FLYNCBaseModel

Configuration for a PTP (Precision Time Protocol) time transmitter.

This class defines the settings required for a device acting as a time transmitter in a PTP domain.

Parameters

log_tx_periodint

Logarithmic mean message interval for Sync messages, expressed as 2^x seconds. Valid range is -7 (128 messages/sec) to 1 (1 message every 2 seconds).

two_stepbool, optional

Flag indicating whether two-step synchronization is used. Default is True.

tlvlist of str, optional

Optional list of TLV (Type-Length-Value) extensions included in Sync messages.

class PTPTimeReceiverConfig

Bases: FLYNCBaseModel

Configuration for a PTP (Precision Time Protocol) time receiver.

This class defines the settings required for a device acting as a time receiver in a PTP domain.

Parameters

sync_timeoutint

Timeout for receiving Sync messages, in milliseconds or implementation-specific units.

sync_followup_timeoutint

Timeout in miliseconds for receiving Follow_Up messages after a Sync message.

class PTPPdelayConfig

Bases: FLYNCBaseModel

Configuration for PTP peer delay (PDelay) messages.

This class defines the interval for transmitting peer delay measurement messages used to estimate path delay between devices.

Parameters

log_tx_periodint

Logarithmic mean message interval for PDelay messages (2^x seconds). Valid range: -4 to 3.

class PTPPort

Bases: FLYNCBaseModel

PTP port configuration for an ECU (Electronic Control Unit).

This class defines the configuration of a PTP port that may act as a transmitter or receiver, and optionally support peer delay measurements.

Parameters

domain_idint

PTP domain identifier used to separate multiple time sync domains. Must be greater than or equal to 0.

src_port_identityint

Unique identity for the source port. Must be >= 0.

sync_configPTPTimeTransmitterConfig or PTPTimeReceiverConfig

Sync behavior configuration for this port.

pdelay_configPTPPdelayConfig, optional

Configuration for peer delay (PDelay) measurements.

class PTPConfig

Bases: FLYNCBaseModel

Top-level PTP configuration for an ECU.

Parameters

cmlds_linkport_enabledbool

Enable the Common Mean Link Delay Service (CMLDS) on the physical Link Port that these PTP ports share. True → share meanLinkDelay/neighborRateRatio across all domains using delayMechanism=COMMON_P2P. False → instance-specific peer delay.

ptp_portslist of PTPPort

List of PTP port configurations contained in this ECU.

Quality of Service (QoS)

Expand for Schematic
        classDiagram

    class IPv4AddressEntry {
        address: IPv4Address
        ipv4netmask: IPv4Address
    }

    class Stream {
        name: str
        stream_identification: list[FrameFilter] = []
        drop_at_ingress: bool | None = False
        max_sdu_size: int | None = 1522
        policer: SingleRateTwoColorMarker | SingleRateThreeColorMarker | DoubleRateThreeColorMarker | None = None
        ipv: int | None = None
        ats: ATSInstance | None = None
    }

    class HTBInstance {
        root_id: str
        default_class: int | None = None
        child_classes: list[ChildClass]
    }

    class DoubleRateThreeColorMarker {
        type: Literal['double_rate_three_color'] = 'double_rate_three_color'
        cir: int
        cbs: int
        eir: int
        ebs: int
        coupling: bool = True
    }

    class ATSInstance {
        committed_information_rate: int
        committed_burst_size: int
        max_residence_time: int
    }

    class HTBFilter {
        src_mac: str | MACAddressEntry | list[str | MACAddressEntry] | None = None
        dst_mac: str | MACAddressEntry | list[str | MACAddressEntry] | None = None
        vlan_tagged: bool | None = None
        vlanid: int | ValueRange | list[int | ValueRange] | None = None
        pcp: int | list[int] | None = None
        src_ipv4: IPv4AddressEntry | IPv4Address | list[IPv4AddressEntry | IPv4Address] | None = None
        dst_ipv4: IPv4AddressEntry | IPv4Address | list[IPv4AddressEntry | IPv4Address] | None = None
        src_ipv6: IPv6AddressEntry | IPv6Address | list[IPv6AddressEntry | IPv6Address] | None = None
        dst_ipv6: IPv6AddressEntry | IPv6Address | list[IPv6AddressEntry | IPv6Address] | None = None
        protocol: Literal['tcp'] | Literal['udp'] | None = None
        src_port: int | ValueRange | list[int | ValueRange] | None = None
        dst_port: int | ValueRange | list[int | ValueRange] | None = None
        prio: int
    }

    class ATSShaper {
        type: Literal['ats'] = 'ats'
    }

    class ValueRange {
        from_value: int
        to_value: int
    }

    class FrameFilter {
        src_mac: str | MACAddressEntry | list[str | MACAddressEntry] | None = None
        dst_mac: str | MACAddressEntry | list[str | MACAddressEntry] | None = None
        vlan_tagged: bool | None = None
        vlanid: int | ValueRange | list[int | ValueRange] | None = None
        pcp: int | list[int] | None = None
        src_ipv4: IPv4AddressEntry | IPv4Address | list[IPv4AddressEntry | IPv4Address] | None = None
        dst_ipv4: IPv4AddressEntry | IPv4Address | list[IPv4AddressEntry | IPv4Address] | None = None
        src_ipv6: IPv6AddressEntry | IPv6Address | list[IPv6AddressEntry | IPv6Address] | None = None
        dst_ipv6: IPv6AddressEntry | IPv6Address | list[IPv6AddressEntry | IPv6Address] | None = None
        protocol: Literal['tcp'] | Literal['udp'] | None = None
        src_port: int | ValueRange | list[int | ValueRange] | None = None
        dst_port: int | ValueRange | list[int | ValueRange] | None = None
    }

    class TrafficClass {
        name: str
        priority: int
        frame_priority_values: list[int] | None = []
        internal_priority_values: list[int] | None = []
        selection_mechanisms: CBSShaper | ATSShaper | None = None
    }

    class MACAddressEntry {
        address: MacAddress
        macmask: str
    }

    class FLYNCBaseModel {
    }

    class ChildClass {
        classid: int
        rate: int
        ceil: int
        filter: list[HTBFilter] | None = []
        child_classes: list[ChildClass] | None = []
    }

    class IPv6AddressEntry {
        address: IPv6Address
        ipv6prefix: int
    }

    class SingleRateThreeColorMarker {
        type: Literal['single_rate_three_color'] = 'single_rate_three_color'
        cir: int
        cbs: int
        eir: Literal[0] = 0
        ebs: int
        coupling: Literal[True] = True
    }

    class CBSShaper {
        type: Literal['cbs'] = 'cbs'
        idleslope: int
    }

    class SingleRateTwoColorMarker {
        type: Literal['single_rate_two_color'] = 'single_rate_two_color'
        cir: int
        cbs: int
        eir: Literal[0] = 0
        ebs: int
        coupling: Literal[False] = False
    }

    IPv4AddressEntry ..> IPv4Address
    IPv6AddressEntry ..> IPv6Address
    MACAddressEntry ..> MacAddress
    FrameFilter ..> IPv4AddressEntry
    FrameFilter ..> MACAddressEntry
    FrameFilter ..> IPv6Address
    FrameFilter ..> ValueRange
    FrameFilter ..> IPv6AddressEntry
    FrameFilter ..> IPv4Address
    Stream ..> DoubleRateThreeColorMarker
    Stream ..> ATSInstance
    Stream ..> FrameFilter
    Stream ..> SingleRateThreeColorMarker
    Stream ..> SingleRateTwoColorMarker
    TrafficClass ..> ATSShaper
    TrafficClass ..> CBSShaper
    HTBFilter ..> IPv4AddressEntry
    HTBFilter ..> MACAddressEntry
    HTBFilter ..> IPv6Address
    HTBFilter ..> ValueRange
    HTBFilter ..> IPv6AddressEntry
    HTBFilter ..> IPv4Address
    ChildClass ..> HTBFilter
    ChildClass ..> ChildClass
    HTBInstance ..> ChildClass


    
class FrameFilter

Bases: FLYNCBaseModel

Defines filtering rules for frames based on MAC/IP addresses, VLAN, and transport protocol ports.

Parameters

src_macMacAddress or MACAddressEntry or list of (MacAddress | MACAddressEntry), optional

Source MAC address(es) to filter by. Acceptable formats are xx:xx:xx:xx:xx:xx or xx-xx-xx-xx-xx-xx (hexadecimal).

dst_macMacAddress or MACAddressEntry or list of (MacAddress | MACAddressEntry), optional

Destination MAC address(es) to filter by. Same format rules as src_mac.

vlan_taggedbool, optional

Whether the frame has a 802.1Q VLAN tag.

vlanidint or ValueRange or list of (int | ValueRange), optional

VLAN Identifier(s) to match. Integer values must be in the range 0-4095. ValueRange can specify an inclusive interval.

pcpint or list of int, optional

Priority Code Point (IEEE 802.1p traffic class). Values 0-7.

src_ipv4IPv4AddressEntry or IPv4Address or list of (IPv4AddressEntry | IPv4Address), optional

Source IPv4 address(es) to filter by.

dst_ipv4IPv4AddressEntry or IPv4Address or list of (IPv4AddressEntry | IPv4Address), optional

Destination IPv4 address(es) to filter by.

src_ipv6IPv6AddressEntry or IPv6Address or list of (IPv6AddressEntry | IPv6Address), optional

Source IPv6 address(es) to filter by.

dst_ipv6IPv6AddressEntry or IPv6Address or list of (IPv6AddressEntry | IPv6Address), optional

Destination IPv6 address(es) to filter by.

protocolLiteral[“tcp”, “udp”], optional

Transport protocol to filter by.

src_portint or ValueRange or list of (int | ValueRange), optional

Source transport layer port(s). Integers must be > 0.

dst_portint or ValueRange or list of (int | ValueRange), optional

Destination transport layer port(s). Integers must be > 0.

Ingress Per-Stream Filtering and Policing

Hint

Find a YAML example for Ingress Streams inside the Switch example (key ingress_streams).

class Stream

Bases: FLYNCBaseModel

Represents an IEEE 802.1Qci stream with optional traffic policing, and filtering.

Parameters

namestr

Unique name of the stream.

stream_identificationlist of FrameFilter

List of filters used to identify stream traffic.

drop_at_ingressbool, optional

Whether to drop traffic at ingress. Default is False.

max_sdu_sizeint, optional

Maximum size of the Service Data Unit in bytes. Default is 1522 bytes.

policerSingleRateTwoColorMarker, SingleRateThreeColorMarker, or DoubleRateThreeColorMarker, optional

Optional traffic policer configuration for this stream. Determines how traffic is metered or marked. The correct subclass is selected based on the type discriminator.

ipvint, optional

Internal Priority Value (0-7) assigned to the stream, if used.

atsATSInstance, optional

Optional Asynchronous Traffic Shaping configuration for ingress streams.

class ATSInstance

Bases: FLYNCBaseModel

Defines an ATS (Asynchronous Traffic Shaping) instance configuration for an ingress stream. ATS shaping is applied on egress when an ATSShaper is configured.

Parameters

committed_information_rateint

Guaranteed data rate in kilobits per second (kbps).

committed_burst_sizeint

Maximum burst size allowed within the committed rate in kilobytes (kB).

max_residence_timeint

Maximum time a frame can reside within the switch in microseconds (µs).

class SingleRateTwoColorMarker

Bases: FLYNCBaseModel

Policer model implementing a single-rate, two-color marker.

This model marks traffic based on a single committed rate (CIR), with two traffic colors: conforming and exceeding. It does not support excess information rate (EIR) and operates without coupling.

Parameters

typeLiteral[“single_rate_two_color”]

Literal identifier specifying the policer type. Defaults to “single_rate_two_color” for schema identification.

cirint

Committed Information Rate in kilobits per second (kbps). Must be greater than 0.

cbsint

Committed Burst Size in kilobytes (kB). Must be greater than 0.

eirLiteral[0]

Excess Information Rate. Fixed at 0 for this model.

ebsint

Excess Burst Size in kilobytes (kB). Must be greater than or equal to 0.

couplingLiteral[False]

Coupling flag. Disabled for the two-color model.

class SingleRateThreeColorMarker

Bases: FLYNCBaseModel

Policer model implementing a single-rate, three-color marker.

This model uses a single committed rate (CIR) and marks packets as conforming, exceeding, or violating based on bucket fill levels. Coupling is enabled to allow the excess bucket to draw from the committed bucket.

Parameters

typeLiteral[“single_rate_three_color”]

Literal identifier specifying the policer type. Defaults to “single_rate_three_color” for schema identification.

cirint

Committed Information Rate in kilobits per second (kbps). Must be greater than 0.

cbsint

Committed Burst Size in kilobytes (kB). Must be greater than 0.

eirLiteral[0]

Excess Information Rate. Fixed at 0 for this model.

ebsint

Excess Burst Size in kilobytes (kB). Must be greater than 0.

couplingLiteral[True]

Coupling flag. Enabled for three-color behavior.

class DoubleRateThreeColorMarker

Bases: FLYNCBaseModel

Policer model implementing a double-rate, three-color marker.

This model supports both committed and excess information rates (CIR and EIR) and marks traffic with three colors: conforming, exceeding, and violating. Coupling behavior is configurable.

Parameters

typeLiteral[“double_rate_three_color”]

Literal identifier specifying the policer type. Defaults to “double_rate_three_color” for schema identification.

cirint

Committed Information Rate in kilobits per second (kbps). Must be greater than 0.

cbsint

Committed Burst Size in kilobytes (kB). Must be greater than 0.

eirint

Excess Information Rate in kilobits per second (kbps). Must be greater than 0.

ebsint

Excess Burst Size in kilobytes (kB). Must be greater than 0.

couplingbool

Coupling flag. Determines whether the excess bucket draws from the committed bucket.

Egress Traffic Shaping

Hint

Find a YAML example for Traffic Classes inside the Switch example (key traffic_classes).

class TrafficClass

Bases: FLYNCBaseModel

Defines a traffic class for prioritizing and shaping traffic on device egress queues.

Parameters

namestr

Name or description of the traffic class.

priorityint

Traffic Class priority value. Valid range: 0-7.

frame_priority_valueslist of int, optional

Mapped priority values from Ethernet frames (PCP values). Valid range for each entry: 0-7. Default is an empty list.

internal_priority_valueslist of int, optional

Mapped internal switch priority values (IPV). Valid range for each entry: 0-7. Default is an empty list.

selection_mechanismsCBSShaper or ATSShaper, optional

Optional shaping mechanism applied to the traffic class. Can be a CBS (Credit-Based Shaper) or ATS (Asynchronous Traffic Shaper) instance. The correct subclass is selected using the type discriminator.

Shapers

class CBSShaper

Bases: FLYNCBaseModel

Credit-Based Shaper (CBS) configuration model.

This class represents the configuration for a CBS traffic shaping mechanism, which manages bandwidth allocation and latency for time-sensitive networking (TSN) streams. CBS uses a credit-based algorithm to control frame transmission rates.

Parameters

typeLiteral[“cbs”]

Literal identifier specifying the shaper type. Defaults to “cbs” for schema identification.

idleslopeint

The rate at which credits accumulate when the stream is not transmitting. Determines bandwidth allocation. Value specified in kilobits per second (kbps). Must be between 0 and 1000000.

class ATSShaper

Bases: FLYNCBaseModel

Specifies a shaper using the ATS (Asynchronous Traffic Shaping) mechanism.

This shaper applies to a specific stream ATS instance configured on an ATSInstance.

Parameters

typeLiteral[“ats”]

Literal identifier specifying the shaper type. Defaults to “ats” for schema identification.

class HTBInstance

Bases: FLYNCBaseModel

Defines an HTB (Hierarchical Token Bucket) instance for traffic shaping and class-based bandwidth management.

Parameters

root_idstr

Identifier for the root of the HTB hierarchy. Must follow the format “number:”.

default_classint, optional

Default class ID to which traffic is assigned if it does not match any child class.

child_classeslist of ChildClass

List of child classes under the HTB root, defining traffic priorities, guaranteed rates, ceilings, and filters.

class HTBFilter

Bases: FrameFilter

Defines a filter for HTB (Hierarchical Token Bucket) child classes.

Parameters

prioint

Priority of the filter.

class ChildClass

Bases: FLYNCBaseModel

Defines a child class for HTB (Hierarchical Token Bucket).

Parameters

classidint

Unique identifier for the child class.

rateint

Minimum guaranteed bandwidth for this child class in Mbps.

ceilint

Maximum bandwidth this class can consume if leftover capacity is available (in Mbps).

filterlist of HTBFilter, optional

List of filters applied to identify traffic belonging to this class.

child_classeslist of ChildClass, optional

Nested child classes under this HTB class.