gov.nist.antd.ospf_te
Class sOSPF_TE

java.lang.Object
  |
  +--SSF.OS.ProtocolSession
        |
        +--gov.nist.antd.ospf_te.sOSPF_TE
All Implemented Interfaces:
com.renesys.raceway.DML.Configurable

public class sOSPF_TE
extends ProtocolSession

Traffic Engineering Extension to OSPF

Author:
Kwangil Lee
, borchert

Nested Class Summary
private  class sOSPF_TE.StartupTimer
          A timer used to apply a brief waiting period before the link state database is first calculated at startup.
 
Field Summary
static int ADJACENT
          Indicates that an adjacency exists with a given neighbor.
static int AREA_BORDER
          Indicates an OSPF area border router.
 boolean area_border_rtr
          Indicates if this is an area border router.
 int area_num
          The Area to which this router belongs.
 int[] areas
          The Area(s) to which this route belongs.
static int AS_BOUNDARY
          Indicates an OSPF AS boundary router.
 boolean as_boundary_rtr
          Indicates if this is an AS boundary router.
 java.lang.String as_nh
          The NHI address prefix of the AS to which this router belongs.
 int as_num
          The number of the AS to which this router belongs.
static int ASPF_MCAST_ADDR
          The int value of the multicast address for ALLSPFRouters (All Shortest Path First Routers).
static int BACKBONE
          Indicates an OSPF backbone router.
 boolean backbone_rtr
          Indicates if this is a backbone router.
static double BUILD_RT_TABLE_ITVL
          The interval at which OSPF rebuilds its routing tables.
private  int c
           
static int COLOR
          Field COLOR - XXX
 Debug debug
          A helper to manage debugging.
static int DESIG_MCAST_ADDR
          Field DESIG_MCAST_ADDR - XXX
static int DISTANCE
          Field DISTANCE - XXX
static int DOWN
          Indicates that a given neighbor is down.
static int ERROR_RATE
          Field ERROR_RATE - XXX
 RoutingTable fwd_table
          Field fwd_table - XXX
static double GET_RT_TYPE_ITVL
          The interval at which OSPF determines the router types.
static double HELLO_INTERVAL
          The interval at which OSPF sends hello packets.
static int HELLO_RCVD
          Indicates that a hello has been received from a given neighbor.
static int HOP_COUNT
          Field HOP_COUNT - XXX
 int hostid
          The host ID of the local router.
 java.util.Vector ifs
          The OSPF interface data structure.
 int ifs_index
          Field ifs_index - XXX
static int INTERNAL
          Indicates an internal OSPF router.
 boolean internal_rtr
          Indicates if this is an internal Router.
(package private)  IP ip
          A reference to the underlying IP protocol session.
 int[] lsaflag
          Field lsaflag - XXX
 int lsaindex
          Field lsaindex - XXX
 LSDatabase lsdb
          The link state database implemented as an adjacency list.
static int MAX_BW
          Field MAX_BW - XXX
static int MAX_RESV_BW
          Field MAX_RESV_BW - XXX
static int MAX_TE_METRICS
          Field MAX_TE_METRICS - XXX
static int MAX_TLV_LENGTH
          Field MAX_TLV_LENGTH - XXX
 java.lang.String nh
          The NHI address prefix of the local router.
 int nic_length
          Field nic_length - XXX
private static boolean options_configured
          Whether or not global OSPF options have yet been configured (since it only needs to be done once, by one OSPF instance).
static int POINT_TO_POINT
          Indicates a point-to-point connection to another router.
private  Router rtr
          The local router.
private  int rtrid
          The identity of this router.
static double SEND_LSA_ITVL
          The interval at which OSPF sends LSAs.
private  int seqnum
          Packet sequence number, which is supposed to be unique for all OSPF LSA packets.
private  int seqnum_index
          The index of the next slot to insert in seqnum_rcvd.
private  java.lang.String[] seqnum_rcvd
          An array storing all the seqnums of all packets received
 TERoutingTable te_fwd_table
          The local router's forwarding table.
 java.util.Vector teifs
          The OSPF interface data structure.
static int TO_AS_BOUNDARY
          Indicates a connection to an AS boundary router.
static int TO_HOST
          Indicates a connection to a host.
static int TO_LSR
          Field TO_LSR - XXX
static int TO_STUB
          Indicates a connection to a stub network.
static int TO_TRANSIT
          Indicates a connection to a transit network.
static int TO_TUNNEL
          Field TO_TUNNEL - XXX
static int TO_VIRTUAL
          Indicates a connection to a host.
static Net topnet
          A reference to the top-level Net.
static int UN_RESV_BW
          Field UN_RESV_BW - XXX
private static boolean vmsg_printed
          Whether or not a validation test message has yet been printed (since it only needs to be done once (by one OSPF instance)).
 
Fields inherited from class SSF.OS.ProtocolSession
name, use
 
Constructor Summary
sOSPF_TE()
          Constructs an OSPF protocol session.
 
Method Summary
 void acceptASExternalRoute(int destNetworkIP, int destNetworkMask)
          This method is called by other inter-AS routing protocols, e.g.
 void acceptASExternalRoute(java.lang.String forwardRtrNH, int destNetworkIP, int destNetworkMask)
          This method is called by other inter-AS routing protocols, e.g.
private  void addRcvdSeqNum(int seq_num, java.lang.String nhipref)
          Adds a sequence number to the list of received sequence numbers.
private  void announceASExternalRoute(int destNetworkIP, int destNetworkMask)
          This methods is the non-flooding way used by ASBRs to announce an AS External Route to all routers in the same AS.
private  void buildRoutingTable()
          Builds the shortest path tree using the databases.
private static void config_options(com.renesys.raceway.DML.Configuration cfg)
          Configures options set with the ospfoptions attribute in DML.
 void config(com.renesys.raceway.DML.Configuration cfg)
          Method config XXX
 void createOpqLinkDatabase()
          Queries the list of all routers and links from Net, decides connection types, and creates a link state database.
private  void determineRouterType()
          Determine router type by comparing area number and AS id to those if its peers.
 Interface findInterface(int id)
          Method findInterface XXX
private  int getNextSeqNum()
          Returns the next LSA sequence number of this OSPF session.
protected  NIC getNic(MPLSInterfaceInfo info)
           
protected  NIC getPeerNic(MPLSInterfaceInfo info)
           
 float getSimTime()
          Get the current simulation.
 java.util.Vector getSummaryNets(java.util.Hashtable mySumNet)
          Returns a list of link information containing all the networks in the given table that do not belong to the area(s) this OSPF router belongs to.
 void init()
          Initialization routine called by ProtocolGraph after instantiation.
 void initTEInterfaces()
          Method initTEInterfaces
 double nowsec()
          Returns the current simulation time in seconds.
private  boolean oneOfAreas(int area)
          Returns true if this router belongs to the given area.
private static void print_validation_test_msg(sOSPF_TE ospf)
          Prints a validation test message if the current model being executed is part of a validation test.
private  void processLSApkt(Packet pkt)
          This method processes a Link State Advertisement.
private  void processType5LSA(Packet pkt)
          Processes all incoming Type 5 (AS external routes) packets.
 boolean push(ProtocolMessage message, ProtocolSession fromSession)
          Method push XXX
private  void sendLSAListAllItrf(int LSAtype, int lsid, java.util.Vector linkinfolist, boolean sameArea, int thisArea)
          Sends a list of link information to all interfaces.
private  boolean sendOSPFheaderItrf(Packet pkt, Interface Itrf)
          Sends an OSPF packet out on an interface.
private  boolean seqNumInList(int seq_num, java.lang.String nhipref)
          Returns true if the given sequence number is in the seq number list.
 void updateLinkInterface()
          Method updateLinkInterface
 
Methods inherited from class SSF.OS.ProtocolSession
close, closed, debugIdentifier, inGraph, open, opened, pushAfterDelay, pushAfterDelayFailed, setGraph, version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERNAL

public static final int INTERNAL
Indicates an internal OSPF router.

See Also:
Constant Field Values

AREA_BORDER

public static final int AREA_BORDER
Indicates an OSPF area border router.

See Also:
Constant Field Values

BACKBONE

public static final int BACKBONE
Indicates an OSPF backbone router.

See Also:
Constant Field Values

AS_BOUNDARY

public static final int AS_BOUNDARY
Indicates an OSPF AS boundary router.

See Also:
Constant Field Values

GET_RT_TYPE_ITVL

public static final double GET_RT_TYPE_ITVL
The interval at which OSPF determines the router types.

See Also:
Constant Field Values

HELLO_INTERVAL

public static final double HELLO_INTERVAL
The interval at which OSPF sends hello packets.

See Also:
Constant Field Values

SEND_LSA_ITVL

public static final double SEND_LSA_ITVL
The interval at which OSPF sends LSAs.

See Also:
Constant Field Values

BUILD_RT_TABLE_ITVL

public static final double BUILD_RT_TABLE_ITVL
The interval at which OSPF rebuilds its routing tables.

See Also:
Constant Field Values

DOWN

public static final int DOWN
Indicates that a given neighbor is down.

See Also:
Constant Field Values

HELLO_RCVD

public static final int HELLO_RCVD
Indicates that a hello has been received from a given neighbor.

See Also:
Constant Field Values

ADJACENT

public static final int ADJACENT
Indicates that an adjacency exists with a given neighbor.

See Also:
Constant Field Values

POINT_TO_POINT

public static final int POINT_TO_POINT
Indicates a point-to-point connection to another router.

See Also:
Constant Field Values

TO_TRANSIT

public static final int TO_TRANSIT
Indicates a connection to a transit network.

See Also:
Constant Field Values

TO_STUB

public static final int TO_STUB
Indicates a connection to a stub network.

See Also:
Constant Field Values

TO_AS_BOUNDARY

public static final int TO_AS_BOUNDARY
Indicates a connection to an AS boundary router.

See Also:
Constant Field Values

TO_HOST

public static final int TO_HOST
Indicates a connection to a host.

See Also:
Constant Field Values

TO_VIRTUAL

public static final int TO_VIRTUAL
Indicates a connection to a host.

See Also:
Constant Field Values

TO_TUNNEL

public static final int TO_TUNNEL
Field TO_TUNNEL - XXX

See Also:
Constant Field Values

TO_LSR

public static final int TO_LSR
Field TO_LSR - XXX

See Also:
Constant Field Values

ASPF_MCAST_ADDR

public static final int ASPF_MCAST_ADDR
The int value of the multicast address for ALLSPFRouters (All Shortest Path First Routers). The real IP address is 224.0.0.5, but here we will use Integer.MAX_VALUE - 10.

See Also:
Constant Field Values

DESIG_MCAST_ADDR

public static final int DESIG_MCAST_ADDR
Field DESIG_MCAST_ADDR - XXX

See Also:
Constant Field Values

MAX_TLV_LENGTH

public static final int MAX_TLV_LENGTH
Field MAX_TLV_LENGTH - XXX

See Also:
Constant Field Values

MAX_TE_METRICS

public static final int MAX_TE_METRICS
Field MAX_TE_METRICS - XXX

See Also:
Constant Field Values

lsaflag

public int[] lsaflag
Field lsaflag - XXX


HOP_COUNT

public static final int HOP_COUNT
Field HOP_COUNT - XXX

See Also:
Constant Field Values

MAX_BW

public static final int MAX_BW
Field MAX_BW - XXX

See Also:
Constant Field Values

MAX_RESV_BW

public static final int MAX_RESV_BW
Field MAX_RESV_BW - XXX

See Also:
Constant Field Values

UN_RESV_BW

public static final int UN_RESV_BW
Field UN_RESV_BW - XXX

See Also:
Constant Field Values

COLOR

public static final int COLOR
Field COLOR - XXX

See Also:
Constant Field Values

DISTANCE

public static final int DISTANCE
Field DISTANCE - XXX

See Also:
Constant Field Values

ERROR_RATE

public static final int ERROR_RATE
Field ERROR_RATE - XXX

See Also:
Constant Field Values

topnet

public static Net topnet
A reference to the top-level Net.


rtr

private Router rtr
The local router.


hostid

public int hostid
The host ID of the local router.


nh

public java.lang.String nh
The NHI address prefix of the local router.


rtrid

private int rtrid
The identity of this router. It is chosen as the smallest of the IP of all its interfaces (in A.B.C.D/bits form).


c

private int c

internal_rtr

public boolean internal_rtr
Indicates if this is an internal Router.


area_border_rtr

public boolean area_border_rtr
Indicates if this is an area border router.


backbone_rtr

public boolean backbone_rtr
Indicates if this is a backbone router.


as_boundary_rtr

public boolean as_boundary_rtr
Indicates if this is an AS boundary router.


as_nh

public java.lang.String as_nh
The NHI address prefix of the AS to which this router belongs.


as_num

public int as_num
The number of the AS to which this router belongs.


area_num

public int area_num
The Area to which this router belongs.


areas

public int[] areas
The Area(s) to which this route belongs. A router can belong to at most 2 areas, ie, the backbone and a non-backbone area.


ifs

public java.util.Vector ifs
The OSPF interface data structure.


teifs

public java.util.Vector teifs
The OSPF interface data structure.


ifs_index

public int ifs_index
Field ifs_index - XXX


nic_length

public int nic_length
Field nic_length - XXX


lsaindex

public int lsaindex
Field lsaindex - XXX


lsdb

public LSDatabase lsdb
The link state database implemented as an adjacency list.


te_fwd_table

public TERoutingTable te_fwd_table
The local router's forwarding table.


fwd_table

public RoutingTable fwd_table
Field fwd_table - XXX


seqnum

private int seqnum
Packet sequence number, which is supposed to be unique for all OSPF LSA packets. Currently, it starts at "nh+1" for all routers.


seqnum_rcvd

private java.lang.String[] seqnum_rcvd
An array storing all the seqnums of all packets received


seqnum_index

private int seqnum_index
The index of the next slot to insert in seqnum_rcvd.


ip

IP ip
A reference to the underlying IP protocol session.


vmsg_printed

private static boolean vmsg_printed
Whether or not a validation test message has yet been printed (since it only needs to be done once (by one OSPF instance)).


debug

public Debug debug
A helper to manage debugging.


options_configured

private static boolean options_configured
Whether or not global OSPF options have yet been configured (since it only needs to be done once, by one OSPF instance).

Constructor Detail

sOSPF_TE

public sOSPF_TE()
Constructs an OSPF protocol session.

Method Detail

config

public void config(com.renesys.raceway.DML.Configuration cfg)
            throws com.renesys.raceway.DML.configException
Method config XXX

Specified by:
config in interface com.renesys.raceway.DML.Configurable
Overrides:
config in class ProtocolSession
Parameters:
cfg - - XXX
Throws:
com.renesys.raceway.DML.configException

config_options

private static void config_options(com.renesys.raceway.DML.Configuration cfg)
Configures options set with the ospfoptions attribute in DML. Only one OSPF instance in the entire simulation will actually execute this method in its entirety. This is because the options configured here are those which apply globally to all OSPF instances. The one OSPF instance that executes this method does so on behalf of all OSPF instances in the simulation.

Parameters:
cfg - Contains the values of configurable OSPF options.

print_validation_test_msg

private static void print_validation_test_msg(sOSPF_TE ospf)
Prints a validation test message if the current model being executed is part of a validation test. It is here separately so that it can be synchronized, so that it gets executed exactly once during the run.

Parameters:
ospf - The OSPF protocol session that is calling this class method.

init

public void init()
          throws ProtocolException
Initialization routine called by ProtocolGraph after instantiation. Information that OSPF needs in the setup stage include: 1. a reference to the IP protocol 2. a reference to the router in which this OSPF sits 3. the level numbers of the router, which says which AS and area this router is in

Overrides:
init in class ProtocolSession
ProtocolException

nowsec

public double nowsec()
Returns the current simulation time in seconds.

Returns:
the current simulation time in seconds

getNextSeqNum

private int getNextSeqNum()
Returns the next LSA sequence number of this OSPF session. changed a sequence number to have unique one. // revised by msc. the sequence number has the following structure: router_nh+seqnum, where the number itself is a string not an integer.


addRcvdSeqNum

private void addRcvdSeqNum(int seq_num,
                           java.lang.String nhipref)
Adds a sequence number to the list of received sequence numbers.


seqNumInList

private boolean seqNumInList(int seq_num,
                             java.lang.String nhipref)
Returns true if the given sequence number is in the seq number list.


initTEInterfaces

public void initTEInterfaces()
Method initTEInterfaces


getNic

protected NIC getNic(MPLSInterfaceInfo info)

getPeerNic

protected NIC getPeerNic(MPLSInterfaceInfo info)

determineRouterType

private void determineRouterType()
Determine router type by comparing area number and AS id to those if its peers.


createOpqLinkDatabase

public void createOpqLinkDatabase()
Queries the list of all routers and links from Net, decides connection types, and creates a link state database.


updateLinkInterface

public void updateLinkInterface()
Method updateLinkInterface


push

public boolean push(ProtocolMessage message,
                    ProtocolSession fromSession)
             throws ProtocolException
Method push XXX

Specified by:
push in class ProtocolSession
Parameters:
message - - XXX
fromSession - - XXX
Returns:
boolean - XXX
Throws:
ProtocolException

sendOSPFheaderItrf

private boolean sendOSPFheaderItrf(Packet pkt,
                                   Interface Itrf)
Sends an OSPF packet out on an interface.


sendLSAListAllItrf

private void sendLSAListAllItrf(int LSAtype,
                                int lsid,
                                java.util.Vector linkinfolist,
                                boolean sameArea,
                                int thisArea)
Sends a list of link information to all interfaces. This method allows you decide if you want to send the list to interfaces belonging to the specified area argument (thisArea) using the boolean argument (sameArea).


processLSApkt

private void processLSApkt(Packet pkt)
This method processes a Link State Advertisement. It doesn't do anything in this implementation. It is called by the push() method.


getSimTime

public float getSimTime()
Get the current simulation.


acceptASExternalRoute

public void acceptASExternalRoute(int destNetworkIP,
                                  int destNetworkMask)
This method is called by other inter-AS routing protocols, e.g. BGP, to tell OSPF about AS External Routes.


acceptASExternalRoute

public void acceptASExternalRoute(java.lang.String forwardRtrNH,
                                  int destNetworkIP,
                                  int destNetworkMask)
This method is called by other inter-AS routing protocols, e.g. BGP, to tell OSPF about AS External Routes.


announceASExternalRoute

private void announceASExternalRoute(int destNetworkIP,
                                     int destNetworkMask)
This methods is the non-flooding way used by ASBRs to announce an AS External Route to all routers in the same AS. It does this by calling their acceptASExternalRoute() method directly.


processType5LSA

private void processType5LSA(Packet pkt)
Processes all incoming Type 5 (AS external routes) packets.


buildRoutingTable

private void buildRoutingTable()
Builds the shortest path tree using the databases.


findInterface

public Interface findInterface(int id)
Method findInterface XXX

Parameters:
id - - XXX
Returns:
Interface - XXX

getSummaryNets

public java.util.Vector getSummaryNets(java.util.Hashtable mySumNet)
Returns a list of link information containing all the networks in the given table that do not belong to the area(s) this OSPF router belongs to.


oneOfAreas

private boolean oneOfAreas(int area)
Returns true if this router belongs to the given area.