SSF.OS.OSPFv2
Class AreaData

java.lang.Object
  |
  +--SSF.OS.OSPFv2.AreaData
All Implemented Interfaces:
com.renesys.raceway.DML.Configurable

public class AreaData
extends java.lang.Object
implements com.renesys.raceway.DML.Configurable

This Data Stucture contains all information used to run the basic OSPF routing algorithm.


Field Summary
 java.util.Vector addressRanges
          This Vector holds the areas address ranges in order to aggregate routing information at area boundaries.
 int areaID
          The identifier for this area.
 LSDatabase database
          The LS Database for this area.
 Dijkstra dijkstra
          A instance of the dijkstra algorithm to calculate shortest paths for this area.
 java.util.HashMap interfaces
          The following HashMap represents a list of all router's interfaces associated with this area.
 OSPF myOSPF
          A reference to the OSPF session this area belongs to.
 boolean[] options
          The optional capabilities of this area of the router.
 java.util.HashMap preConfInterfaces
          A HashMap representing a list of all router's pre-configured interfaces associated with this area.
 java.util.HashMap shortestPathTree
          The shortest-path tree for the area represented as HashMap.
 int stubDefaultCost
          Indicates the cost of the default summary-LSA, the router advertises if eBit is false and the router itself is an area border border.
 boolean transitCapability
          This parameter indicates whether the area can carry data traffic that neither originates nor terminates in the area itself (Is a transit area or not).
 
Constructor Summary
AreaData(OSPF ospf, com.renesys.raceway.DML.Configuration cfg)
          Constructs an Area Data Structure with the specified area id.
 
Method Summary
 void addAddrRange(java.lang.Object addrRange)
          adds a new address range to the given.
 void addInterface(Interface intf)
          adds a new Interface to this area.
 void advanceSeqNumOf(LSA advLSA)
          Method called by "Neighbor.processReceivedLSA() in case of receiving a selforiginated LSA newer than the one stored in the Database.
 java.util.HashMap calculateDijkstraPartI()
          Calculate the first stage of Dijkstra.
 java.util.HashMap calculateDijkstraPartII()
          Calculate the second stage of Dijkstra.
 boolean canBeRemovedFromDatabase(LSA maxAgeLSA)
          Check whether none of the router's Neighbors are in states Exchange or Loading, and maxAgeLSA is no longer contained on any Neighbor's Link State Retransmission List.
 void clearLSAFromRetrLists(java.lang.String oldLSAKey)
          removes a particular LSA from every Neighbor Data Structures link state retransmission list whose represented Neighbor is adjacent to this area.
 boolean compareIPAddrWith(int id)
          Check whether one of the Ip Interface Addresses of this Area is equal to id and return true if so, else false.
 void config(com.renesys.raceway.DML.Configuration cfg)
          Configure the ospf area parameters.
 void configRest()
          Additional configuration to the area.
 void createRouterLSA()
          create a new router LSA for this area, install it in the database and if possible send it out the appropriate interfaces.
 LSA createSummary3LSA(int ipAddress, int ipMask, int cost)
          create a new summary type 3 LSA for this area and return it.
 LSA createSummary4LSA(int ipAddress, int cost)
          create a new summary type 4 LSA for this area and return it.
 void databaseDebugInfo()
          check whether debug switches for LS database debugging are enabled and the content of the database has changed.
 void floodLSA(LSA lsa, int neighborID)
          Flood an LSA out some set of the router's interfaces.
 LSA getLSA(java.lang.String key)
          Determine whether a particular LSA is stored in the database belonging to this Area Data Structure.
 java.util.Vector getLSAHeaders()
          Return a Vector containing all LSA-Headers currently stored in the LS Database.
 boolean hasInstanceOf(LSA testLSA)
          Check whether an instance of the given LSA exists in the database belonging to this Area, and if so return true else false.
 boolean hasInterface(java.lang.Integer ip)
          called by the OSPF session by order of another Area Data Structure to determine whether a particular Interface belongs to this Area.
 void init()
          Start the ospf routing process in this area.
 boolean installReceivedLSA(LSA instLSA, int neighborID)
          Install a new received LSA in the database and return true if installation was successful, otherwise false.
 void installSelfOrigLSA(LSA soLSA)
          Try to install a self-originated LSA and if the installation process was successful, flood it out some appropriate interfaces.
 boolean lsaIsWrapping(LSA testLSA)
          Check whether the sequence number of a particular LSA is wrapping and return true if so, else false.
 boolean noNeighborInDataExProcess()
          Check all Neighbors belonging to this Area whether they are in state EXCHANGE or LOADING.
 void printConfiguration()
          print current configuration of the area if necessary.
 boolean receivedPacket(Packet pkt, java.lang.Integer sourceIP, java.lang.Integer destIP)
          After the generic input processing of an OSPF Packet was done by the OSPF session above, this method will further process the Packet destined for this Area.
 Interface remInterface(java.lang.Integer intfIP)
          removes an Interface from the Interface list cause of an area change while re- configuring this Interface.
 void removeSummaryLSA(byte type, java.lang.Object destKey)
          Remove a selforiginated Summary-LSA from the LS Database.
 void reset()
          Reset the Area Data Structure.
 void setAddressRanges(java.util.Vector addrRanges)
          Set the areas address ranges to a new collection of address ranges.
 boolean shouldRequest(LSA lsa)
          Take an LSA Header and determine whether the associated body should be requested or not.
 boolean testInstanceOf(LSA testLSA, java.lang.String test)
          Check whether an IDENTICAL/MORE RECENT/LESS RECENT instance of the given LSA exists in the database belonging to this Area, and if so return true else false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

areaID

public int areaID
The identifier for this area.


myOSPF

public OSPF myOSPF
A reference to the OSPF session this area belongs to.


addressRanges

public java.util.Vector addressRanges
This Vector holds the areas address ranges in order to aggregate routing information at area boundaries.


interfaces

public java.util.HashMap interfaces
The following HashMap represents a list of all router's interfaces associated with this area. Key is the ip address of the correspondig interface.


preConfInterfaces

public java.util.HashMap preConfInterfaces
A HashMap representing a list of all router's pre-configured interfaces associated with this area. Key is the interface's id found in the configuration.


database

public LSDatabase database
The LS Database for this area. It includes router-LSAs, network-LSAs and summary-LSAs. AS-external-LSAs are hold in the OSPF class itself.


shortestPathTree

public java.util.HashMap shortestPathTree
The shortest-path tree for the area represented as HashMap.


dijkstra

public Dijkstra dijkstra
A instance of the dijkstra algorithm to calculate shortest paths for this area.


transitCapability

public boolean transitCapability
This parameter indicates whether the area can carry data traffic that neither originates nor terminates in the area itself (Is a transit area or not). For more description see RFC 2328 chapter 6


stubDefaultCost

public int stubDefaultCost
Indicates the cost of the default summary-LSA, the router advertises if eBit is false and the router itself is an area border border.


options

public boolean[] options
The optional capabilities of this area of the router. The eBit is part of this array and comes at position 6. See RFC2328 A.2 The Options field.

Constructor Detail

AreaData

public AreaData(OSPF ospf,
                com.renesys.raceway.DML.Configuration cfg)
Constructs an Area Data Structure with the specified area id.

Method Detail

config

public void config(com.renesys.raceway.DML.Configuration cfg)
            throws com.renesys.raceway.DML.configException
Configure the ospf area parameters. Supported DML attributes are:
  area [
         # The area's id as an integer, not formatted as an IP address
         # optional only if the router is solely attached to the backbone area.
         # In this case default value is 0 else 
         # mandatory!
         id      %I

         # This can be used to configure multiple areas at once
         idrange [from %I1! to %I1!] # idrange not impl. yet!!!

	     # Specifies if this area is a stub area (true|false)
         # optional! default value is: false
         stub    %S
           
         # Specifies the StubDefaultCost for a stub area
         # optional! default value is: 0
         stub_default_cost %I

         # A router's interfaces all belong to an area. All interfaces belonging
         # to this area are specified here.
         if %T:.schemas.ospf_if
       ]
  

Specified by:
config in interface com.renesys.raceway.DML.Configurable
Parameters:
cfg - contains the values for configurable ospf area parameters
Throws:
com.renesys.raceway.DML.configException - thrown if any of the calls to findSingle and find throw such an exception or if a misconfiguration is determined.

configRest

public void configRest()
                throws com.renesys.raceway.DML.configException
Additional configuration to the area. Configure IP addresses, IP maskes and the ospf neighbors of all interfaces belonging to this area and check their configured network type.

Throws:
com.renesys.raceway.DML.configException - if a misconfiguration is determined and if the called configuration routines throw such exceptions.

init

public void init()
Start the ospf routing process in this area. Therefore call "init()" of all attached interfaces and create a router LSA. Also used when restarting ospf.


reset

public void reset()
Reset the Area Data Structure. That means set a few references to the initial values and reset all Interfaces. This is part of the stop process of the OSPF Session.


setAddressRanges

public void setAddressRanges(java.util.Vector addrRanges)
Set the areas address ranges to a new collection of address ranges.


addAddrRange

public void addAddrRange(java.lang.Object addrRange)
adds a new address range to the given. The class Object should be replaced by an appropriate class for address Ranges in the future.


addInterface

public void addInterface(Interface intf)
adds a new Interface to this area.


remInterface

public Interface remInterface(java.lang.Integer intfIP)
removes an Interface from the Interface list cause of an area change while re- configuring this Interface.


hasInterface

public boolean hasInterface(java.lang.Integer ip)
called by the OSPF session by order of another Area Data Structure to determine whether a particular Interface belongs to this Area. This is needed to handle a change in membership in an area of an Interface correctly. The method returns true if the Interface, specified by its key, belongs to this Area, otherwise false.


createRouterLSA

public void createRouterLSA()
create a new router LSA for this area, install it in the database and if possible send it out the appropriate interfaces.


createSummary3LSA

public LSA createSummary3LSA(int ipAddress,
                             int ipMask,
                             int cost)
create a new summary type 3 LSA for this area and return it.

Parameters:
ipAddress - int value, representing the ip address of the destination network.
ipMask - int value, representing the ip mask of the destination network.
cost - int value, indicating the OSPF cost of the shortest path to the destination.
Returns:
LSA Object containing a summary LSA of type 3.

createSummary4LSA

public LSA createSummary4LSA(int ipAddress,
                             int cost)
create a new summary type 4 LSA for this area and return it. This method works similar to "createSummary3LSA()".

Parameters:
ipAddress - int value, representing the ip address of the destination router.
cost - int value, indicating the OSPF cost of the shortest path to the destination router.
Returns:
LSA Object containing a summary LSA of type 4.

removeSummaryLSA

public void removeSummaryLSA(byte type,
                             java.lang.Object destKey)
Remove a selforiginated Summary-LSA from the LS Database. This is done by premature aging the LSA if it exists, otherwise nothing is done.

Parameters:
type - byte value indicating a type 3 or 4 LSA.
destKey - Object (MUST be String in case of type 3 LSA, Integer in case of type 4) indicating the destination id.

installSelfOrigLSA

public void installSelfOrigLSA(LSA soLSA)
Try to install a self-originated LSA and if the installation process was successful, flood it out some appropriate interfaces.

Parameters:
soLSA - self-originated LSA to install.

advanceSeqNumOf

public void advanceSeqNumOf(LSA advLSA)
Method called by "Neighbor.processReceivedLSA() in case of receiving a selforiginated LSA newer than the one stored in the Database. This method implements most of chapter 13.4 of RFC 2328.

Parameters:
advLSA - The received selforiginated LSA.

floodLSA

public void floodLSA(LSA lsa,
                     int neighborID)
Flood an LSA out some set of the router's interfaces. This is the implementation of chapter 13.3 of RFC 2328.

Parameters:
lsa - LSA that must be flooded out some interfaces.
neighborID - int value, identifying the neighbor from whom the LSA was received.

getLSAHeaders

public java.util.Vector getLSAHeaders()
Return a Vector containing all LSA-Headers currently stored in the LS Database. This method is used by a Neighbor Data Structure to gain access to the LSAs of its Area. This is necessary to fill the Database Summary List of the Neighbor Structure calling this method when going in state EXCHANGE.


shouldRequest

public boolean shouldRequest(LSA lsa)
Take an LSA Header and determine whether the associated body should be requested or not. Return true if the LSA must be requested else false.


getLSA

public LSA getLSA(java.lang.String key)
Determine whether a particular LSA is stored in the database belonging to this Area Data Structure. If it does, return a copy of this LSA, otherwise return null.

Parameters:
key - String representing the unique identifier of an LSA. (see LSA.getKey).
Returns:
LSA containing the desired LSA or null if the LSA could not be found.

installReceivedLSA

public boolean installReceivedLSA(LSA instLSA,
                                  int neighborID)
Install a new received LSA in the database and return true if installation was successful, otherwise false. LSAs installed here are never selforiginated! If an LSA is installed successfully, the flooding process is started for it.

Parameters:
instLSA - an LSA received during database exchange or flooding.
neighborID - int value, identifying the neighbor who sent the LSA.
Returns:
boolean value indicating the success of the installation.

hasInstanceOf

public boolean hasInstanceOf(LSA testLSA)
Check whether an instance of the given LSA exists in the database belonging to this Area, and if so return true else false.


testInstanceOf

public boolean testInstanceOf(LSA testLSA,
                              java.lang.String test)
Check whether an IDENTICAL/MORE RECENT/LESS RECENT instance of the given LSA exists in the database belonging to this Area, and if so return true else false.

Parameters:
testLSA - holds the LSA which is compared with the database copy if existing
test - holds expected result-String of isNewerThan test. Return true, if the test was positiv false otherwise.

lsaIsWrapping

public boolean lsaIsWrapping(LSA testLSA)
Check whether the sequence number of a particular LSA is wrapping and return true if so, else false.


noNeighborInDataExProcess

public boolean noNeighborInDataExProcess()
Check all Neighbors belonging to this Area whether they are in state EXCHANGE or LOADING. Return false if there is at least one, else return true. This Method is used by "processReceivedLSA()" in the Neighbor class.

Returns:
boolean indicating that there is no Neighbor in Database Exchange.

canBeRemovedFromDatabase

public boolean canBeRemovedFromDatabase(LSA maxAgeLSA)
Check whether none of the router's Neighbors are in states Exchange or Loading, and maxAgeLSA is no longer contained on any Neighbor's Link State Retransmission List. In this case maxAgeLSA can be removed from the database, and the method returns true. This method is used by LSDatabase when aging the LSAs in method "ageAndCheckLSAs".


clearLSAFromRetrLists

public void clearLSAFromRetrLists(java.lang.String oldLSAKey)
removes a particular LSA from every Neighbor Data Structures link state retransmission list whose represented Neighbor is adjacent to this area.


compareIPAddrWith

public boolean compareIPAddrWith(int id)
Check whether one of the Ip Interface Addresses of this Area is equal to id and return true if so, else false. This method is used by class OSPF in method isSelforiginated.


receivedPacket

public boolean receivedPacket(Packet pkt,
                              java.lang.Integer sourceIP,
                              java.lang.Integer destIP)
                       throws ProtocolException
After the generic input processing of an OSPF Packet was done by the OSPF session above, this method will further process the Packet destined for this Area. It returns false if further checks fail otherwise true.

ProtocolException

calculateDijkstraPartI

public java.util.HashMap calculateDijkstraPartI()
Calculate the first stage of Dijkstra. Return a HashMap holding the RouterEntries for all area border routers connected to this area.

Returns:
HashMap holding RouterEntries in form of Integer-RouterEntry mappings.

calculateDijkstraPartII

public java.util.HashMap calculateDijkstraPartII()
Calculate the second stage of Dijkstra. Return a HashMap holding the routing table entrys for all stub networks.

Returns:
HashMap holding all NetworkEntries in form of String-NetworkEntry mappings.

printConfiguration

public void printConfiguration()
print current configuration of the area if necessary. That means if configuration has changed since last print and one of the following ospf options are set: "show_area", "show_config", "show_all".


databaseDebugInfo

public void databaseDebugInfo()
check whether debug switches for LS database debugging are enabled and the content of the database has changed. If so, print out an excerpt of the area's LS database.