gov.nist.antd.merlin.protocol.discovery
Class OptNeighbour

java.lang.Object
  |
  +--SSF.OS.ProtocolSession
        |
        +--gov.nist.antd.merlin.util.AbstractAddDropConfigurator
              |
              +--gov.nist.antd.merlin.util.AutoConfigCtrl
                    |
                    +--gov.nist.antd.merlin.protocol.discovery.OptNeighbour
All Implemented Interfaces:
com.renesys.raceway.DML.Configurable, DMLDump

public class OptNeighbour
extends AutoConfigCtrl

This class implements a neighbour discovery. This protocol extends the DML setting of the class AutoConfigCtrl.class and adds the following DML attribute to the setup:

ProtocolSession[ ... DEBUG # Enables debug information for this protocol in each # node it is installed in. debug # Enables debug information for this protocol only in # this node. initTime # The time the protocol needs to initialize before it # starts the discovery process. The default time value # is 0.01 seconds. ]

This class was developed at the National Institute of Standards and Technology by employees of the Federal Government in the course of their official duties. Pursuant to title 17 Section 105 of the United States Code this software is not subject to copyright protection and is in the public domain. NIST assumes no responsibility whatsoever for its use by other parties, and makes no guarantees, expressed or implied, about its quality, reliability, or any other characteristic.
We would appreciate acknowledgement if the software is used.
NIST ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.

Version:
1.4

 VERSION CONTROL
 -----------------------------------------------------------------------------
 Name     - YYYY/MM/DD - VERSION - ACTION
 rouil    - 2001/10/05 - 1.0     - Source created.
 rouil    - 2002/01/31 - 1.1     - Changed class name.
 rouil    - 2002/09/25 - 1.2     - Changed ID to NHI to identify node.
 rouil    - 2002/10/01 - 1.3     - Set the delay before sending messages to 
                                   0.1s.
 borchert - 2002/12/01 - 1.4     - Added configurable initialization time.
                                 - Added configurable debug mode.
                                 - Added failure handling and error reports 
                                   by unseccesful execution of methods.
                                 - Added method void debug(String).
                                 - Added method void printTable().
 borchert - 2002/12/11           - Set timestamp for new created OFH.
                                 - Added method getInitTime().
                                 - Added method get getTable().
 

Author:
borchert
, rouil

Field Summary
private  boolean debug
          Indicates if this instance produces debug information.
static boolean DEBUG
          Indicates if each instance of this protocol produces debug information.
private  double initTime
          Initialisation time in seconds.
 java.util.Vector messages
          The vector that contains the message forwarded.
static java.lang.String SESSION_NAME
          The name (oxcswitch) of this protocolsession in the network.
 NeighbourTable table
          The neighbor table
 
Fields inherited from class gov.nist.antd.merlin.util.AbstractAddDropConfigurator
addLambdaIDs, dropLambdaIDs, manuallyConfigured
 
Fields inherited from class SSF.OS.ProtocolSession
name, use
 
Constructor Summary
OptNeighbour()
          Default constructor.
 
Method Summary
 void addIDRESP(OpticalFrameHeader message)
          Add an entry in the neighbours table.
 void config(com.renesys.raceway.DML.Configuration cfg)
          Configuration
protected  void debug(java.lang.String text)
          prints the given text to the output screen when debug is enabled.
 void forwardIDRESP(OpticalFrameHeader message)
          Forward an IDRESP to all neighbours.
 double getInitTime()
          Returns the initialization time.
 java.lang.String getTable()
          Returns the neighbour table as String.
 void init()
          Initialization routine, called by the ProtocolGraph after instantiation.
 boolean isInVector(NeighbourHeader message)
          Check if the message is in the vector of messages
 void printTable()
          Prints the internal forwarding table.
 boolean push(ProtocolMessage message, ProtocolSession fromSession)
          Push method to send and receive messages.
 void sendIDRESP(OpticalFrameHeader inMessage)
          Send an IDRESP to all neighbours.
 void sendIDSIG()
          Neighbour discovery after the init or after a node is recovered.
 
Methods inherited from class gov.nist.antd.merlin.util.AutoConfigCtrl
 
Methods inherited from class gov.nist.antd.merlin.util.AbstractAddDropConfigurator
configAddDrop, getAddLambdaIDs, getDropLambdaIDs, isManuallyConfigured, toDML
 
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

SESSION_NAME

public static final java.lang.String SESSION_NAME
The name (oxcswitch) of this protocolsession in the network.

See Also:
Constant Field Values

DEBUG

public static boolean DEBUG
Indicates if each instance of this protocol produces debug information.


debug

private boolean debug
Indicates if this instance produces debug information.


initTime

private double initTime
Initialisation time in seconds. (Default 0.01s)


table

public NeighbourTable table
The neighbor table


messages

public java.util.Vector messages
The vector that contains the message forwarded.

Constructor Detail

OptNeighbour

public OptNeighbour()
Default constructor.

Method Detail

config

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

Specified by:
config in interface com.renesys.raceway.DML.Configurable
Overrides:
config in class AbstractAddDropConfigurator
Parameters:
cfg - The DML configuration
Throws:
if - a configuration error occurs
com.renesys.raceway.DML.configException

init

public void init()
          throws ProtocolException
Initialization routine, called by the ProtocolGraph after instantiation. The order of initialization of a set of protocols is unspecified, so other methods (like open()) may be called before init(). Resources (like connection tables) that may be needed by open() should therefore be created in the ProtocolSession constructor.

Overrides:
init in class AutoConfigCtrl
Throws:
ProtocolException - if an error occured.

push

public boolean push(ProtocolMessage message,
                    ProtocolSession fromSession)
             throws ProtocolException
Push method to send and receive messages.

Specified by:
push in class ProtocolSession
Parameters:
message - The message received.
fromSession - The protocol session which sent the message.
Returns:
True if the message is pushed. False if it is dropped.
Throws:
ProtocolException - If a protocol session exception occurs.

sendIDSIG

public void sendIDSIG()
Neighbour discovery after the init or after a node is recovered. Send an IDSIG through the fibers.


sendIDRESP

public void sendIDRESP(OpticalFrameHeader inMessage)
Send an IDRESP to all neighbours.

Parameters:
inMessage - The Optical Frameheader that contains the received IDSIG message.

addIDRESP

public void addIDRESP(OpticalFrameHeader message)
Add an entry in the neighbours table.

Parameters:
message - The IDRESP received

forwardIDRESP

public void forwardIDRESP(OpticalFrameHeader message)
Forward an IDRESP to all neighbours.

Parameters:
message - The IDSIG received

isInVector

public boolean isInVector(NeighbourHeader message)
Check if the message is in the vector of messages

Parameters:
message - The message to test if already treated.
Returns:
True if message already treated.

debug

protected void debug(java.lang.String text)
prints the given text to the output screen when debug is enabled.

Parameters:
text - The text that has to be printed out.
Since:
1.4

printTable

public void printTable()
Prints the internal forwarding table.

Since:
1.4

getInitTime

public double getInitTime()
Returns the initialization time.

Returns:
The initialization time.
Since:
1.4.1

getTable

public java.lang.String getTable()
Returns the neighbour table as String.

Returns:
Returns the neighbour table as String.
Since:
1.4.1