TsnSwitch

Package: inet.node.tsn

TsnSwitch

compound module

This module represents a Time-Sensitive Networking (TSN) switch that supports time synchronization, per-stream filtering and policing, scheduling and traffic shaping, frame replication and elimination, frame preemption and cut-through switching for Ethernet networks. All TSN features are optional and they can be combined with other Ethernet features.

TODO move cut-through switching from EthernetSwitch to TsnSwitch?

macTable : like IMacForwardingTable

MacForwardingTable: This module handles the mapping between ports and MAC addresses.

IMacForwardingTable: Interface for MAC address tables

Source:
macTable: <default("MacForwardingTable")> like IMacForwardingTable {
    @display("p=100,100;is=s");
} interfaceTable : InterfaceTable

Keeps the table of network interfaces.

Source:
interfaceTable: InterfaceTable {
    @display("p=100,200;is=s");
} l2NodeConfigurator : L2NodeConfigurator

This module has one instance per network node, and it acts like a bridge between the node and the...

Source:
l2NodeConfigurator: L2NodeConfigurator if hasStp {
    @display("p=100,300;is=s");
} status : NodeStatus

Keeps track of the status of network node (up, down, etc.) for other modules, and also displays it...

Source:
status: NodeStatus if hasStatus {
    @display("p=100,400;is=s");
} clock : like IClock

IClock: This module interface is implemented by clock models.

Source:
clock: <default(hasGptp ? "SettableClock" : "")> like IClock if typename != "" {
    @display("p=100,500;is=s");
} pcapRecorder[numPcapRecorders] : PcapRecorder

Records PCAP traces of frames sent/received by other modules within the same host.

Source:
pcapRecorder[numPcapRecorders]: PcapRecorder {
    @display("p=100,600;is=s");
} measurer : like IMeasurer

IMeasurer: This module interface is implemented by all standalone measurement modules.

Source:
measurer: <default("")> like IMeasurer if typename != "" {
    @display("p=125,700;is=s");
} stp : like ISpanningTree

ISpanningTree: Module interface for Spanning Tree protocols

Source:
stp: <spanningTreeProtocol> like ISpanningTree if hasStp {
    @display("p=500,75");
} gptp : like IApp

Gptp: This module implements the IEEE 802.1as protocol also known as gPTP.

IApp: Generic application interface.

Source:
gptp: <default("Gptp")> like IApp if hasGptp {
    @display("p=700,75");
    gptpNodeType = default("BRIDGE_NODE"); // @enum("gptpNodeType"): MASTER_NODE, BRIDGE_NODE, SLAVE_NODE
} app[numApps] : like IApp

IApp: Generic application interface.

Source:
app[numApps]: <> like IApp {
    parameters:
        @display("p=900,75,row,150");
} sc : MessageDispatcher

This module connects multiple applications, protocols and interfaces with each other and...

Source:
sc: MessageDispatcher {
    @display("p=800,150;b=1200,5");
} llc : like IIeee8022Llc

Source:
llc: <default("Ieee8022Llc")> like IIeee8022Llc if typename != "" {
    @display("p=700,225");
} cb : MessageDispatcher

This module connects multiple applications, protocols and interfaces with each other and...

Source:
cb: MessageDispatcher {
    @display("p=800,300;b=1200,5");
} bridging : like IProtocolLayer

IProtocolLayer: This module interface is implemented by all protocol layer modules that connect to a higher and to...

Source:
bridging: <default(firstAvailable("Ieee8021dRelay","MacRelayUnit"))> like IProtocolLayer {
    @display("p=800,375;is=m");
} bl : MessageDispatcher

This module connects multiple applications, protocols and interfaces with each other and...

Source:
bl: MessageDispatcher {
    @display("p=800,450;b=1200,5");
} ethernet : like IEthernetLayer

EthernetEncapsulation: Performs Ethernet II or Ethernet with LLC/SNAP encapsulation/decapsulation.

Source:
ethernet: <default("EthernetEncapsulation")> like IEthernetLayer if typename != "" {
    @display("p=500,525");
} ieee8021q : like IIeee8021qLayer

Ieee8021qProtocol: This module implements the IEEE 802.1Q protocol encapsulation/decapsulation.

Source:
ieee8021q: <default("Ieee8021qProtocol")> like IIeee8021qLayer if typename != "" {
    @display("p=700,525");
} ieee8021r : like IIeee8021rLayer

Ieee8021rProtocol: This module implements the IEEE 802.1r protocol encapsulation/decapsulation.

Source:
ieee8021r: <default("Ieee8021rProtocol")> like IIeee8021rLayer if typename != "" {
    @display("p=900,525");
} li : MessageDispatcher

This module connects multiple applications, protocols and interfaces with each other and...

Source:
li: MessageDispatcher {
    @display("p=800,600;b=1200,5");
} eth[sizeof(ethg)] : like IEthernetInterface

IEthernetInterface: This module interface is implemented by Ethernet network interfaces.

Source:
eth[sizeof(ethg)]: <default(hasCutthroughSwitching ? "EthernetCutthroughInterface" : "EthernetInterface")> like IEthernetInterface {
    @display("p=250,750,row,150;q=txQueue");
}

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Extends

Name Type Description
EthernetSwitch compound module

Model of an Ethernet switch.

Parameters

Name Type Default value Description
recordPcap bool false
numPcapRecorders int recordPcap ? 1 : 0
numApps int 0
hasStatus bool false
hasStp 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.displayAddresses bool false

whether to display IP addresses on links

l2NodeConfigurator.interfaceTableModule string
l2NodeConfigurator.l2ConfiguratorModule string "l2NetworkConfigurator"

the absolute path to the L2NetworkConfigurator; use "" if there is no configurator

status.initialStatus string "UP"

TODO @signal, @statistic

pcapRecorder.verbose bool true

whether to log packets on the module output

pcapRecorder.pcapFile string ""

the PCAP file to be written

pcapRecorder.fileFormat string "pcapng"
pcapRecorder.snaplen int 65535

maximum number of bytes to record per packet

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 "packetSentToLower"

space-separated list of outbound packet signals to subscribe to

pcapRecorder.receivingSignalNames string "packetReceivedFromLower"

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

pcapRecorder.displayStringTextFormat string "rec: %n pks"
stp.helloTime double
stp.forwardDelay double
stp.maxAge double
stp.bridgePriority int
stp.visualize bool
sc.displayStringTextFormat string "processed %p pk (%l)"

determines the text that is written on top of the submodule

sc.forwardServiceRegistration bool true
sc.forwardProtocolRegistration bool true
cb.displayStringTextFormat string "processed %p pk (%l)"

determines the text that is written on top of the submodule

cb.forwardServiceRegistration bool true
cb.forwardProtocolRegistration bool true
bl.displayStringTextFormat string "processed %p pk (%l)"

determines the text that is written on top of the submodule

bl.forwardServiceRegistration bool true
bl.forwardProtocolRegistration bool true
li.displayStringTextFormat string "processed %p pk (%l)"

determines the text that is written on top of the submodule

li.forwardServiceRegistration bool true
li.forwardProtocolRegistration bool true
eth.bitrate double

Source code

//
// This module represents a Time-Sensitive Networking (TSN) switch that supports
// time synchronization, per-stream filtering and policing, scheduling and traffic
// shaping, frame replication and elimination, frame preemption and cut-through
// switching for Ethernet networks. All TSN features are optional and they can
// be combined with other Ethernet features.
//
// TODO move cut-through switching from EthernetSwitch to TsnSwitch?
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(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 endocing/decoding when stream redundancy is enabled
        llc.typename = default("");
}
File: src/inet/node/tsn/TsnSwitch.ned