Compound Module Router

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

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.

By default, dynamic routing is not supported. Specific routing protocols can be added by setting the hasOSPF/hasRIP/hasBGP parameters.

NodeStatus IEnergyStorage IEnergyManagement IEnergyGenerator IMobility INetworkLayer IRoutingTable InterfaceTable PcapRecorder LoopbackInterface IWirelessNic IWiredNic IWiredNic IExternalNic ITunNic IIPRouting IBGPRouting ITCP IUDPApp IUDPApp IUDP IPIMRouting

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.

Extends:

Name Type Description
NodeBase compound module

Contains the common lower layers (linklayer and networklayer) of Router, StandardHost, WirelessHost etc.

Known subclasses:

Name Type Description
BGPRouter compound module

IP router with BGPv4 and OSPFv4 support.

MulticastRouter compound module (no description)
MyRouter compound module (no description)
OSPFRouter compound module

An OSPFv2 router.

RIPRouter compound module

An RIPv2 router.

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

IPv4SmallLAN compound module

Several hosts on a router; part of IPv4LargeNet.

Networks:

Name Type Description
advanced network (no description)
ARPTest network (no description)
ARPTest network (no description)
BulkTransfer network (no description)
CloudAndRouters network (no description)
ComplexConfiguratorNetwork network (no description)
Complexer network (no description)
ConfiguratorA network (no description)
ConfiguratorC network (no description)
ConfiguratorF network (no description)
DiffservNetwork network (no description)
DiffservNetwork network

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

FilteringShowcase network (no description)
FlatNet network (no description)
Hierarchical network (no description)
Hierarchical99 network

This hierarchical network topology contains 3 levels, 72 hosts and 27 routers.

Http10Servers network

10-nodes test scenario for sockets.

HttpNnodes network

n-nodes test scenario for sockets.

InterfaceTableVisualizationAdvancedFeaturesShowcase network (no description)
IPv4LargeNet network

A large Ethernet LAN -- see model description

KIDSNw1 network (no description)
MixedNetwork network

TODO Auto-generated network

multi network (no description)
MulticastNetwork network (no description)
multihomed network (no description)
MultiRadio network (no description)
NClients network (no description)
NClients network (no description)
NClients network (no description)
NClients2 network (no description)
Network network

TODO documentation

NetworkPathComplexShowcase network

TODO documentation

NetworkPathRIPShowcase network

TODO documentation

PacketDropQueueOverflowShowcase network (no description)
RIPInfinityCountTest network (no description)
RouterPerfNetwork network (no description)
RoutingTableVisualizationDisplayingAllShowcase network (no description)
RoutingTableVisualizationFilteringShowcase network (no description)
RTPMulticast1 network (no description)
RTPUnicast1 network (no description)
SimpleContinentCloud network (no description)
StaticNetworkRouteVisualizationExample network (no description)
tcpsack network (no description)
testNetwork network (no description)
TransportConnectionVisualizationMultipleConnectionsShowcase network (no description)
TransportPathVisualizerExtendedShowcase network

TODO documentation

TransportPathVisualizerServerClientsShowcase network

TODO documentation

UDPBroadcastNetwork network (no description)
UDPBurst network (no description)
VisualizationE network (no description)
VisualizationF network (no description)
VisualizationH network (no description)
VisualizationTutorialA network (no description)
WiredAndWirelessHostsWithAP network (no description)
WirelessNetWithDHCP network (no description)

Parameters:

Name Type Default value Description
hasStatus bool false
numExtInterfaces int 0
numRadios int 0

the number of radios in the router. by default no wireless

numPcapRecorders int 0

no of PcapRecorders.

numTunInterfaces int 0
osgModel string ""

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

osgModelColor string ""

tint color, no colorization by default

mobilityType string numRadios > 0 ? "StationaryMobility" : ""
networkLayerType string "IPv4NetworkLayer"
routingTableType string "IPv4RoutingTable"
forwarding bool true
multicastForwarding bool false
energyStorageType string ""
energyManagementType string ""
energyGeneratorType string ""
hasOSPF bool false
hasRIP bool false
hasBGP bool false
hasPIM bool false
hasDHCP bool false
tcpType string firstAvailableOrEmpty("TCP", "TCP_lwIP", "TCP_NSC")

tcp implementation (e.g. TCP, TCP_lwIP, TCP_NSC) or TCPSpoof

udpType string "UDP"

Properties:

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

Gates:

Name Direction Size Description
radioIn [ ] input numRadios
pppg [ ] inout
ethg [ ] inout

Unassigned submodule parameters:

Name Type Default value Description
status.initialStatus string "UP"

TODO @signal, @statistic

routingTable.forwarding bool
routingTable.multicastForwarding bool
interfaceTable.displayAddresses bool false

whether to display IP addresses on links

pcapRecorder.verbose bool false

whether to log packets on the module output

pcapRecorder.pcapFile string ""

the PCAP file to be written

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[*] ext[*]"

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.alwaysFlush bool false

flush the pcapFile after each write to ensure that all packets are captured in case of a crash

lo0.lo.interfaceTableModule string

The path to the InterfaceTable module

lo0.lo.mtu int 4470B
bgp.interfaceTableModule string

The path to the InterfaceTable module

bgp.routingTableModule string
bgp.ospfRoutingModule string hasOSPF ? "^.ospf" : ""
bgp.dataTransferMode string

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 numRadios parameter. Wirless card type is configured by the
//   **.wlan.typename parameter. see:  inet.linklayer.ieee80211 or other
//   modules implementing ~IWirelessNic
// - Also external interfaces can be configured for HW in the loop simulation
//   using the numExtInterfaces parameter and setting the type using
//   **.ext.typename in the INI file. see: ~ExtInterface and ~IExternalNic
// - PPP queueing type can be set using **.ppp.queueType 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 NodeBase
{
    parameters:
        @display("i=abstract/router");
        forwarding = true;
        bool hasOSPF = default(false);
        bool hasRIP = default(false);
        bool hasBGP = default(false);
        bool hasPIM = default(false);
        bool hasDHCP = default(false);
        string tcpType = default(firstAvailableOrEmpty("TCP", "TCP_lwIP", "TCP_NSC"));  // tcp implementation (e.g. ~TCP, ~TCP_lwIP, ~TCP_NSC) or ~TCPSpoof
        string udpType = default("UDP");

    submodules:
        ospf: <"OSPFRouting"> like IIPRouting if hasOSPF {
            parameters:
                @display("p=465,287,row");
        }
        bgp: <"BGPRouting"> like IBGPRouting if hasBGP {
            parameters:
                ospfRoutingModule = default(hasOSPF ? "^.ospf" : "");
                @display("p=214,80;i=block/network");
        }
        tcp: <tcpType> like ITCP if hasBGP && tcpType != "" {
            parameters:
                @display("p=214,180;i=block/transport");
        }
        rip: <"RIPRouting"> like IUDPApp if hasRIP {
            parameters:
                @display("p=404,80");
        }
        dhcp: <"DHCPServer"> like IUDPApp if hasDHCP {
            parameters:
                @display("p=566,80");
        }
        udp: <udpType> like IUDP if hasRIP || hasDHCP {
            @display("p=404,180");
        }
        pim: <"PIMRouting"> like IPIMRouting if hasPIM {
            @display("p=175,287");
        }

    connections allowunconnected:
        if hasOSPF {
            ospf.ipOut --> networkLayer.transportIn++;
            ospf.ipIn <-- networkLayer.transportOut++;
        }

        if hasBGP {
            bgp.tcpOut --> tcp.appIn++;
            bgp.tcpIn <-- tcp.appOut++;

            tcp.ipOut --> networkLayer.transportIn++;
            tcp.ipIn <-- networkLayer.transportOut++;
        }

        if hasRIP {
            rip.udpOut --> udp.appIn++;
            rip.udpIn <-- udp.appOut++;
        }

        if hasDHCP {
            dhcp.udpOut --> udp.appIn++;
            dhcp.udpIn <-- udp.appOut++;
        }

        if hasRIP || hasDHCP {
            udp.ipOut --> networkLayer.transportIn++;
            udp.ipIn <-- networkLayer.transportOut++;
        }

        if hasPIM {
            pim.networkLayerOut --> networkLayer.transportIn++;
            pim.networkLayerIn <-- networkLayer.transportOut++;
        }
}