gov.nist.antd.optical.path
Class OpticalConnection

java.lang.Object
  |
  +--gov.nist.antd.optical.AbstractObject
        |
        +--gov.nist.antd.optical.path.OpticalConnection

public class OpticalConnection
extends AbstractObject

This is an end-to-end connection. The route contains the source and the destination node and the used optical path.

 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:
3.2

 VERSION CONTROL
-------------------------------------------------------------------------
Name - YYYY/MM/DD - VERSION - ACTION
borchert - 2001/05/29 - 1.0 - Source created
borchert - 2001/09/27 - 1.1 - Add CHANGE event in setOpticalPath
borchert - 2001/10/18 - 2.0 - configure the switches by registering the route. - Add isConfigured() - Add useAddDropPort () - Add rerouteStart (Lambda) - Add rerouteEnd (Lambda) borchert - 2001/11/21 - 2.1 - Added the type of protection. rouil - 2002/01/28 - 2.2 - Modify registration management. borchert - 2002/06/06 - 3.0 - Changed class name to OpticalConnection. - Marked method isRouteOf as deprecated. - Added method isConnectionBetween. rouil - 2002/06/18 - 3.01- Added method getUsedRoute rouil - 2002/06/20 - 3.1 - Changed OXCEdgeRouter to ExtRouter. rouil - 2002/07/09 - - Fixed bug in the TEventObject created rouil - 2002/07/16 - - Updated call to deprecated methods rouil - 2002/09/25 - 3.2 - Deprecated createRouteFromLinks(linkid[]) Added createRouteFromLinks(String[] linkNhi). Same modification for createRouteFromNodes.

Author:
borchert
, rouil

Field Summary
private  OpticalConnection backup
          The backup route to this route.
private  ExtRouter destination
          The destination node of the route.
private  int id
          The id of this route.
private  int noRoutes
          The number of possible routes
private  ProtocolSession owner
          The Protocol Session that is registered to this route.
private  OpticalPath path
          The light path that of the route.
private  java.util.Vector protectionFor
          Stores workingpath or Optical links that has to be protected by this Route.
private  QualityOfService qos
          The QoS of the route.
private  java.util.Vector[] routes
          The array of vectors that contain the links for possible routes
private  ExtRouter source
          The source node of the route.
 
Fields inherited from class gov.nist.antd.optical.AbstractObject
INITIAL_ARRAY_SIZE
 
Constructor Summary
OpticalConnection()
          Creates an optical route.
 
Method Summary
 void addProtectionFor(java.lang.Object obj)
          This method checks if the protected object is a link or path(route).
 void addRoute(java.util.Vector route)
          Add the route to the array of routes.
 void addRouteFromLinkList(int[] linkIDs)
          Deprecated. Use addRouteFromLinkList(String linksNhi)
 void addRouteFromLinkList(java.lang.String[] linksNhi)
          Add the route represented by a list of optical links Nhi.
 void addRouteFromLinkList(java.util.Vector linkList)
          Add the route represented by a list of optical links.
 void addRouteFromNodeList(int[] nodeIDs)
          Deprecated. Use addRouteFromNodeList(String nodesNhi)
 void addRouteFromNodeList(java.lang.String[] nodesNhi)
          Add the route represented by a list of nodes Nhi.
 void addRouteFromNodeList(java.util.Vector nodeList)
          Add the route represented by a list of nodes.
protected  java.lang.Object[] createArray(int size)
          Creates a route array of the specified size.
 void finalize()
          Reset the path if necessary.
 OpticalConnection getBackupRoute()
          Determins the backupRoute for this route.
 double getBandWidth(java.util.Vector route, boolean available)
          Gets the minimum bandwidth for data transfer for this Route.
 ExtRouter getDestination()
          Returns the destination Router node.
 double getDistance(java.util.Vector route)
          Gets the distance of this route
 int getID()
          Return the id of this optical route.
 int getNoRoutes()
          Get the number of routes
 OpticalPath getOpticalPath()
          Returns the optical path connection used for this route.
 ProtocolSession getOwner()
          Return the owner
 java.util.Vector getProtectionFor()
          Return a copy of the Vector of the protected objects
 QualityOfService getQoS()
          Returns the Quality of Service.
 java.util.Vector[] getRoutes()
          Get the array of routes
 ExtRouter getSource()
          Returns the source Router node.
 java.util.Vector getUsedRoute()
          Get the used route.
 boolean isAvailable()
          Return if this route is owned by a ProtocolSession
 boolean isConfigured()
          Determines if the route is completely configured.
 boolean isConnectionBetween(ExtRouter src, ExtRouter dest)
          Determines if the connection is the two nodes with direction source to destination.
 boolean isLinkProtection()
          Returns true if this route is a backup for links or not.
 boolean isPathFailed()
          Check if the path is failed
 boolean isPathProtection()
          Returns true if this route is a backup for route(s) or not.
 boolean isProtection()
          Returns if this route is a backup route or not.
 boolean isRouteOf(ExtRouter src, ExtRouter dest)
          Deprecated. use method isConnectionBetween() instead.
 boolean register(ProtocolSession srcSession)
          Register a ProtocolSession to own this route
 void reRouteEnd(Lambda outLambda, OpticalChannel channel)
          Reroutes the ending lambda.
 void reRouteStart(Lambda inLambda, OpticalChannel channel)
          Reroutes the starting lambda.
 void resetRoutes()
          reset the possible routes
 void setBackupRoute(OpticalConnection backup)
          Set the backup route for this route.
 void setDestination(ExtRouter destinationNode)
          Set the destination node.
 void setID(int newID)
          Set the optical route's id.
protected  void setNoElements(int size)
          Set the number of routes.
 void setOpticalPath(OpticalPath newPath)
          Set the optical path connection used for this route.
 void setQoS(QualityOfService newQos)
          Set the Quality of Service.
 void setSource(ExtRouter sourceNode)
          Set the source node.
 java.lang.String toString()
          Returns the string representation of this route.
 boolean unregister(ProtocolSession session)
          Unregister a ProtocolSession to free this route.
 
Methods inherited from class gov.nist.antd.optical.AbstractObject
addElement, clear, isElementOf, removeElement
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

private int id
The id of this route. This id is systemwide unique.


noRoutes

private int noRoutes
The number of possible routes


protectionFor

private java.util.Vector protectionFor
Stores workingpath or Optical links that has to be protected by this Route. This Vector only stores links or routes, not both.


path

private OpticalPath path
The light path that of the route.


source

private ExtRouter source
The source node of the route.


destination

private ExtRouter destination
The destination node of the route.


backup

private OpticalConnection backup
The backup route to this route.


qos

private QualityOfService qos
The QoS of the route.


owner

private ProtocolSession owner
The Protocol Session that is registered to this route.


routes

private java.util.Vector[] routes
The array of vectors that contain the links for possible routes

Constructor Detail

OpticalConnection

public OpticalConnection()
Creates an optical route.

Method Detail

getRoutes

public java.util.Vector[] getRoutes()
Get the array of routes

Returns:
A copy of the possible routes.

getUsedRoute

public java.util.Vector getUsedRoute()
Get the used route. We use PtPBundle because a path may use 2 differents links between 2 nodes for different channels.

Returns:
A Vector of PtPBundle that represents the links used for the path
Since:
3.01

getNoRoutes

public int getNoRoutes()
Get the number of routes

Returns:
The number of routes computed.

getQoS

public QualityOfService getQoS()
Returns the Quality of Service.

Returns:
the QoS.

isAvailable

public boolean isAvailable()
Return if this route is owned by a ProtocolSession

Returns:
True if the route is available

getOwner

public ProtocolSession getOwner()
Return the owner

Returns:
The owner

getDestination

public ExtRouter getDestination()
Returns the destination Router node.

Returns:
the destination Router.

getID

public int getID()
Return the id of this optical route.

Returns:
The id.

getOpticalPath

public OpticalPath getOpticalPath()
Returns the optical path connection used for this route.

Returns:
The optical path connection or null.

getSource

public ExtRouter getSource()
Returns the source Router node.

Returns:
the source Router or null.

getBandWidth

public double getBandWidth(java.util.Vector route,
                           boolean available)
Gets the minimum bandwidth for data transfer for this Route. The minimum bandwith is the minimal result of a bundle.
link(max,avail): 1(10,7.5) 2(5,2.5)
Depending on the bandwidth type (see FIBER)

Parameters:
route - the route whose bandwidth is wanted.
available - If true the maximal available bandwith will be calculated; otherwise the maximal available bandwidth.
Returns:
the minimum bandwidth of the route.

getDistance

public double getDistance(java.util.Vector route)
Gets the distance of this route

Parameters:
route - the route whose distance is wanted
Returns:
the distance

isProtection

public boolean isProtection()
Returns if this route is a backup route or not.

Returns:
true if the route is a backup route; otherwise false.

isLinkProtection

public boolean isLinkProtection()
Returns true if this route is a backup for links or not.

Returns:
true if the route is a backup route for links; otherwise false.

isPathProtection

public boolean isPathProtection()
Returns true if this route is a backup for route(s) or not.

Returns:
true if the route is a backup route for route(s); otherwise false.

getProtectionFor

public java.util.Vector getProtectionFor()
Return a copy of the Vector of the protected objects

Returns:
A copy of the Vector of the protected objects

isRouteOf

public boolean isRouteOf(ExtRouter src,
                         ExtRouter dest)
Deprecated. use method isConnectionBetween() instead.

Determines if the route is the route between the two nodes with direction source to destination.

Parameters:
src - The source node.
dest - The desitnation node.
Returns:
true if the route contains these host and destination.

isConnectionBetween

public boolean isConnectionBetween(ExtRouter src,
                                   ExtRouter dest)
Determines if the connection is the two nodes with direction source to destination.

Parameters:
src - The source node.
dest - The desitnation node.
Returns:
true if the connection contains these host and destination.

setNoElements

protected void setNoElements(int size)
Set the number of routes.

Specified by:
setNoElements in class AbstractObject
Parameters:
size - the new number of channel segments.

setQoS

public void setQoS(QualityOfService newQos)
Set the Quality of Service.

Parameters:
newQos - the QoS.

addRoute

public void addRoute(java.util.Vector route)
Add the route to the array of routes.

Parameters:
route - the route to be added.

resetRoutes

public void resetRoutes()
reset the possible routes


setDestination

public void setDestination(ExtRouter destinationNode)
Set the destination node.

Parameters:
destinationNode - the destination Router.
Throws:
java.lang.NullPointerException - will be thrown if a null value will be passed

setID

public void setID(int newID)
           throws IllegalIDException
Set the optical route's id.

Parameters:
newID - The id.
Throws:
IllegalIDException - The id is not a legal ID.

setOpticalPath

public void setOpticalPath(OpticalPath newPath)
                    throws DataIntegrityException
Set the optical path connection used for this route. The path MUST contain THIS route instance before it can be added. If the given path is null the internal stored path will be resetted and the path attribute will be set to null.

Parameters:
newPath - The used optical path.
Throws:
DataIntegrityException - Will be thrown if the new path is not assigned to this route.

setSource

public void setSource(ExtRouter sourceNode)
Set the source node.

Parameters:
sourceNode - the source Router or null.
Throws:
java.lang.NullPointerException - will be thrown if a null value will be passed

addRouteFromLinkList

public void addRouteFromLinkList(java.util.Vector linkList)
Add the route represented by a list of optical links.

Parameters:
linkList - The list of optical links.

addRouteFromLinkList

public void addRouteFromLinkList(int[] linkIDs)
Deprecated. Use addRouteFromLinkList(String linksNhi)

Add the route represented by a list of optical links Id.

Parameters:
linkIDs - The list of optical links Id.

addRouteFromLinkList

public void addRouteFromLinkList(java.lang.String[] linksNhi)
Add the route represented by a list of optical links Nhi.

Parameters:
linksNhi - The list of optical links Nhi.

addRouteFromNodeList

public void addRouteFromNodeList(java.util.Vector nodeList)
Add the route represented by a list of nodes.

Parameters:
nodeList - The list of nodes.

addRouteFromNodeList

public void addRouteFromNodeList(int[] nodeIDs)
Deprecated. Use addRouteFromNodeList(String nodesNhi)

Add the route represented by a list of nodes Id.

Parameters:
nodeIDs - The list of nodes Id.

addRouteFromNodeList

public void addRouteFromNodeList(java.lang.String[] nodesNhi)
Add the route represented by a list of nodes Nhi.

Parameters:
nodesNhi - The list of nodes Nhi.

addProtectionFor

public void addProtectionFor(java.lang.Object obj)
                      throws IllegalDataException
This method checks if the protected object is a link or path(route). All protected objects of this OpticalConnection must be of the same type.

Parameters:
obj - The protected object.
Throws:
IllegalDataException - will be thrown if the object is of the wrong type.

createArray

protected java.lang.Object[] createArray(int size)
Creates a route array of the specified size.

Specified by:
createArray in class AbstractObject
Parameters:
size - The size of the segment array.
Returns:
The array of OpticalChannelSegments.

register

public boolean register(ProtocolSession srcSession)
Register a ProtocolSession to own this route

Parameters:
srcSession - The ProtocolSession that wants to use the route
Returns:
true if the registration is done.
Throws:
java.lang.NullPointerException - If the given owner is null.

unregister

public boolean unregister(ProtocolSession session)
                   throws java.lang.NullPointerException
Unregister a ProtocolSession to free this route. The parameter must be the owner itself. Another Protocol cannot unregister an other one.

Parameters:
session - The ProtocolSession that uses the route
Returns:
False if the parameter is not the owner.
Throws:
java.lang.NullPointerException - The given session is null.

isConfigured

public boolean isConfigured()
Determines if the route is completely configured. A complete configured route has terminated endpoints.

Returns:
true if the route is complete configured.
Since:
2.0

getBackupRoute

public OpticalConnection getBackupRoute()
Determins the backupRoute for this route.


setBackupRoute

public void setBackupRoute(OpticalConnection backup)
Set the backup route for this route.

Parameters:
backup - The backup.
Returns:
return this backup.

reRouteStart

public void reRouteStart(Lambda inLambda,
                         OpticalChannel channel)
                  throws InvalidConnectionException,
                         ProtocolException,
                         OpticalChannelException
Reroutes the starting lambda.

Parameters:
inLambda - The lambda the channels first lambda has to be connected to.
channel - The channel that has to be reRouted
Throws:
InvalidConnectionException - The switch refused the connection
ProtocolException - The Switch was not found.
OpticalChannelException - If the Channel is not configured.
Since:
2.0

reRouteEnd

public void reRouteEnd(Lambda outLambda,
                       OpticalChannel channel)
                throws InvalidConnectionException,
                       ProtocolException,
                       OpticalChannelException
Reroutes the ending lambda.

Parameters:
outLambda - the lambda the end lambda of the given channel has to connected to.
channel - The channel that has to be reRouted
Throws:
InvalidConnectionException - The switch refused the connection
ProtocolException - The Switch was not found.
OpticalChannelException - If the Channel is not configured.
Since:
2.0

finalize

public void finalize()
Reset the path if necessary.

Overrides:
finalize in class java.lang.Object
Since:
2.0

isPathFailed

public boolean isPathFailed()
Check if the path is failed

Returns:
True if the path is failed

toString

public java.lang.String toString()
Returns the string representation of this route.

Overrides:
toString in class java.lang.Object
Returns:
the String representation.