EthernetSwitch

Package: inet.node.ethernet

EthernetSwitch

compound module

Model of an Ethernet switch.

The duplexChannel attributes of the MACs must be set according to the medium connected to the port; if collisions are possible (it's a bus or hub) it must be set to false, otherwise it can be set to true. By default used half duples CSMA/CD mac

IMacForwardingTable InterfaceTable L2NodeConfigurator NodeStatus IClock PcapRecorder IMeasurer ISpanningTree IApp IApp MessageDispatcher IIeee8022Llc MessageDispatcher IProtocolLayer MessageDispatcher IEthernetLayer IIeee8021qLayer IIeee8021rLayer MessageDispatcher MessageDispatcher IEthernetInterface

Usage diagram

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Inheritance diagram

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

Used in compound modules

Name Type Description
IPv4LargeLAN compound module

Several hosts and an Ethernet hub on a switch. One port of the hub connect to a 10Base2 segment.

IPv4MediumLAN compound module

Several hosts and a router on an Ethernet hub and a switch

LargeLAN compound module

Several hosts and an Ethernet hub on a switch. One port of the hub connect to a 10Base2 segment. Part of ~LargeNet(1,2).

MediumLAN compound module

Several hosts and an Ethernet hub on a switch; part of ~LargeNet(1,2).

OneNetArea compound module (no description)
OspfLan compound module (no description)
SmallLAN compound module

Several hosts on an Ethernet hub; part of ~LargeNet(1,2).

TestArea compound module (no description)
TwoNetsArea compound module (no description)

Used in

Name Type Description
ARPTest network (no description)
Backbone network (no description)
BgpNetwork network (no description)
BgpNetwork network (no description)
BgpNetwork network (no description)
BgpNetwork network (no description)
ClockDriftShowcase network (no description)
Complexer network (no description)
ConfiguratorA network (no description)
ConfiguratorB network (no description)
ConfiguratorE network (no description)
DataLinkVisualizerFilteringShowcase network (no description)
DataRateMeasurementShowcase network (no description)
DiffservNetwork network

This network contains a router with an 10Mbps Ethernet interface, and with a 128kbps dialup connection to a server.

DiffservNetwork network (no description)
FlowMeasurementShowcase network (no description)
InterfaceTableVisualizationAdvancedFeaturesShowcase network (no description)
LargeNet network

A large Ethernet LAN -- see model description here.

LargeNet network (no description)
MeasurementRelationshipsShowcase network (no description)
mIPv6Network network (no description)
MixedLAN network

Sample Ethernet LAN containing eight hosts, a switch and a bus.

multiple_areas2 network (no description)
NClients network (no description)
Network network

TODO documentation

Network network (no description)
NetworkPathComplexShowcase network (no description)
NetworkPathRIPShowcase network (no description)
PacketDropQueueOverflowShowcase network (no description)
RegressionTestingTutorialWired network (no description)
ResidenceTimeMeasurementShowcase network (no description)
RoutingTableVisualizationFilteringShowcase network (no description)
SimpleTest network (no description)
SimpleTest network (no description)
small network (no description)
SwitchedDuplexLAN network (no description)
SwitchedLAN network

Sample Ethernet LAN: four hosts connected to a switch.

SwitchNetwork network (no description)
TimingExample network (no description)
TransportConnectionVisualizationMultipleConnectionsShowcase network (no description)
TransportPathVisualizerFilteringShowcase network (no description)
UDPBroadcastNetwork network (no description)
v3_mesh network (no description)
VlanExample network (no description)
WiredNetWithDHCP network (no description)

Known subclasses

Name Type Description
GptpBridge compound module

This module implements a gPTP bridge network node.

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.

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 false
hasCutthroughSwitching bool false
fcsMode string "declared"
spanningTreeProtocol string "Stp"
numEthInterfaces int 0

minimum number of ethernet interfaces

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
cutthrough.displayStringTextFormat string "processed %p pk (%l)"

determines the text that is written on top of the submodule

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

Source code

//
// Model of an Ethernet switch.
//
// The duplexChannel attributes of the MACs must be set according to the
// medium connected to the port; if collisions are possible (it's a bus or hub)
// it must be set to false, otherwise it can be set to true.
// By default used half duples CSMA/CD mac
//
module EthernetSwitch like IEthernetNetworkNode
{
    parameters:
        @networkNode();
        @labels(node,ethernet-node);
        @display("i=device/switch");
        bool recordPcap = default(false);
        int numPcapRecorders = default(recordPcap ? 1 : 0);
        int numApps = default(0);
        bool hasStatus = default(false);
        bool hasStp = default(false);
        bool hasGptp = default(false);
        bool hasCutthroughSwitching = default(false);
        string fcsMode @enum("declared","computed") = default("declared");
        string spanningTreeProtocol = default("Stp");
        int numEthInterfaces = default(0);  // minimum number of ethernet interfaces
        eth[*].encap.typename = default("");
        *.fcsMode = this.fcsMode;
        **.interfaceTableModule = default(absPath(".interfaceTable"));
        **.macTableModule = default(absPath(".macTable"));
        *.clockModule = default(exists(clock) ? absPath(".clock") : "");

        llc.registerProtocol = true;
        eth[*].mac.promiscuous = default(true);
        ethernet.*.promiscuous = default(true);
        ethernet.registerProtocol = default(true);

    gates:
        inout ethg[numEthInterfaces] @labels(EtherFrame-conn);
    submodules:
        macTable: <default("MacForwardingTable")> like IMacForwardingTable {
            @display("p=100,100;is=s");
        }
        interfaceTable: InterfaceTable {
            @display("p=100,200;is=s");
        }
        l2NodeConfigurator: L2NodeConfigurator if hasStp {
            @display("p=100,300;is=s");
        }
        status: NodeStatus if hasStatus {
            @display("p=100,400;is=s");
        }
        clock: <default(hasGptp ? "SettableClock" : "")> like IClock if typename != "" {
            @display("p=100,500;is=s");
        }
        pcapRecorder[numPcapRecorders]: PcapRecorder {
            @display("p=100,600;is=s");
        }
        measurer: <default("")> like IMeasurer if typename != "" {
            @display("p=125,700;is=s");
        }
        stp: <spanningTreeProtocol> like ISpanningTree if hasStp {
            @display("p=500,75");
        }
        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 {
            parameters:
                @display("p=900,75,row,150");
        }
        sc: MessageDispatcher {
            @display("p=800,150;b=1200,5");
        }
        llc: <default("Ieee8022Llc")> like IIeee8022Llc if typename != "" {
            @display("p=700,225");
        }
        cb: MessageDispatcher {
            @display("p=800,300;b=1200,5");
        }
        bridging: <default(firstAvailable("Ieee8021dRelay","MacRelayUnit"))> like IProtocolLayer {
            @display("p=800,375;is=m");
        }
        bl: MessageDispatcher {
            @display("p=800,450;b=1200,5");
        }
        ethernet: <default("EthernetEncapsulation")> like IEthernetLayer if typename != "" {
            @display("p=500,525");
        }
        ieee8021q: <default("Ieee8021qProtocol")> like IIeee8021qLayer if typename != "" {
            @display("p=700,525");
        }
        ieee8021r: <default("Ieee8021rProtocol")> like IIeee8021rLayer if typename != "" {
            @display("p=900,525");
        }
        li: MessageDispatcher {
            @display("p=800,600;b=1200,5");
        }
        cutthrough: MessageDispatcher if hasCutthroughSwitching {
            @display("p=800,675;b=1200,5");
        }
        eth[sizeof(ethg)]: <default(hasCutthroughSwitching ? "EthernetCutthroughInterface" : "EthernetInterface")> like IEthernetInterface {
            @display("p=250,750,row,150;q=txQueue");
        }
    connections:
        ethernet.lowerLayerOut --> li.in++ if exists(ethernet);
        li.out++ --> ethernet.lowerLayerIn if exists(ethernet);

        ieee8021q.lowerLayerOut --> li.in++ if exists(ieee8021q);
        li.out++ --> ieee8021q.lowerLayerIn if exists(ieee8021q);

        ieee8021r.lowerLayerOut --> li.in++ if exists(ieee8021r);
        li.out++ --> ieee8021r.lowerLayerIn if exists(ieee8021r);

        for i=0..sizeof(ethg)-1 {
            eth[i].cutthroughOut --> cutthrough.in++ if hasCutthroughSwitching;
            eth[i].cutthroughIn <-- cutthrough.out++ if hasCutthroughSwitching;
        }

        bl.out++ --> li.in++;
        li.out++ --> bl.in++;

        llc.upperLayerOut --> sc.in++ if exists(llc);
        sc.out++ --> llc.upperLayerIn if exists(llc);

        sc.out++ --> cb.in++;
        cb.out++ --> sc.in++;

        cb.out++ --> llc.lowerLayerIn if exists(llc);
        llc.lowerLayerOut --> cb.in++ if exists(llc);

        cb.out++ --> bridging.upperLayerIn;
        bridging.upperLayerOut --> cb.in++;

        ieee8021q.upperLayerOut --> bl.in++ if exists(ieee8021q);
        bl.out++ --> ieee8021q.upperLayerIn if exists(ieee8021q);

        ieee8021r.upperLayerOut --> bl.in++ if exists(ieee8021r);
        bl.out++ --> ieee8021r.upperLayerIn if exists(ieee8021r);

        bl.out++ --> ethernet.upperLayerIn if exists(ethernet);
        ethernet.upperLayerOut --> bl.in++ if exists(ethernet);

        bridging.lowerLayerOut --> bl.in++;
        bl.out++ --> bridging.lowerLayerIn;

        for i=0..sizeof(ethg)-1 {
            li.out++ --> eth[i].upperLayerIn;
            li.in++ <-- eth[i].upperLayerOut;
            eth[i].phys <--> { @display("m=s"); } <--> ethg[i];
        }

        if hasStp {
            stp.relayIn <-- sc.out++;
            stp.relayOut --> sc.in++;
        }

        if hasGptp {
            gptp.socketOut --> sc.in++;
            sc.out++ --> gptp.socketIn;
        }

        for i=0..numApps-1 {
            app[i].socketOut --> sc.in++;
            app[i].socketIn <-- sc.out++;
        }
}

File: src/inet/node/ethernet/EthernetSwitch.ned