BGPRouterEx

Package: inet.examples.bgpv4.BgpUpdate

BGPRouterEx

compound module

Example IP router with BGPv4 and OSPFv4 support.

interfaceTable : InterfaceTable

Keeps the table of network interfaces.

Source:
interfaceTable: InterfaceTable {
    parameters:
        @display("p=100,100;i=block/table_s");
} ospf : Ospfv2

Implements the OSPFv2 routing protocol.

Source:
ospf: Ospfv2 {
    parameters:
        @display("p=400,240,row;i=block/network2");
} bgp : Bgp

Implements BGP Version 4 routing protocol.

Source:
bgp: Bgp {
    parameters:
        ospfRoutingModule = "^.ospf";
        @display("p=250,80;i=block/network");
} snifferIn : MessageChecker

Module that allows checking fields of messages.

Source:
snifferIn: MessageChecker {
    parameters:
        @display("i=block/uparrow_s;p=175,160");
} snifferOut : MessageChecker

Module that allows checking fields of messages.

Source:
snifferOut: MessageChecker {
    parameters:
        @display("i=block/downarrow_s;p=325,160");
} tcp : like ITcp

ITcp: Interface for TCP protocol implementations.

Source:
tcp: <default(firstAvailable("Tcp","TcpLwip","TcpNsc"))> like ITcp {
    parameters:
        @display("p=250,240;i=block/transport");
} tn : MessageDispatcher

Facilitates the interconnection of applications, protocols, and network interfaces, dispatching...

Source:
tn: MessageDispatcher {
    parameters:
        @display("b=400,5,,,,1;p=325,320");
} ipv4 : Ipv4NetworkLayer

Network layer of an IPv4 node.

Source:
ipv4: Ipv4NetworkLayer {
    parameters:
        routingTable.routerId = "auto";
        @display("p=250,400;i=block/layer;q=queue");
} nl : MessageDispatcher

Facilitates the interconnection of applications, protocols, and network interfaces, dispatching...

Source:
nl: MessageDispatcher {
    parameters:
        @display("b=400,5,,,,1;p=325,480");
} ethernet : like IEthernetLayer

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

IEthernetLayer: Module interface for Ethernet protocol layer implementations.

Source:
ethernet: <default("EthernetEncapsulation")> like IEthernetLayer if typename != "" {
    @display("p=250,560");
} li : MessageDispatcher

Facilitates the interconnection of applications, protocols, and network interfaces, dispatching...

Source:
li: MessageDispatcher {
    parameters:
        @display("b=400,5,,,,1;p=325,640");
} ppp[sizeof(pppg)] : like IPppInterface

PppInterface: Implements a PPP network interface.

IPppInterface: Interface for PPP network interfaces.

Source:
ppp[sizeof(pppg)]: <default("PppInterface")> like IPppInterface {
    parameters:
        @display("p=250,720,row,110;q=l2queue;i=block/ifcard");
} eth[sizeof(ethg)] : like IEthernetInterface

EthernetInterface: Represents an Ethernet network interface.

IEthernetInterface: Interface for Ethernet network interfaces.

Source:
eth[sizeof(ethg)]: <default("EthernetInterface")> like IEthernetInterface {
    parameters:
        @display("p=400,720,row,110;q=l2queue;i=block/ifcard");
}

Usage diagram

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

Used in

Name Type Description
BgpNetwork network (no description)

Parameters

Name Type Default value Description
forwarding bool true
multicastForwarding bool false

Properties

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

Gates

Name Direction Size Description
pppg [ ] inout
ethg [ ] inout

Unassigned submodule parameters

Name Type Default value Description
interfaceTable.displayStringTextFormat string ""

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

ospf.displayStringTextFormat string ""

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ospf.interfaceTableModule string
ospf.routingTableModule string
ospf.checksumMode string "declared"
ospf.startupTime double 0s

Delay before starting OSPF

ospf.ospfConfig xml xml(" \ \ \ \ ")

xml containing the full OSPF AS configuration

ospf.routerPriority int 1

Priority in DR/BDR election (Specify 0 to exclude the router from the election)

ospf.areaID string "0.0.0.0"
ospf.RFC1583Compatible bool false

If 'false', prune the set of routing table entries for the ASBR (RFC 3101)

ospf.DistributeDefaultRoute bool false

Distribute the default route (if exists) using AS-External LSA

ospf.helloInterval int 10s

Specifies the time in seconds between hello packets that the other router sends on an interface

ospf.pollInterval int 120s

Specifies the length of time, in seconds, between OSPF packets that the router send before adjacency is established with a neighbor

ospf.routerDeadInterval int 40s

The interval during which at least one hello packet must be received from a neighbor before the router declares that neighbor as down

ospf.retransmissionInterval int 5s

The time between OSPF LSA retransmissions for adjacencies that belongs to the interface

ospf.interfaceTransmissionDelay int 1s

The number of seconds required to transmit a link state update packet. Valid values are 1 to 65535

ospf.interfaceMode string "Active"

NoOSPF: the interface is not advertised by OSPF Passive: the interface is advertised, but no OSPF message is sent out

ospf.referenceBandwidth int 1e8bps

Reference bandwidth for cost calculation

ospf.interfaceOutputCost int 0

Cost of link on the interface (1-1000), 0 means use reference bandwidth

ospf.externalInterfaceOutputCost int 1

Cost of link (1-1000)

ospf.externalInterfaceOutputType string "Type2"

Type1|Type2

ospf.forwardingAddress string "0.0.0.0"
ospf.linkCost int 1

Cost of link (1-1000) for HostInterface and LoopbackInterface only

ospf.authenticationType string "NullType"
ospf.authenticationKey string "0x00"

0xnn..nn

bgp.displayStringTextFormat string ""

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

bgp.interfaceTableModule string
bgp.routingTableModule string
bgp.startupTime double 0s

Delay before starting BGP

bgp.bgpConfig xml
bgp.ExternalPeerStartDelayOffset double 0.5s
bgp.redistributeRip bool false

Redistribute routes learned by RIP into BGP

bgp.redistributeOspf string ""

Redistribute routes learned by OSPF into BGP (O IA E1 E2)

bgp.redistributeInternal bool false

Redistribute BGP routes into OSPF (as external routes)

bgp.nextHopSelf bool false
bgp.localPreference int 100
bgp.connectedCheck bool true
bgp.ebgpMultihop int 1
snifferIn.displayStringTextFormat string ""

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

snifferIn.config xml

Configuration file

snifferOut.displayStringTextFormat string ""

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

snifferOut.config xml

Configuration file

tn.displayStringTextFormat string "processed %p pk (%l)"

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

tn.interfaceTableModule string

Module path to the ~InterfaceTable module

tn.forwardServiceRegistration bool true
tn.forwardProtocolRegistration bool true
tn.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

tn.serviceMapping object {}

Maps protocols to connected submodule names (e.g. {"ethernetmac": "bridging"}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default

tn.protocolMapping object {}

Maps protocols to connected submodule names (e.g. {"ipv4": "bridging"}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default

ipv4.routingTable.displayStringTextFormat string ""

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ipv4.routingTable.interfaceTableModule string

The path to the InterfaceTable module

ipv4.routingTable.routerId string "auto"

For routers, the router id using IPv4 address dotted notation; specify "auto" to select the highest interface address; should be left empty ("") for hosts

ipv4.routingTable.netmaskRoutes string "*"

Maintain netmask routes for interfaces

ipv4.routingTable.forwarding bool true

Turns IP forwarding on/off

ipv4.routingTable.multicastForwarding bool false

Turns multicast forwarding on/off

ipv4.routingTable.useAdminDist bool false

Use Cisco-like administrative distances

ipv4.routingTable.routingFile string ""

Routing table file name

ipv4.natTable.displayStringTextFormat string ""

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ipv4.natTable.networkProtocolModule string "^.ip"
ipv4.natTable.config xml xml("")

XML configuration parameters for network address translation

ipv4.up.displayStringTextFormat string "processed %p pk (%l)"

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ipv4.up.interfaceTableModule string

Module path to the ~InterfaceTable module

ipv4.up.forwardServiceRegistration bool true
ipv4.up.forwardProtocolRegistration bool true
ipv4.up.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

ipv4.up.serviceMapping object {}

Maps protocols to connected submodule names (e.g. {"ethernetmac": "bridging"}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default

ipv4.up.protocolMapping object {}

Maps protocols to connected submodule names (e.g. {"ipv4": "bridging"}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default

ipv4.icmp.displayStringTextFormat string ""

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ipv4.icmp.interfaceTableModule string

The path to the InterfaceTable module

ipv4.icmp.routingTableModule string
ipv4.icmp.checksumMode string "declared"
ipv4.icmp.quoteLength int 8B

Number of bytes from original packet to quote in ICMP reply

ipv4.mp.displayStringTextFormat string "processed %p pk (%l)"

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ipv4.mp.interfaceTableModule string

Module path to the ~InterfaceTable module

ipv4.mp.forwardServiceRegistration bool true
ipv4.mp.forwardProtocolRegistration bool true
ipv4.mp.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

ipv4.mp.serviceMapping object {}

Maps protocols to connected submodule names (e.g. {"ethernetmac": "bridging"}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default

ipv4.mp.protocolMapping object {}

Maps protocols to connected submodule names (e.g. {"ipv4": "bridging"}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default

ipv4.ipsec.displayStringTextFormat string ""

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ipv4.ipsec.networkProtocolModule string "^.ip"
ipv4.ipsec.interfaceTableModule string
ipv4.ipsec.spdModule string "^.spd"
ipv4.ipsec.sadModule string "^.sad"
ipv4.ipsec.spdConfig xml
ipv4.ipsec.defaultProtection string ""

If not "": value to use where <Protection> element is absent from the configuration

ipv4.ipsec.defaultEspMode string ""

If not "": value to use where <EspMode> element is absent from the configuration

ipv4.ipsec.defaultEncryptionAlg string ""

If not "": value to use where <EncryptionAlg> element is absent from the configuration

ipv4.ipsec.defaultAuthenticationAlg string ""

If not "": value to use where <defaultAuthenticationAlg> element is absent from the configuration

ipv4.ipsec.defaultMaxTfcPadLength int 0

Value to use where <MaxTfcPadLength> element is absent from the configuration

ipv4.ipsec.ahProtectOutDelay double 0.0s
ipv4.ipsec.ahProtectInDelay double 0.0s
ipv4.ipsec.espProtectOutDelay double 0.0s
ipv4.ipsec.espProtectInDelay double 0.0s
ipv4.spd.displayStringTextFormat string ""

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ipv4.sad.displayStringTextFormat string ""

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ipv4.lp.displayStringTextFormat string "processed %p pk (%l)"

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

ipv4.lp.interfaceTableModule string

Module path to the ~InterfaceTable module

ipv4.lp.forwardServiceRegistration bool true
ipv4.lp.forwardProtocolRegistration bool true
ipv4.lp.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

ipv4.lp.serviceMapping object {}

Maps protocols to connected submodule names (e.g. {"ethernetmac": "bridging"}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default

ipv4.lp.protocolMapping object {}

Maps protocols to connected submodule names (e.g. {"ipv4": "bridging"}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default

nl.displayStringTextFormat string "processed %p pk (%l)"

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

nl.interfaceTableModule string

Module path to the ~InterfaceTable module

nl.forwardServiceRegistration bool true
nl.forwardProtocolRegistration bool true
nl.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

nl.serviceMapping object {}

Maps protocols to connected submodule names (e.g. {"ethernetmac": "bridging"}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default

nl.protocolMapping object {}

Maps protocols to connected submodule names (e.g. {"ipv4": "bridging"}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default

li.displayStringTextFormat string "processed %p pk (%l)"

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.bitrate double

Source code

//
// Example IP router with BGPv4 and OSPFv4 support.
//
module BGPRouterEx
{
    parameters:
        @networkNode();
        @labels(node,ethernet-node);
        @display("i=abstract/router");
        bool forwarding = true;
        bool multicastForwarding = default(false);
        ethernet.registerProtocol = default(true);
        *.forwarding = this.forwarding;
        *.multicastForwarding = this.multicastForwarding;
        *.interfaceTableModule = default(absPath(".interfaceTable"));
        *.routingTableModule = default(absPath(".ipv4.routingTable"));
    gates:
        inout pppg[] @labels(PppFrame-conn);
        inout ethg[] @labels(EtherFrame-conn);
    submodules:
        interfaceTable: InterfaceTable {
            parameters:
                @display("p=100,100;i=block/table_s");
        }
        ospf: Ospfv2 {
            parameters:
                @display("p=400,240,row;i=block/network2");
        }
        bgp: Bgp {
            parameters:
                ospfRoutingModule = "^.ospf";
                @display("p=250,80;i=block/network");
        }
        snifferIn: MessageChecker {
            parameters:
                @display("i=block/uparrow_s;p=175,160");
        }
        snifferOut: MessageChecker {
            parameters:
                @display("i=block/downarrow_s;p=325,160");
        }
        tcp: <default(firstAvailable("Tcp","TcpLwip","TcpNsc"))> like ITcp {
            parameters:
                @display("p=250,240;i=block/transport");
        }
        tn: MessageDispatcher {
            parameters:
                @display("b=400,5,,,,1;p=325,320");
        }
        ipv4: Ipv4NetworkLayer {
            parameters:
                routingTable.routerId = "auto";
                @display("p=250,400;i=block/layer;q=queue");
        }
        nl: MessageDispatcher {
            parameters:
                @display("b=400,5,,,,1;p=325,480");
        }
        ethernet: <default("EthernetEncapsulation")> like IEthernetLayer if typename != "" {
            @display("p=250,560");
        }
        li: MessageDispatcher {
            parameters:
                @display("b=400,5,,,,1;p=325,640");
        }
        ppp[sizeof(pppg)]: <default("PppInterface")> like IPppInterface {
            parameters:
                @display("p=250,720,row,110;q=l2queue;i=block/ifcard");
        }
        eth[sizeof(ethg)]: <default("EthernetInterface")> like IEthernetInterface {
            parameters:
                @display("p=400,720,row,110;q=l2queue;i=block/ifcard");
        }
    connections allowunconnected:
        bgp.socketOut --> { @display("m=s"); } --> snifferOut.in;
        bgp.socketIn <-- { @display("m=s"); } <-- snifferIn.out;

        snifferOut.out --> { @display("m=s"); } --> tcp.appIn;
        snifferIn.in <-- { @display("m=s"); } <-- tcp.appOut;

        tcp.ipOut --> { @display("m=s"); } --> tn.in++;
        tcp.ipIn <-- { @display("m=s"); } <-- tn.out++;
        ospf.ipOut --> { @display("m=s"); } --> tn.in++;
        ospf.ipIn <-- { @display("m=s"); } <-- tn.out++;

        tn.out++ --> { @display("m=s"); } --> ipv4.transportIn;
        tn.in++ <-- { @display("m=s"); } <-- ipv4.transportOut;

        ipv4.ifOut --> { @display("m=s"); } --> nl.in++;
        ipv4.ifIn <-- { @display("m=s"); } <-- nl.out++;

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

        nl.out++ --> ethernet.upperLayerIn if exists(ethernet);
        ethernet.upperLayerOut --> nl.in++ if exists(ethernet);
        ethernet.lowerLayerOut --> li.in++ if exists(ethernet);
        li.out++ --> ethernet.lowerLayerIn if exists(ethernet);

        // connections to network outside
        for i=0..sizeof(pppg)-1 {
            pppg[i] <--> ppp[i].phys;
            ppp[i].upperLayerOut --> li.in++;
            ppp[i].upperLayerIn <-- li.out++;
        }

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

File: examples/bgpv4/BgpUpdate/BGPRouterEx.ned