Package: inet.node.tsn
TsnSwitch
compound moduleAn Ethernet switch with Time-Sensitive Networking (TSN) capabilities. It extends the standard EthernetSwitch with various TSN features defined in the IEEE 802.1 standards suite for deterministic, low-latency communication over Ethernet networks.
This module provides a comprehensive implementation of TSN features, all of which are optional and can be enabled or disabled individually. The switch supports time synchronization, traffic filtering and shaping, stream redundancy, frame preemption, and cut-through switching. These features can be combined to meet the requirements of different industrial, automotive, and professional audio/video applications.
Key features:
- IEEE 802.1AS time synchronization
- IEEE 802.1Qci per-stream filtering and policing for traffic control
- IEEE 802.1Q traffic shaping
- IEEE 802.1CB frame replication and elimination for seamless redundancy
- IEEE 802.1Qbu frame preemption for reduced latency of critical traffic
- Cut-through switching for minimal forwarding latency
<b>See also:</b> ~TsnClock, ~TsnDevice
Inheritance diagram
The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.
Used in
| Name | Type | Description |
|---|---|---|
| AsynchronousShaperValidation | network | (no description) |
| AsynchronousShaperValidation | network | (no description) |
| CreditBasedShaperValidation | network | (no description) |
| CutthroughSwitchingShowcase | network | (no description) |
| FrameReplicationValidation | network | (no description) |
| GptpAndTasShowcase | network | (no description) |
| MulticastFailureProtectionShowcase | network | (no description) |
| OneMasterClockGptpShowcase | network | (no description) |
| TimeAwareShapingShowcaseNetwork | network | (no description) |
| TwoMasterClocksRingGptpShowcase | network | (no description) |
| TwoMasterClocksTreeGptpShowcase | network | (no description) |
Known subclasses
| Name | Type | Description |
|---|---|---|
| LocalTsnSwitch | compound module | (no description) |
| LocalTsnSwitch | compound module | (no description) |
| LocalTsnSwitch | compound module | (no description) |
| LocalTsnSwitch | compound module | (no description) |
| LocalTsnSwitch | compound module | (no description) |
| TsnSwitch1 | compound module | (no description) |
| TsnSwitch2 | compound module | (no description) |
Extends
| Name | Type | Description |
|---|---|---|
| EthernetSwitch | compound module |
EthernetSwitch models a Layer 2 Ethernet switch with support for various IEEE 802.1 protocols and features. It provides frame forwarding based on MAC addresses and implements multiple switching technologies. |
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| recordPcap | bool | false | |
| numPcapRecorders | int | recordPcap ? 1 : 0 | |
| numApps | int | 0 | |
| hasStatus | bool | false | |
| hasStp | bool | false | |
| hasMrp | bool | false | |
| hasGptp | bool | hasTimeSynchronization | |
| hasCutthroughSwitching | bool | false | |
| fcsMode | string | "declared" | |
| spanningTreeProtocol | string | "Stp" | |
| numEthInterfaces | int | 0 |
Minimum number of ethernet interfaces |
| hasTimeSynchronization | bool | false |
Enable IEEE 802.1 AS time synchronization |
| hasIngressTrafficFiltering | bool | false |
Enable IEEE 802.1 Qci ingress per-stream filtering |
| hasEgressTrafficShaping | bool | false |
Enable IEEE 802.1 egress traffic shaping (credit based shaping, time aware shaping, asynchronous shaping) |
| hasStreamRedundancy | bool | false |
Enable IEEE 802.1 CB frame replication and elimination |
| hasIncomingStreams | bool | false |
Enable IEEE 802.1 stream decoding |
| hasOutgoingStreams | bool | false |
Enable IEEE 802.1 stream identification and stream encoding |
| hasFramePreemption | bool | false |
Enable IEEE 802.1 Qbu frame preemption |
Properties
| Name | Value | Description |
|---|---|---|
| networkNode | ||
| labels | node | |
| display | i=device/switch |
Gates
| Name | Direction | Size | Description |
|---|---|---|---|
| ethg [ ] | inout | numEthInterfaces |
Unassigned submodule parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| macTable.agingTime | double | ||
| macTable.forwardingTableFile | string | ||
| interfaceTable.displayStringTextFormat | string | "" |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
| interfaceTable.displayAddresses | bool | false |
Whether to display IP addresses on links |
| status.displayStringTextFormat | string | "" |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
| status.initialStatus | string | "UP" |
TODO @signal, @statistic |
| pcapRecorder.displayStringTextFormat | string | "rec: %n pks" |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
| pcapRecorder.verbose | bool | true |
Whether to log packets on the module output |
| pcapRecorder.recordEmptyPackets | bool | true |
Specifies if zero length packets are recorded or not |
| pcapRecorder.enableConvertingPackets | bool | true |
Specifies if converting packets to link type is allowed or not |
| pcapRecorder.pcapFile | string | "" |
The PCAP file to be written, suggested value: pcapFile = "${resultdir}/${configname}-#${runnumber}" + fullpath() + ".pcap" |
| pcapRecorder.fileFormat | string | "pcapng" | |
| pcapRecorder.snaplen | int | 65535 |
Maximum number of bytes to record per packet |
| pcapRecorder.timePrecision | int | 6 |
Time precision in recorded file. pcap supports only 6 (usec) or 9 (nanosec), pcapng supports more values (see 'if_tsresol' option in pcapng file format). |
| pcapRecorder.dumpBadFrames | bool | true |
Enable dump of frames with hasBitError |
| pcapRecorder.moduleNamePatterns | string | "wlan[*] eth[*] ppp[*]" |
Space-separated list of sibling module names to listen on |
| pcapRecorder.sendingSignalNames | string | "transmissionEnded" |
Space-separated list of outbound packet signals to subscribe to |
| pcapRecorder.receivingSignalNames | string | "receptionEnded" |
Space-separated list of inbound packet signals to subscribe to |
| pcapRecorder.dumpProtocols | string | "ethernetmac ppp ieee80211mac" |
Space-separated list of protocol names as defined in the Protocol class |
| pcapRecorder.packetFilter | object | "*" |
Which packets are considered, matches all packets by default |
| pcapRecorder.helpers | string | "" |
Usable PcapRecorder::IHelper helpers for accept packettype and store/convert packet as specified linktype currently available: "inet::AckingMacToEthernetPcapRecorderHelper" |
| pcapRecorder.alwaysFlush | bool | false |
Flush the pcapFile after each write to ensure that all packets are captured in case of a crash |
| mrp.ccmInterval | double | ||
| mrp.mrpRole | string | ||
| mrp.timingProfile | int | ||
| mrp.uuid0 | int | ||
| mrp.uuid1 | int | ||
| mrp.ringPort1 | int | ||
| mrp.ringPort2 | int | ||
| mrp.interconnectionLinkCheckAware | bool | ||
| mrp.interconnectionRingCheckAware | bool | ||
| mrp.nonblockingMrcSupported | bool | ||
| mrp.reactOnLinkChange | bool | ||
| mrp.visualize | bool | ||
| stp.helloTime | double | ||
| stp.forwardDelay | double | ||
| stp.maxAge | double | ||
| stp.bridgePriority | int | ||
| stp.visualize | bool | ||
| gptp.gptpNodeType | string | "BRIDGE_NODE" | |
| sc.displayStringTextFormat | string | "processed %p pk (%l)" |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
| sc.interfaceTableModule | string |
Module path to the ~InterfaceTable module |
|
| sc.forwardServiceRegistration | bool | true | |
| sc.forwardProtocolRegistration | bool | true | |
| sc.interfaceMapping | object | {} |
Maps network interface names to connected submodule names (e.g. {"eth0": "bridging"}), overrides automatically learned dispatching; * overrides all learned network interfaces, ? overrides default |
| sc.serviceMapping | object | {} |
Maps protocols to connected submodule names (e.g. {"ethernetmac": "bridging"}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default |
| sc.protocolMapping | object | {} |
Maps protocols to connected submodule names (e.g. {"ipv4": "bridging"}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default |
| cb.displayStringTextFormat | string | "processed %p pk (%l)" |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
| cb.interfaceTableModule | string |
Module path to the ~InterfaceTable module |
|
| cb.forwardServiceRegistration | bool | true | |
| cb.forwardProtocolRegistration | bool | true | |
| cb.interfaceMapping | object | {} |
Maps network interface names to connected submodule names (e.g. {"eth0": "bridging"}), overrides automatically learned dispatching; * overrides all learned network interfaces, ? overrides default |
| cb.serviceMapping | object | {} |
Maps protocols to connected submodule names (e.g. {"ethernetmac": "bridging"}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default |
| cb.protocolMapping | object | {} |
Maps protocols to connected submodule names (e.g. {"ipv4": "bridging"}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default |
| bl.displayStringTextFormat | string | "processed %p pk (%l)" |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
| bl.interfaceTableModule | string |
Module path to the ~InterfaceTable module |
|
| bl.forwardServiceRegistration | bool | true | |
| bl.forwardProtocolRegistration | bool | true | |
| bl.interfaceMapping | object | {} |
Maps network interface names to connected submodule names (e.g. {"eth0": "bridging"}), overrides automatically learned dispatching; * overrides all learned network interfaces, ? overrides default |
| bl.serviceMapping | object | {} |
Maps protocols to connected submodule names (e.g. {"ethernetmac": "bridging"}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default |
| bl.protocolMapping | object | {} |
Maps protocols to connected submodule names (e.g. {"ipv4": "bridging"}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default |
| li.displayStringTextFormat | string | "processed %p pk (%l)" |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
| li.interfaceTableModule | string |
Module path to the ~InterfaceTable module |
|
| li.forwardServiceRegistration | bool | true | |
| li.forwardProtocolRegistration | bool | true | |
| li.interfaceMapping | object | {} |
Maps network interface names to connected submodule names (e.g. {"eth0": "bridging"}), overrides automatically learned dispatching; * overrides all learned network interfaces, ? overrides default |
| li.serviceMapping | object | {} |
Maps protocols to connected submodule names (e.g. {"ethernetmac": "bridging"}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default |
| li.protocolMapping | object | {} |
Maps protocols to connected submodule names (e.g. {"ipv4": "bridging"}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default |
| eth.bitrate | double |
Source code
// // An Ethernet switch with Time-Sensitive Networking (TSN) capabilities. It // extends the standard EthernetSwitch with various TSN features defined in the // IEEE 802.1 standards suite for deterministic, low-latency communication over // Ethernet networks. // // This module provides a comprehensive implementation of TSN features, all of which are // optional and can be enabled or disabled individually. The switch supports time synchronization, // traffic filtering and shaping, stream redundancy, frame preemption, and cut-through switching. // These features can be combined to meet the requirements of different industrial, automotive, // and professional audio/video applications. // // Key features: // - IEEE 802.1AS time synchronization // - IEEE 802.1Qci per-stream filtering and policing for traffic control // - IEEE 802.1Q traffic shaping // - IEEE 802.1CB frame replication and elimination for seamless redundancy // - IEEE 802.1Qbu frame preemption for reduced latency of critical traffic // - Cut-through switching for minimal forwarding latency // // @see ~TsnClock, ~TsnDevice // module TsnSwitch extends EthernetSwitch { parameters: bool hasTimeSynchronization = default(false); // Enable IEEE 802.1 AS time synchronization bool hasIngressTrafficFiltering = default(false); // Enable IEEE 802.1 Qci ingress per-stream filtering bool hasEgressTrafficShaping = default(false); // Enable IEEE 802.1 egress traffic shaping (credit based shaping, time aware shaping, asynchronous shaping) bool hasStreamRedundancy = default(false); // Enable IEEE 802.1 CB frame replication and elimination bool hasIncomingStreams = default(false); // Enable IEEE 802.1 stream decoding bool hasOutgoingStreams = default(false); // Enable IEEE 802.1 stream identification and stream encoding bool hasFramePreemption = default(false); // Enable IEEE 802.1 Qbu frame preemption hasGptp = default(hasTimeSynchronization); // Enable gPTP protocol gptp.gptpNodeType = default("BRIDGE_NODE"); // Configure gPTP bridge node type gptp.slavePort = default("eth0"); // Configure default gPTP bridge slave port clock.typename = default(hasTimeSynchronization ? "SettableClock" : ""); // Enable explicit local clock model when time synchronization is enabled ethernet.typename = default("EthernetLayer"); // Use Ethernet protocol layer outside of network interfaces eth[*].typename = default(hasCutthroughSwitching ? "EthernetCutthroughInterface" : "LayeredEthernetInterface"); // Switch to modular Ethernet interface eth[*].macLayer.typename = default(hasFramePreemption ? "EthernetPreemptingMacLayer" : "EthernetMacLayer"); eth[*].macLayer.queue.typename = default(hasFramePreemption ? "" : (hasEgressTrafficShaping ? "Ieee8021qTimeAwareShaper" : "PacketQueue")); // Use compound priority queue having multiple subqueues controlled by separate gates when egress traffic shaping is enabled eth[*].phyLayer.typename = default(hasCutthroughSwitching ? "EthernetStreamThroughPhyLayer" : (hasFramePreemption ? "EthernetPreemptingPhyLayer" : "EthernetPhyLayer")); // Use packet streaming when cut-through switching is enabled bridging.typename = default("BridgingLayer"); // Switch to modular bridging bridging.directionReverser.cutthroughBarrier.typename = default(hasCutthroughSwitching ? "EthernetCutthroughBarrier" : ""); // Enable cut-through barrier when cut-through switching is enabled bridging.streamIdentifier.typename = default(hasOutgoingStreams || hasStreamRedundancy ? "StreamIdentifierLayer" : ""); // Enable stream identification when stream redundancy is enabled bridging.streamRelay.typename = default(hasStreamRedundancy ? "StreamRelayLayer" : ""); // Enable stream merging and stream splitting when stream redundancy is enabled bridging.streamFilter.typename = default(hasIngressTrafficFiltering ? "StreamFilterLayer" : ""); // Enable stream filtering when ingress per-stream filtering is enabled bridging.streamFilter.ingress.typename = default(hasIngressTrafficFiltering ? "SimpleIeee8021qFilter" : ""); // Use 802.1 Qci ingress filtering when ingress per-stream filtering is enabled bridging.streamCoder.typename = default(hasIncomingStreams || hasOutgoingStreams || hasIngressTrafficFiltering || hasStreamRedundancy ? "StreamCoderLayer" : ""); // Enable stream encoding/decoding when stream redundancy is enabled bridging.interfaceRelay.learner.typename = default(hasIncomingStreams || hasOutgoingStreams ? "" : "RelayInterfaceLearner"); // Disable learning MAC addresses in the MAC forwarding table because it would change static TSN stream configuration ieee8021q.typename = default("Ieee8021qProtocol"); ieee8021r.typename = default("Ieee8021rProtocol"); }File: src/inet/node/tsn/TsnSwitch.ned