Router

Package: inet.node.inet

Router

compound module

IPv4 router that supports wireless, Ethernet, PPP and external interfaces. By default, no wireless and external interfaces are added; the number of Ethernet and PPP ports depends on the external connections.

  • Can be connected via ethernet interface to other nodes using the ethg gate. By default full-duplex connections are supported only (twisted pair). Set **.eth.typename="EthernetInterface" for a full/half-duplex CSMA/CD implementation (coaxial cable)
  • By default contains no wireless cards, however it can be configured by the numWlanInterfaces parameter. Wirless card type is configured by the **.wlan.typename parameter. see: inet.linklayer.ieee80211 or other modules implementing IWirelessInterface
  • Also external interfaces can be configured for HW in the loop simulation using the numEthInterfaces parameter and setting the type using **.ext.typename in the INI file. see: ExtInterface derived modules and IExternalInterface
  • PPP queueing type can be set using **.ppp.queue.typename see: PppInterface
  • If wireless card is present, node mobility can be set using **.mobility.typename see: inet.mobility and IMobility

By default, dynamic routing is not supported. Specific routing protocols can be added by setting the hasOspf/hasRip/hasBgp parameters.

NodeStatus IClock IEnergyStorage IEnergyManagement IEnergyGenerator IMobility IMeasurer PcapRecorder InterfaceTable IIeee8022Llc MessageDispatcher IProtocolLayer MessageDispatcher IEthernetLayer IIeee8021qLayer IIeee8021rLayer MessageDispatcher ILoopbackInterface IWirelessInterface IPppInterface IEthernetInterface ITunnelInterface IVirtualInterface INetworkLayer INetworkLayer INetworkLayer MessageDispatcher IUdp ITcp ISctp MessageDispatcher IApp MessageDispatcher IOspf IBgp IApp IPim IApp IEigrp

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.

Known subclasses

Name Type Description
BgpRouter compound module

IP router with BGPv4 and OSPFv4 support.

EigrpRouter compound module (no description)
MulticastRouter compound module (no description)
OspfRouter compound module

An OSPFv2 router.

Ospfv3Router compound module

An OSPFv3 router.

RipRouter compound module

An RIPv2 router.

Router6 compound module

IPv6 router.

Extends

Name Type Description
ApplicationLayerNodeBase compound module (no description)

Parameters

Name Type Default value Description
hasStatus bool false
osgModel string ""

3D model for OSG visualization, no 3D model by default

osgModelColor string ""

tint color, no colorization by default

canvasImage string ""

image for canvas visualization, no image by default

canvasImageColor string ""

tint color, no colorization by default

recordPcap bool false
numPcapRecorders int recordPcap ? 1 : 0
numLoInterfaces int 1
numWlanInterfaces int 0
numEthInterfaces int 0

minimum number of ethernet interfaces

numPppInterfaces int 0

minimum number of PPP interfaces

numTunInterfaces int 0
numVirtInterfaces int 0
fcsMode string "declared"
hasIpv4 bool true
hasIpv6 bool false
hasGn bool false
forwarding bool true
multicastForwarding bool false
hasUdp bool hasRip || hasDhcp
hasTcp bool hasBgp
hasSctp bool false
numApps int 0
hasEigrp bool false
hasOspf bool false
hasRip bool false
hasBgp bool false
hasPim bool false
hasDhcp bool false

Properties

Name Value Description
networkNode
labels node
class NodeBase
display i=abstract/router

Gates

Name Direction Size Description
radioIn [ ] input numWlanInterfaces
pppg [ ] inout numPppInterfaces
ethg [ ] inout numEthInterfaces

Unassigned submodule parameters

Name Type Default value Description
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"
interfaceTable.displayAddresses bool false

whether to display IP addresses on links

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

determines the text that is written on top of the submodule

nl.forwardServiceRegistration bool true
nl.forwardProtocolRegistration bool true
tn.displayStringTextFormat string "processed %p pk (%l)"

determines the text that is written on top of the submodule

tn.forwardServiceRegistration bool true
tn.forwardProtocolRegistration bool true
at.displayStringTextFormat string "processed %p pk (%l)"

determines the text that is written on top of the submodule

at.forwardServiceRegistration bool true
at.forwardProtocolRegistration bool true
bgp.interfaceTableModule string

The path to the InterfaceTable module

bgp.routingTableModule string
bgp.ospfRoutingModule string parent.hasOspf ? "^.ospf" : ""

Source code

//
// IPv4 router that supports wireless, Ethernet, PPP and external interfaces.
// By default, no wireless and external interfaces are added; the number of
// Ethernet and PPP ports depends on the external connections.
//
// - Can be connected via ethernet interface to other nodes using
//   the ethg gate. By default full-duplex connections are supported
//   only (twisted pair). Set **.eth.typename="EthernetInterface" for
//   a full/half-duplex CSMA/CD implementation (coaxial cable)
// - By default contains no wireless cards, however it can be configured
//   by the numWlanInterfaces parameter. Wirless card type is configured by the
//   **.wlan.typename parameter. see:  inet.linklayer.ieee80211 or other
//   modules implementing ~IWirelessInterface
// - Also external interfaces can be configured for HW in the loop simulation
//   using the numEthInterfaces parameter and setting the type using
//   **.ext.typename in the INI file. see: ~ExtInterface derived modules and ~IExternalInterface
// - PPP queueing type can be set using **.ppp.queue.typename see: ~PppInterface
// - If wireless card is present, node mobility can be set using **.mobility.typename
//   see: inet.mobility and ~IMobility
//
// By default, dynamic routing is not supported. Specific routing protocols can
// be added by setting the hasOspf/hasRip/hasBgp parameters.
//
module Router extends ApplicationLayerNodeBase
{
    parameters:
        @display("i=abstract/router");
        @figure[submodules];
        forwarding = true;
        bool hasEigrp = default(false);
        bool hasOspf = default(false);
        bool hasRip = default(false);
        bool hasBgp = default(false);
        bool hasPim = default(false);
        bool hasDhcp = default(false);
        hasUdp = default(hasRip || hasDhcp);
        hasTcp = default(hasBgp);
        *.routingTableModule = default("^.ipv4.routingTable");

    submodules:
        ospf: <default("Ospfv2")> like IOspf if hasOspf {
            parameters:
                @display("p=975,226");
        }
        bgp: <"Bgp"> like IBgp if hasBgp {
            parameters:
                ospfRoutingModule = default(parent.hasOspf ? "^.ospf" : "");
                @display("p=825,76");
        }
        rip: <"Rip"> like IApp if hasRip {
            parameters:
                @display("p=975,76");
        }
        pim: <"Pim"> like IPim if hasPim {
            parameters:
                @display("p=825,226");
        }
        dhcp: <"DhcpServer"> like IApp if hasDhcp {
            parameters:
                @display("p=1125,76");
        }
        eigrp: <"EigrpProcessDS"> like IEigrp if hasEigrp {
            parameters:
                enableIPv6 = parent.hasIpv6;
                enableIPv4 = parent.hasIpv4;
                @display("p=1113,225");
        }

    connections allowunconnected:
        ospf.ipOut --> tn.in++ if hasOspf;
        ospf.ipIn <-- tn.out++ if hasOspf;

        eigrp.ipOut --> tn.in++ if hasEigrp;
        eigrp.ipIn <-- tn.out++ if hasEigrp;

        bgp.socketOut --> at.in++ if hasBgp;
        bgp.socketIn <-- at.out++ if hasBgp;

        rip.socketOut --> at.in++ if hasRip;
        rip.socketIn <-- at.out++ if hasRip;

        pim.networkLayerOut --> tn.in++ if hasPim;
        pim.networkLayerIn <-- tn.out++ if hasPim;

        dhcp.socketOut --> at.in++ if hasDhcp;
        dhcp.socketIn <-- at.out++ if hasDhcp;
}

File: src/inet/node/inet/Router.ned