gov.nist.antd.optical
Class OXCSwitch

java.lang.Object
  |
  +--SSF.OS.ProtocolSession
        |
        +--gov.nist.antd.optical.OXCSwitch
All Implemented Interfaces:
AddDropConfiguration, com.renesys.raceway.DML.Configurable, DMLDump

public final class OXCSwitch
extends ProtocolSession
implements AddDropConfiguration, com.renesys.raceway.DML.Configurable, DMLDump

This class implements switching capabilities for OXC's.

 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.

Author:
borchert
, rouil

Field Summary
private  java.util.Hashtable addDropLambdas
          This hashtable contains the add drop lambdas.
private  boolean autoCreateAddDrop
          This flag is used for the autocreation of the add drop lambda
private  int concatType
          Concatenation type of this ExtRouter.
private  boolean debug
          Indicates if debug information are displayed.
private  int hostID
          The id of the assigned host.
static int INTERFACE_SET_STARTING_SIZE
          The initial size of the interface set (interfaceSet).
private  int interfaceCount
          Number of interfaces used by this controller.
private  ONIC[] interfaceSet
          The interfaces used by this controller.
static int NO_CONCATENATION
          Value of the concatenation type.
private  int noConverters
          Number of available converters in this switch.
private  int noUsedAddLambdas
          Keeps track about the used add lambdas.
private  int noUsedConverters
          Number of used converters in this switch.
private  int noUsedDropLambdas
          Keeps track about the used drop lambdas.
static java.lang.String SESSION_NAME
          The name (oxcswitch) of this protocolsession in the network.
static int STANDARD_CONCATENATION
          Value of the concatenation type.
private  SwitchingTable switchingTable
          The used switching table that stores connection information.
static int VIRTUAL_CONCATENATION
          Value of the concatenation type.
 
Fields inherited from class SSF.OS.ProtocolSession
name, use
 
Constructor Summary
OXCSwitch()
          Default constructor.
 
Method Summary
 void config(com.renesys.raceway.DML.Configuration cfg)
          Configure the OXC switch.
 void connect(Fiber inFiber, Fiber outFiber)
          Try to connect the input fiber to the output fiber.
 void connect(Lambda inLambda, Lambda outLambda)
          Try to connect the input lambda to the output lambda.
 void connectAddPort(int addDropLambdaID, int onicID, int fiberID, int lambdaID)
          Command sent from the router to the OXC switching requesting that it crossconnects the virtual input lambda to output lambda (add port).
 void connectDropPort(int addDropLambdaID, int onicID, int fiberID, int lambdaID)
          Command sent from the router to the OXC switching requesting that it crossconnect input lambda to the virtual output lambda (drop port).
 int createNewAddDropLambda()
          Creates a new AddDropLambda.
private  void decUsedConverters()
          Decreases the number of used converters.
 boolean deleteAddDropLambda(int id)
          Request the deletion of the specified add-drop-lambda.
 void disconnect(Fiber fiber)
          Disconnects the lambdas inside the fiber.
 void disconnect(Lambda lambda)
          Disconnects the lambda with from the corresponding lambda.
 void disconnectAddPort(int addDropLambdaID)
          Command sent from the upper layer to the OXC switching requesting that it disconnects the add port.
 void disconnectDropPort(int addDropLambdaID)
          Command sent from the upper layer to the OXC switching requesting that it disconnects the virtual input lambda from the connected input lambda.
protected  void drop(java.lang.String message)
          Method called when OXC switch drops a packet.
 int[] getAddDropIDs()
          Gets all add-drop-lambda port ids.
 AddDropLambda getAddDropLambda(int id)
          Determines the AddDropLambda and returns it.
 ONIC getAttachedONIC(int onicID)
          Find an ONIC from its ID
 ONIC getAttachedOnicFromIP(int onicIP)
          Find an ONIC from its IP adress
 ONIC[] getAttachedONICs()
          Get the attached ONICs
 int getConcatType()
          Get the concatenation type for this OXCSwitch.
 int[][] getConnectionsInfo()
          Get the lambdas' ID that are used in the connections.
private  int getHostID()
          Determines the host id.
 int getNoConverters()
          Determine the number of converters in the switch.
 int getNoONICs()
          Number of ONIC that belong the OXC switch.
 java.util.Vector getNotUsedAddLambdas()
          Get the list of free addLambdas
 java.util.Vector getNotUsedDropLambdas()
          Get the list of free dropLambdas
 int getNoUsedAddLambdas()
          Number of lambdas at add port.
 int getNoUsedConverters()
          Determine the number of used converters.
 int getNoUsedDropLambdas()
          Number of lambdas at drop port.
 int[] getUsedAddIDs()
          Get the id's of the add lambdas.
 java.util.Vector getUsedAddLambdas()
          Get the list of lambdas at the Add port.
 int[] getUsedDropIDs()
          Get the id's of the drop lambdas.
 java.util.Vector getUsedDropLambdas()
          Get the list of lambdas at Drop port.
private  void incUsedConverters()
          Increases the number of used converters.
 void init()
          Initialization routine, called by the ProtocolGraph after instantiation.
 boolean isConnected(Lambda lambda)
          Determines if the lambda is connected or not.
 boolean isConverter()
          Determines if the switch has the capability to convert lambdas.
 boolean isConverterAvailable()
          Check if there is a converter available
 boolean isDebug()
          Return if the debug information must be displayed.
 void opened(ProtocolSession onic)
          Add a new opened ONIC to the interfaceSet.
 boolean push(ProtocolMessage message, ProtocolSession fromSession)
          Push the message to the good protocol session.
private  boolean pushDown(ProtocolMessage message, ProtocolSession fromSession)
          Push the message to the good protocol session.
private  boolean pushFromONIC(ProtocolMessage message, ProtocolSession fromSession)
          pushes the message up or back down depending on the entry of the table.
 void removeConversion()
          Remove all the connections that use lambda conversion
 void removeONIC(ONIC onic)
          Remove the given onic
 void setConcatType(int newType)
          Defines the concatenation capability of the OXCSwitch.
 void setDebug(boolean value)
          Set the attribute debug
 void setGraph(ProtocolGraph graph)
          Set the protocol graph in which this session is configured.
 void setNoConverters(int noConv)
          Set the number of converters.
 java.lang.String toDML()
          Return a String with the options of this protocolSession does not include noConverters if infinite (default value)
 java.lang.String toString()
          The textual representation of this switch.
 
Methods inherited from class SSF.OS.ProtocolSession
close, closed, debugIdentifier, inGraph, open, pushAfterDelay, pushAfterDelayFailed, version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INTERFACE_SET_STARTING_SIZE

public static final int INTERFACE_SET_STARTING_SIZE
The initial size of the interface set (interfaceSet).

See Also:
Constant Field Values

SESSION_NAME

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

See Also:
Constant Field Values

NO_CONCATENATION

public static final int NO_CONCATENATION
Value of the concatenation type. It means that the ExtRouter does not provide waveband switching capability.

See Also:
Constant Field Values

STANDARD_CONCATENATION

public static final int STANDARD_CONCATENATION
Value of the concatenation type. It means that theExtRouter provides waveband switching capability. The lambda's must be contiguous.

See Also:
Constant Field Values

VIRTUAL_CONCATENATION

public static final int VIRTUAL_CONCATENATION
Value of the concatenation type. It means that the ExtRouter provides waveband switching capability. The lambda's do not need to be contiguous.

See Also:
Constant Field Values

concatType

private int concatType
Concatenation type of this ExtRouter. (Default: ExtRouter.NO_CONCATENATION)


hostID

private int hostID
The id of the assigned host.


interfaceCount

private int interfaceCount
Number of interfaces used by this controller.


autoCreateAddDrop

private boolean autoCreateAddDrop
This flag is used for the autocreation of the add drop lambda


noConverters

private int noConverters
Number of available converters in this switch.


noUsedConverters

private int noUsedConverters
Number of used converters in this switch.


noUsedAddLambdas

private int noUsedAddLambdas
Keeps track about the used add lambdas.


noUsedDropLambdas

private int noUsedDropLambdas
Keeps track about the used drop lambdas.


debug

private boolean debug
Indicates if debug information are displayed.


switchingTable

private SwitchingTable switchingTable
The used switching table that stores connection information.


interfaceSet

private ONIC[] interfaceSet
The interfaces used by this controller.


addDropLambdas

private java.util.Hashtable addDropLambdas
This hashtable contains the add drop lambdas.

Constructor Detail

OXCSwitch

public OXCSwitch()
Default constructor.

Method Detail

config

public void config(com.renesys.raceway.DML.Configuration cfg)
            throws com.renesys.raceway.DML.configException
Configure the OXC switch.

Specified by:
config in interface com.renesys.raceway.DML.Configurable
Overrides:
config in class ProtocolSession
Parameters:
cfg - configuration
Throws:
com.renesys.raceway.DML.configException - when a configuration exception occurs.

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 ProtocolSession
ProtocolException

connect

public void connect(Lambda inLambda,
                    Lambda outLambda)
             throws InvalidConnectionException
Try to connect the input lambda to the output lambda.

Parameters:
inLambda - The input lambda.
outLambda - The output lambda.
Throws:
InvalidConnectionException - if parameters are invalid.

connect

public void connect(Fiber inFiber,
                    Fiber outFiber)
             throws InvalidConnectionException
Try to connect the input fiber to the output fiber.

Parameters:
inFiber - The input fiber.
outFiber - The output fiber.
Throws:
InvalidConnectionException - if parameters are invalid.

connectAddPort

public void connectAddPort(int addDropLambdaID,
                           int onicID,
                           int fiberID,
                           int lambdaID)
                    throws InvalidConnectionException
Command sent from the router to the OXC switching requesting that it crossconnects the virtual input lambda to output lambda (add port).

Parameters:
addDropLambdaID - The id of the ADD lambda.
onicID - The onic of the lambda that has to be assigned as addLambda.
fiberID - The fiber of the lambda that has to be assigned as addLambda.
lambdaID - The id of the lambda.
Throws:
InvalidConnectionException - if parameters are invalid.

connectDropPort

public void connectDropPort(int addDropLambdaID,
                            int onicID,
                            int fiberID,
                            int lambdaID)
                     throws InvalidConnectionException
Command sent from the router to the OXC switching requesting that it crossconnect input lambda to the virtual output lambda (drop port).

Parameters:
addDropLambdaID - The id of the DROP lambda.
onicID - The onic of the lambda that has to be assigned as dropLambda.
fiberID - The fiber of the lambda that has to be assigned as dropLambda.
lambdaID - The id of the lambda.
Throws:
InvalidConnectionException - if parameters are invalid.

disconnect

public void disconnect(Lambda lambda)
Disconnects the lambda with from the corresponding lambda.

Parameters:
lambda - the Lambda that has to be disconnected.
Since:
2.1

disconnect

public void disconnect(Fiber fiber)
Disconnects the lambdas inside the fiber.

Parameters:
fiber - The Fiber that has to be disconnected.

disconnectAddPort

public void disconnectAddPort(int addDropLambdaID)
                       throws InvalidConnectionException
Command sent from the upper layer to the OXC switching requesting that it disconnects the add port.

Parameters:
addDropLambdaID - the id if the add/drop lambda.
Throws:
InvalidConnectionException - if parameters are invalid.

disconnectDropPort

public void disconnectDropPort(int addDropLambdaID)
                        throws InvalidConnectionException
Command sent from the upper layer to the OXC switching requesting that it disconnects the virtual input lambda from the connected input lambda.

Parameters:
addDropLambdaID - The id of the add/drop lambda port.
Throws:
InvalidConnectionException - The addDropLambdaID is not a drop lambda.

getAttachedONIC

public ONIC getAttachedONIC(int onicID)
Find an ONIC from its ID

Parameters:
onicID - The id of the ONIC.
Returns:
The ONIC or null if it doesn't exist.

getAttachedONICs

public ONIC[] getAttachedONICs()
Get the attached ONICs

Returns:
The ONICs or null if it doesn't exist.

getAttachedOnicFromIP

public ONIC getAttachedOnicFromIP(int onicIP)
Find an ONIC from its IP adress

Parameters:
onicIP - The ip of the ONIC.
Returns:
The ONIC or null if it doesn't exist.

getNoONICs

public int getNoONICs()
Number of ONIC that belong the OXC switch.

Returns:
The number of ONICs.

getHostID

private int getHostID()
Determines the host id.

Returns:
the host id or -1.

getUsedDropLambdas

public java.util.Vector getUsedDropLambdas()
Get the list of lambdas at Drop port.

Returns:
The list of the drop lambdas or null.

getNotUsedDropLambdas

public java.util.Vector getNotUsedDropLambdas()
Get the list of free dropLambdas

Returns:
the vector of free dropLambdas

getUsedAddLambdas

public java.util.Vector getUsedAddLambdas()
Get the list of lambdas at the Add port.

Returns:
The list of the add lambdas or Null.

getNotUsedAddLambdas

public java.util.Vector getNotUsedAddLambdas()
Get the list of free addLambdas

Returns:
the vector of free addLambdas

getConnectionsInfo

public int[][] getConnectionsInfo()
Get the lambdas' ID that are used in the connections.

Returns:
The matrix of the connections.

isConverterAvailable

public boolean isConverterAvailable()
Check if there is a converter available

Returns:
True if there is a converter available

getNoConverters

public int getNoConverters()
Determine the number of converters in the switch.

Returns:
The number of converters.

getNoUsedConverters

public int getNoUsedConverters()
Determine the number of used converters.

Returns:
The number of used converters..

isConverter

public boolean isConverter()
Determines if the switch has the capability to convert lambdas.

Returns:
True if the switch has converter capabilities.

incUsedConverters

private final void incUsedConverters()
Increases the number of used converters.


decUsedConverters

private final void decUsedConverters()
Decreases the number of used converters.


setDebug

public void setDebug(boolean value)
Set the attribute debug

Parameters:
value - The value for the attribute debug

isDebug

public boolean isDebug()
Return if the debug information must be displayed.

Returns:
true if the information must be displayed.

isConnected

public boolean isConnected(Lambda lambda)
Determines if the lambda is connected or not.

Parameters:
lambda - the lambda that has to be checked.
Returns:
true if the lambda is connected, otherwise false.
Since:
2.1

removeConversion

public void removeConversion()
Remove all the connections that use lambda conversion


setConcatType

public void setConcatType(int newType)
Defines the concatenation capability of the OXCSwitch.

Parameters:
newType - The concatenation type.

getConcatType

public int getConcatType()
Get the concatenation type for this OXCSwitch.

Returns:
concatType.

opened

public void opened(ProtocolSession onic)
            throws ProtocolException
Add a new opened ONIC to the interfaceSet.

Overrides:
opened in class ProtocolSession
Parameters:
onic - The new ONIC opened.
Throws:
ProtocolException - If an exception occurs.

drop

protected void drop(java.lang.String message)
Method called when OXC switch drops a packet.

Parameters:
message - The message header.

push

public boolean push(ProtocolMessage message,
                    ProtocolSession fromSession)
             throws ProtocolException
Push the message to the good protocol session.

Specified by:
push in class ProtocolSession
Parameters:
message - The OpticalFrameHeader-message that has to be pushed.
fromSession - The ProtocolSession that calls this push method.
Returns:
true if the method succeeded.
Throws:
ProtocolException - The message has the wrong format.

pushFromONIC

private boolean pushFromONIC(ProtocolMessage message,
                             ProtocolSession fromSession)
                      throws ProtocolException
pushes the message up or back down depending on the entry of the table.

Parameters:
message - The OpticalFrameHeader messgae.
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.

pushDown

private boolean pushDown(ProtocolMessage message,
                         ProtocolSession fromSession)
                  throws ProtocolException
Push the message to the good protocol session.

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.

removeONIC

public void removeONIC(ONIC onic)
Remove the given onic

Parameters:
onic - The ONIC to remove
Throws:
IllegalDataException - if the onic does not belong to this host.

createNewAddDropLambda

public int createNewAddDropLambda()
Creates a new AddDropLambda.

Returns:
the id of the new AddDropLambda.

deleteAddDropLambda

public boolean deleteAddDropLambda(int id)
Request the deletion of the specified add-drop-lambda.

Parameters:
id - The id of this lambda.
Returns:
true if the AddDropLambda could be removed.

getAddDropLambda

public AddDropLambda getAddDropLambda(int id)
Determines the AddDropLambda and returns it.

Parameters:
id - The id of the AddDropLambda.
Returns:
the AddDRopLambda or null if it does not exist.

toDML

public java.lang.String toDML()
Return a String with the options of this protocolSession does not include noConverters if infinite (default value)

Specified by:
toDML in interface DMLDump
Returns:
The DML part of the options

setGraph

public void setGraph(ProtocolGraph graph)
              throws ProtocolException
Set the protocol graph in which this session is configured.

Overrides:
setGraph in class ProtocolSession
Parameters:
graph - The ExtRouter that is attached to this ProtocolSession.
Throws:
ProtocolException - if the session is already configured in a protocol graph

toString

public java.lang.String toString()
The textual representation of this switch.

Overrides:
toString in class java.lang.Object
Returns:
the switch string.

getAddDropIDs

public int[] getAddDropIDs()
Gets all add-drop-lambda port ids.

Specified by:
getAddDropIDs in interface AddDropConfiguration
Returns:
an array containing the ids.

getUsedAddIDs

public int[] getUsedAddIDs()
Get the id's of the add lambdas.

Specified by:
getUsedAddIDs in interface AddDropConfiguration
Returns:
The identifier list of the lambdas at Add port.

getUsedDropIDs

public int[] getUsedDropIDs()
Get the id's of the drop lambdas.

Specified by:
getUsedDropIDs in interface AddDropConfiguration
Returns:
The identifier list of the lambdas.

getNoUsedAddLambdas

public int getNoUsedAddLambdas()
Number of lambdas at add port.

Specified by:
getNoUsedAddLambdas in interface AddDropConfiguration
Returns:
The number.

getNoUsedDropLambdas

public int getNoUsedDropLambdas()
Number of lambdas at drop port.

Specified by:
getNoUsedDropLambdas in interface AddDropConfiguration
Returns:
The number.

setNoConverters

public void setNoConverters(int noConv)
Set the number of converters. Check if the value is valid

Parameters:
noConv - The new number of converter