TsnSwitch¶
Package: inet.node.tsn
compound module TsnSwitch
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
Usage diagram¶
Inheritance diagram¶
Used in¶
Name |
Type |
Description |
|---|---|---|
network |
(no description) |
|
network |
(no description) |
Extends¶
Name |
Type |
Description |
|---|---|---|
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 |
|---|---|---|
display |
i=device/switch |
|
labels |
node,ethernet-node |
|
networkNode |
Gates¶
Name |
Direction |
Size |
Description |
|---|---|---|---|
ethg [ ] |
inout |
numEthInterfaces |
Unassigned submodule parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
macTable.displayStringTextFormat |
string |
“addr: %a\nvlan: %v” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
macTable.agingTime |
double |
120s |
|
macTable.forwardingTable |
object |
[] |
|
macTable.forwardingTableFile |
string |
“” |
|
macTable.interfaceTableModule |
string |
||
interfaceTable.displayStringTextFormat |
string |
“{numInterfaces} interfaces” |
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 |
l2NodeConfigurator.displayStringTextFormat |
string |
“” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
l2NodeConfigurator.interfaceTableModule |
string |
||
l2NodeConfigurator.l2ConfiguratorModule |
string |
“l2NetworkConfigurator” |
The absolute path to the L2NetworkConfigurator; use “” if there is no configurator |
status.displayStringTextFormat |
string |
“{stateStr}” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
status.initialStatus |
string |
“UP” |
Initial status of the network node |
clock.oscillator.displayStringTextFormat |
string |
“%c (%n + %d)” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
clock.oscillator.emitNumTicksSignal |
bool |
!parent.useFutureEventSet |
Enables emitting a signal at each oscillator tick, can be useful for validating the behavior of the more efficient implementation without events |
clock.oscillator.oscillatorTickEventSchedulingPriority |
int |
0 |
Specifies the scheduling priority of the tick event |
clock.oscillator.nominalTickLength |
double |
Specifies the elapsed time between oscillator ticks |
|
clock.oscillator.tickOffset |
double |
0s |
Shifts ticks to the past, must be in the range of [0, current tick length) |
clock.oscillator.driftRate |
double |
0ppm |
Constant fractional frequency offset |
clock.underlyingClock.oscillator.displayStringTextFormat |
string |
“%c (%n + %d)” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
clock.underlyingClock.oscillator.emitNumTicksSignal |
bool |
!parent.useFutureEventSet |
Enables emitting a signal at each oscillator tick, can be useful for validating the behavior of the more efficient implementation without events |
clock.underlyingClock.oscillator.oscillatorTickEventSchedulingPriority |
int |
0 |
Specifies the scheduling priority of the tick event |
clock.underlyingClock.oscillator.nominalTickLength |
double |
Specifies the elapsed time between oscillator ticks |
|
clock.underlyingClock.oscillator.tickOffset |
double |
0s |
Shifts ticks to the past, must be in the range of [0, current tick length) |
clock.underlyingClock.oscillator.driftRate |
double |
0ppm |
Constant fractional frequency offset |
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 |
pcapRecorder.alwaysFlush |
bool |
false |
Flush the pcapFile after each write to ensure that all packets are captured in case of a crash |
mrp.displayStringTextFormat |
string |
“role: %r\nnode: %n\nring: %g” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
mrp.linkDetectionDelay |
double |
truncnormal(385ms,325ms) |
Switches do not detect a link change immediately. This parameter sets the simulated delay of a “link down” event. Note: the delay for “link up” is hardcoded to 1us in the code. |
mrp.processingDelay |
double |
truncnormal(100us,80us) |
Switches require a certain amount of time to process each received packet. This parameter sets the processing delay; it is applied in handleMessageWhenUp(). |
mrp.timingProfile |
int |
500ms |
MRP defines four Maximum Recovery Time settings for rings: 500 ms, 200 ms, 30 ms, or 10 ms. This parameter sets a hard upper time limit guaranteed by the protocol, and the interval for test frames, topology changes, and link change times are adapted accordingly. It should be set to the same value on all nodes within a ring. |
mrp.mrpRole |
string |
“disabled” |
Each MRP node can either be disabled (value 0, no MRP function), be a MediaRedundancyClient (MRC, value 1), a MediaRedundancyManager (MRM, value 2), or a MediaRedundancyAutoManager (MRA, value 4). The model does not support the backward-compatible MRA (value 3) as it would be redundant. Each network may have only one MRM; all other nodes must assume the MRC role. MRAs can vote on which node should take the MRM role based on priority and MAC address value; other nodes dynamically switch to the MRC role. Mixing MRM and MRA is possible but not recommended. |
mrp.ringPort1 |
int |
0 |
Each MRP node has exactly two ring interfaces, which must be configured by the network administrator. The ringPort1 and ringPort2 parameters define the port index of the first and second ring port, respectively. |
mrp.ringPort2 |
int |
1 |
|
mrp.uuid0 |
int |
An MRP ring has a UUID, split into two 64-bit parts. Every node in a ring must be configured with the same UUID. |
|
mrp.uuid1 |
int |
||
mrp.enableLinkCheckOnRing |
bool |
false |
It is possible to enable active link checks on Layer 2 for each ring port, using CCM (Connectivity Check Message) messages defined in 802.1q Continuity Fault Management (CFM). Consider the additional load on the node and network when enabling this feature. |
mrp.ccmInterval |
double |
10ms |
CCM (Connectivity Check Message) link checks can be performed every 3.3 ms or every 10 ms. |
mrp.interconnectionRingCheckAware |
bool |
true |
MRP rings can be redundantly connected by interconnection nodes. To manage necessary communication, normal MRP nodes should be aware of the check methods used. Checks can be performed either by ring check (similar to the ring test mechanism) or by link check on Layer 2 (CCM messages). |
mrp.interconnectionLinkCheckAware |
bool |
true |
|
mrp.visualize |
bool |
true |
Visualizes the ring by coloring connections in the network graphics. Labels the Ethernet interface with port role and status. |
mrp.interfaceTableModule |
string |
The path to the InterfaceTable module. |
|
mrp.macTableModule |
string |
The path to the MacForwardingTable module. |
|
mrp.mrpRelayModule |
string |
The path to the MrpRelay module. |
|
mrp.mrpPriority |
int |
0xA000 |
A MRM or MRA can have a priority ranging from the highest (0x0000) to the lowest (0xFFFF). MRMs should be assigned one of the following values: HIGHEST = 0x0000, HIGH = 0x4000, DEFAULT = 0x8000. If the node is an MRA, assign one of these: MRAHIGHEST = 0x9000, MRADEFAULT = 0xA000, MRALOWEST = 0xFFFF. MRAs determine the acting manager based on priority and MAC address. |
mrp.nonblockingMrcSupported |
bool |
true |
In MRM role: Specifies whether non-blocking MRCs are supported by the MRM, i.e. those that are not capable of setting a ring port to BLOCKED state. |
mrp.reactOnLinkChange |
bool |
true |
In MRM role: Determines if the manager reacts to link change frames sent by clients or if it solely relies on ring tests for status updates. |
stp.helloTime |
double |
||
stp.forwardDelay |
double |
||
stp.maxAge |
double |
||
stp.bridgePriority |
int |
||
stp.visualize |
bool |
||
sc.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
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 |
llc.displayStringTextFormat |
string |
“” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
llc.registerProtocol |
bool |
false |
FIXME //KLUDGE should redesign the placement of EthernetEncapsulation and LLC modules |
cb.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
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 |
bridging.directionReverser.fork.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
bridging.directionReverser.fork.interfaceTableModule |
string |
Module path to the InterfaceTable module |
|
bridging.directionReverser.fork.forwardProtocolRegistration |
bool |
true |
|
bridging.directionReverser.fork.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 |
bridging.directionReverser.fork.serviceMapping |
object |
{} |
Maps protocols to connected submodule names (e.g. {“ethernetmac”: “bridging”}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default |
bridging.directionReverser.fork.protocolMapping |
object |
{} |
Maps protocols to connected submodule names (e.g. {“ipv4”: “bridging”}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default |
bridging.directionReverser.reverser.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
bridging.directionReverser.reverser.forwardVlan |
bool |
true |
|
bridging.directionReverser.reverser.forwardPcp |
bool |
true |
|
bridging.directionReverser.reverser.excludeEncapsulationProtocols |
object |
[] |
|
bridging.directionReverser.join.displayStringTextFormat |
string |
“passed %p pk (%l)” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
bridging.directionReverser.join.forwardServiceRegistration |
bool |
true |
|
bridging.interfaceRelay.learner.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
bridging.interfaceRelay.learner.macTableModule |
string |
Relative module path of MAC table |
|
bridging.interfaceRelay.learner.interfaceTableModule |
string |
Relative module path of the interface table |
|
bridging.interfaceRelay.selector.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
bridging.interfaceRelay.selector.macTableModule |
string |
Relative module path of MAC table |
|
bridging.interfaceRelay.selector.interfaceTableModule |
string |
Relative module path of interface table |
|
bl.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
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 |
ethernet.socketTable.displayStringTextFormat |
string |
“” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ethernet.socketCommandProcessor.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ethernet.socketCommandProcessor.socketTableModule |
string |
||
ethernet.macHeaderInserter.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ethernet.macHeaderInserter.interfaceTableModule |
string |
||
ethernet.paddingInserter.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ethernet.paddingInserter.minLength |
int |
||
ethernet.paddingInserter.roundingLength |
int |
1B |
|
ethernet.paddingInserter.insertionPosition |
string |
“back” |
|
ethernet.fcsInserter.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ethernet.fcsInserter.fcsMode |
string |
“declared” |
|
ethernet.socketPacketProcessor.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ethernet.socketPacketProcessor.socketTableModule |
string |
||
ethernet.macHeaderChecker.displayStringTextFormat |
string |
“dropped {numDroppedPackets}/{numProcessedPackets} pk ({droppedTotalLength}/{processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ethernet.macHeaderChecker.backpressure |
bool |
false |
|
ethernet.macHeaderChecker.interfaceTableModule |
string |
||
ethernet.macHeaderChecker.promiscuous |
bool |
false |
|
ethernet.fcsChecker.displayStringTextFormat |
string |
“dropped {numDroppedPackets}/{numProcessedPackets} pk ({droppedTotalLength}/{processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ethernet.fcsChecker.backpressure |
bool |
false |
|
ethernet.fcsChecker.popFcs |
bool |
true |
|
ieee8021q.socketTable.displayStringTextFormat |
string |
“” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ieee8021q.socketCommandProcessor.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ieee8021q.socketCommandProcessor.socketTableModule |
string |
||
ieee8021q.qTagHeaderInserter.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ieee8021q.qTagHeaderInserter.vlanTagType |
string |
“c” |
|
ieee8021q.qTagHeaderInserter.nextProtocol |
string |
“ethernetmac” |
|
ieee8021q.qTagHeaderInserter.defaultVlanId |
int |
-1 |
|
ieee8021q.qTagHeaderInserter.defaultPcp |
int |
-1 |
|
ieee8021q.qTagHeaderInserter.defaultUserPriority |
int |
-1 |
|
ieee8021q.qTagHeaderInserter.defaultDropEligible |
int |
-1 |
<0: unspecified, 0: false, >0: true |
ieee8021q.socketPacketProcessor.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ieee8021q.socketPacketProcessor.socketTableModule |
string |
||
ieee8021q.qTagHeaderChecker.displayStringTextFormat |
string |
“dropped {numDroppedPackets}/{numProcessedPackets} pk ({droppedTotalLength}/{processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ieee8021q.qTagHeaderChecker.backpressure |
bool |
false |
|
ieee8021q.qTagHeaderChecker.vlanTagType |
string |
“c” |
|
ieee8021q.qTagHeaderChecker.vlanIdFilter |
object |
[] |
|
ieee8021r.rTagHeaderInserter.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ieee8021r.rTagHeaderInserter.nextProtocol |
string |
“ieee8021qctag” |
|
ieee8021r.rTagHeaderChecker.displayStringTextFormat |
string |
“dropped {numDroppedPackets}/{numProcessedPackets} pk ({droppedTotalLength}/{processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
ieee8021r.rTagHeaderChecker.backpressure |
bool |
false |
|
li.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
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.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 |
eth.pcapRecorder.verbose |
bool |
true |
Whether to log packets on the module output |
eth.pcapRecorder.recordEmptyPackets |
bool |
true |
Specifies if zero length packets are recorded or not |
eth.pcapRecorder.enableConvertingPackets |
bool |
true |
Specifies if converting packets to link type is allowed or not |
eth.pcapRecorder.pcapFile |
string |
“” |
The PCAP file to be written, suggested value: pcapFile = “${resultdir}/${configname}-#${runnumber}” + fullpath() + “.pcap” |
eth.pcapRecorder.fileFormat |
string |
“pcapng” |
|
eth.pcapRecorder.snaplen |
int |
65535 |
Maximum number of bytes to record per packet |
eth.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). |
eth.pcapRecorder.dumpBadFrames |
bool |
true |
Enable dump of frames with hasBitError |
eth.pcapRecorder.sendingSignalNames |
string |
“transmissionEnded” |
Space-separated list of outbound packet signals to subscribe to |
eth.pcapRecorder.receivingSignalNames |
string |
“receptionEnded” |
Space-separated list of inbound packet signals to subscribe to |
eth.pcapRecorder.dumpProtocols |
string |
“ethernetmac ppp ieee80211mac” |
Space-separated list of protocol names as defined in the Protocol class |
eth.pcapRecorder.packetFilter |
object |
“*” |
Which packets are considered, matches all packets by default |
eth.pcapRecorder.helpers |
string |
“” |
Usable PcapRecorder::IHelper helpers for accept packettype and store/convert packet as specified linktype |
eth.pcapRecorder.alwaysFlush |
bool |
false |
Flush the pcapFile after each write to ensure that all packets are captured in case of a crash |
string |
“contains %p pk (%l) pushed %u\npulled %o removed %r dropped %d” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
|
int |
-1 |
Maximum number of packets in the queue, no limit by default |
|
int |
-1b |
Maximum total length of packets in the queue, no limit by default |
|
string |
“” |
Determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class |
|
string |
“” |
Determines the order of packets in the queue, insertion order by default; the parameter must be the name of a C++ class which implements the IPacketComparatorFunction C++ interface and is registered via Register_Class |
|
string |
“” |
Relative module path to the IPacketBuffer module used by this queue, implicit buffer by default |
|
string |
“served %p pk (%l)” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
|
int |
0 |
Specifies the FES scheduling priority for the extra event that is pulling the packet, -1 means no extra event |
|
eth.macLayer.outboundEmitter.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
eth.macLayer.outboundEmitter.packetFilter |
object |
“*” |
Which packets are considered, matches all packets by default |
eth.macLayer.outboundEmitter.direction |
string |
“undefined” |
|
eth.macLayer.outboundEmitter.signalName |
string |
||
eth.macLayer.fcsChecker.displayStringTextFormat |
string |
“dropped {numDroppedPackets}/{numProcessedPackets} pk ({droppedTotalLength}/{processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
eth.macLayer.fcsChecker.backpressure |
bool |
false |
|
eth.macLayer.fcsChecker.popFcs |
bool |
false |
|
eth.macLayer.inboundEmitter.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
eth.macLayer.inboundEmitter.packetFilter |
object |
“*” |
Which packets are considered, matches all packets by default |
eth.macLayer.inboundEmitter.direction |
string |
“undefined” |
|
eth.macLayer.inboundEmitter.signalName |
string |
||
eth.phyLayer.phyHeaderInserter.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
eth.phyLayer.interFrameGapInserter.displayStringTextFormat |
string |
“delayed %p pk (%l)\nifg: %g” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
eth.phyLayer.interFrameGapInserter.clockModule |
string |
“” |
Relative path of a module that implements IClock(1,:ref:2 <neddoc-msg-inet-iclock>); optional |
eth.phyLayer.interFrameGapInserter.initialChannelBusy |
bool |
false |
Assume that the channel was busy before the simulation started |
eth.phyLayer.interFrameGapInserter.duration |
double |
96s / dropUnit(parent.bitrate) |
|
eth.phyLayer.outboundEmitter.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
eth.phyLayer.outboundEmitter.packetFilter |
object |
“*” |
Which packets are considered, matches all packets by default |
eth.phyLayer.outboundEmitter.direction |
string |
“undefined” |
|
eth.phyLayer.outboundEmitter.signalName |
string |
||
eth.phyLayer.transmitter.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
eth.phyLayer.transmitter.clockModule |
string |
“” |
Relative path of a module that implements IClock(1,:ref:2 <neddoc-msg-inet-iclock>); optional |
eth.phyLayer.transmitter.datarate |
double |
parent.bitrate |
|
eth.phyLayer.phyHeaderChecker.displayStringTextFormat |
string |
“dropped {numDroppedPackets}/{numProcessedPackets} pk ({droppedTotalLength}/{processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
eth.phyLayer.phyHeaderChecker.backpressure |
bool |
false |
|
eth.phyLayer.inboundEmitter.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
eth.phyLayer.inboundEmitter.packetFilter |
object |
“*” |
Which packets are considered, matches all packets by default |
eth.phyLayer.inboundEmitter.direction |
string |
“undefined” |
|
eth.phyLayer.inboundEmitter.signalName |
string |
||
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
|
double |
parent.bitrate |
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");
}