BGPRouterEx

Package: inet.examples.bgpv4.BgpUpdate

BGPRouterEx

compound module

Example IP router with BGPv4 and OSPFv4 support.

InterfaceTable Ospfv2 Bgp MessageChecker MessageChecker ITcp MessageDispatcher Ipv4NetworkLayer MessageDispatcher IEthernetLayer MessageDispatcher IPppInterface IEthernetInterface

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

whether to display IP addresses on links

ospf.interfaceTableModule string
ospf.routingTableModule string
ospf.crcMode 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 advertized by OSPF Passive: the interface is advertised, but no OSPF message is send 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.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.config xml

Configuration file

snifferOut.config xml

Configuration file

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

ipv4.up.forwardServiceRegistration bool true
ipv4.up.forwardProtocolRegistration bool true
ipv4.icmp.interfaceTableModule string

The path to the InterfaceTable module

ipv4.icmp.routingTableModule string
ipv4.icmp.crcMode 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

ipv4.mp.forwardServiceRegistration bool true
ipv4.mp.forwardProtocolRegistration bool true
ipv4.lp.displayStringTextFormat string "processed %p pk (%l)"

determines the text that is written on top of the submodule

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

//
// 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