gov.nist.antd.optical.util
Class PathUtil

java.lang.Object
  |
  +--gov.nist.antd.optical.util.PathUtil

public final class PathUtil
extends java.lang.Object

This class contains tools for OpticalConnection, OpticalPath and connections.

 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 , gallo

Constructor Summary
private PathUtil()
          Private constructor to avoid instantiation
 
Method Summary
static boolean contains(OpticalConnection route, Lambda lambda)
          Utility function to check if a route contains a lambda
static boolean contains(OpticalConnection route, OpticalLink link)
          Utility function to check if a route contains a link
static OpticalConnection createOpticalConnection(ExtRouter source, ExtRouter dest, QualityOfService qos)
          create an object connection between two nodes and set the id
static void createRouteFromLinks(int[] linksId, OpticalConnection oRoute)
          Create a vector of PtPBundle (of link) that represents a route
static void createRouteFromLinks(java.util.Vector links, OpticalConnection oRoute)
          Create a vector of PtPBundle (of link) that represents a route
static void createRouteFromNodes(int[] nodesId, OpticalConnection oRoute)
          Create a vector of PtPBundle (of link) that represents a route
static void createRouteFromNodes(java.util.Vector nodes, OpticalConnection oRoute)
          Create a vector of PtPBundle (of link) that represents a route
static OpticalConnection createRouteObject(ExtRouter source, ExtRouter dest, QualityOfService qos)
          Deprecated. use createOpticalConnection
static boolean deleteConnection(OpticalConnection oRoute)
          Delete a lightpath and disconnect all lambdas
static OpticalConnection[] getAllConnections(OpticalLink link, PathContainer container)
          Get all paths from the pathContainer that contain the link
static OpticalPath[] getAllPaths(OpticalLink link, PathContainer container)
          get all paths from the pathContainer that that contain the link
static OpticalConnection[] getAllRoutes(OpticalLink link, PathContainer container)
          Deprecated. use getAllConnections (OpticalLink, PathContainer).
static int getAvailableId(Glass net)
          Find the next available id for a route
static OpticalConnection getConnection(Glass net, int id)
          Return the route that has the given ID or null
static OpticalConnection getConnectionOfLambda(Glass net, Lambda lambda)
          Return the route that contains a lambda or null if not found
static PathContainer[] getPathContainers(Glass net)
          This method determines the existing PathContainer's in the network.
static int[] getReceiverInformations(OpticalConnection oRoute)
          Return the port numbers for the receiver
static java.lang.String getReceiverProtocol(OpticalConnection route)
          Return the name of the protocol session that receives the messages
static OpticalConnection getRoute(Glass net, int id)
          Deprecated. use getConnection (Flass net, int id).
static OpticalConnection getRouteOfLambda(Glass net, Lambda lambda)
          Deprecated. use getConnectionOfLambda (Glass, Lambda)
static OpticalChannelSegment getSegment(Glass net, Lambda lambda)
          Utility function to find the Segment the lambda is assigned to
static int[] getSenderInformations(OpticalConnection oRoute)
          Return the port numbers for the sender
static boolean isConnectionIdUsed(Glass net, int id)
          check if this connection Id is already used.
static boolean isRouteIdUsed(Glass net, int id)
          Deprecated. use isConnectionIdUsed (Glass, int)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathUtil

private PathUtil()
Private constructor to avoid instantiation

Method Detail

createRouteObject

public static OpticalConnection createRouteObject(ExtRouter source,
                                                  ExtRouter dest,
                                                  QualityOfService qos)
Deprecated. use createOpticalConnection

create an object route between two nodes

Parameters:
source - The source of the connection
dest - The destination of the connection
qos - The quality of service requested
Returns:
The OpticalConnection

createOpticalConnection

public static OpticalConnection createOpticalConnection(ExtRouter source,
                                                        ExtRouter dest,
                                                        QualityOfService qos)
create an object connection between two nodes and set the id

Parameters:
source - The source of the connection
dest - The destination of the connection
qos - The quality of service requested
Returns:
The OpticalConnection

getAvailableId

public static int getAvailableId(Glass net)
Find the next available id for a route

Parameters:
net - The network the connection has to be assigned to.
Returns:
An available id

isRouteIdUsed

public static boolean isRouteIdUsed(Glass net,
                                    int id)
Deprecated. use isConnectionIdUsed (Glass, int)

check if this connection Id is already used.

Parameters:
net - The OpNet the route will be assigned to.
id - the id that has to be checked.
Returns:
true if the id is used

isConnectionIdUsed

public static boolean isConnectionIdUsed(Glass net,
                                         int id)
check if this connection Id is already used.

Parameters:
net - The OpNet the connection will be assigned to.
id - the id that has to be checked.
Returns:
true if the id is used

getRoute

public static OpticalConnection getRoute(Glass net,
                                         int id)
Deprecated. use getConnection (Flass net, int id).

Return the route that has the given ID or null

Parameters:
net - The OpNet the route will be assigned to.
id - the id that has to be checked.
Returns:
The OpticalConnection or null if not found

getConnection

public static OpticalConnection getConnection(Glass net,
                                              int id)
Return the route that has the given ID or null

Parameters:
net - The OpNet the route will be assigned to.
id - the id that has to be checked.
Returns:
The OpticalConnection or null if not found

getSenderInformations

public static int[] getSenderInformations(OpticalConnection oRoute)
Return the port numbers for the sender

Parameters:
oRoute - An optical route
Returns:
An array of int. The port IDs or null if the path is not computed or data missing.

getReceiverInformations

public static int[] getReceiverInformations(OpticalConnection oRoute)
Return the port numbers for the receiver

Parameters:
oRoute - An optical route
Returns:
An array of int. The port IDs or null if the path is not computed or data missing.

getReceiverProtocol

public static java.lang.String getReceiverProtocol(OpticalConnection route)
Return the name of the protocol session that receives the messages

Parameters:
route - The OpticalConnection
Returns:
The name of the protocol that receives the messages or null if the route is not registered

deleteConnection

public static boolean deleteConnection(OpticalConnection oRoute)
Delete a lightpath and disconnect all lambdas

Parameters:
oRoute - the OpticalConnection to delete
Returns:
True if the oRoute is deleted
Throws:
if - the parameter is null

createRouteFromNodes

public static void createRouteFromNodes(java.util.Vector nodes,
                                        OpticalConnection oRoute)
                                 throws IllegalDataException
Create a vector of PtPBundle (of link) that represents a route

Parameters:
nodes - The vector of nodes that represents the path.
oRoute - The optical route that stores the result.
Throws:
IllegalDataException - if an error occurs.

createRouteFromLinks

public static void createRouteFromLinks(java.util.Vector links,
                                        OpticalConnection oRoute)
                                 throws IllegalDataException
Create a vector of PtPBundle (of link) that represents a route

Parameters:
links - The vector of links that represents the path.
oRoute - The optical route that stores the result.
Throws:
IllegalDataException - if an error occurs.

createRouteFromNodes

public static void createRouteFromNodes(int[] nodesId,
                                        OpticalConnection oRoute)
                                 throws IllegalDataException
Create a vector of PtPBundle (of link) that represents a route

Parameters:
nodesId - The array of node id that represents the path. the path ends if the end of the array is reached or the first id==-1 occurs.
oRoute - The optical route that stores the result.
Throws:
IllegalDataException - if an error occurs.

createRouteFromLinks

public static void createRouteFromLinks(int[] linksId,
                                        OpticalConnection oRoute)
                                 throws IllegalDataException
Create a vector of PtPBundle (of link) that represents a route

Parameters:
linksId - The array of links id that represents the path. The path ends at the end of the array or at the first occurance of an id == -1.
oRoute - The optical route that stores the result.
Throws:
IllegalDataException - if an error occurs.

getPathContainers

public static PathContainer[] getPathContainers(Glass net)
This method determines the existing PathContainer's in the network.

Parameters:
net - The OpNet that contains the containers.
Returns:
All existing pathcontainers.

getAllPaths

public static OpticalPath[] getAllPaths(OpticalLink link,
                                        PathContainer container)
get all paths from the pathContainer that that contain the link

Parameters:
link - the link being searched for
container - the pathContainer where the paths are
Returns:
OpticalPath[] array of path that contain the link

getAllRoutes

public static OpticalConnection[] getAllRoutes(OpticalLink link,
                                               PathContainer container)
Deprecated. use getAllConnections (OpticalLink, PathContainer).

Get all paths from the pathContainer that contain the link

Parameters:
link - the link being searched for
container - The pathContainer where the paths are
Returns:
OpticalPath[] array of paths that contain the link

getAllConnections

public static OpticalConnection[] getAllConnections(OpticalLink link,
                                                    PathContainer container)
Get all paths from the pathContainer that contain the link

Parameters:
link - the link being searched for
container - The pathContainer where the paths are
Returns:
OpticalPath[] array of paths that contain the link

contains

public static boolean contains(OpticalConnection route,
                               OpticalLink link)
Utility function to check if a route contains a link

Parameters:
route - optical route to check in
link - Optical link to check for
Returns:
boolean true if route contains link, false otherwise

contains

public static boolean contains(OpticalConnection route,
                               Lambda lambda)
Utility function to check if a route contains a lambda

Parameters:
route - optical route to check in
lambda - Lambda to check for
Returns:
boolean true if route contains lambda, false otherwise

getRouteOfLambda

public static OpticalConnection getRouteOfLambda(Glass net,
                                                 Lambda lambda)
Deprecated. use getConnectionOfLambda (Glass, Lambda)

Return the route that contains a lambda or null if not found

Parameters:
net - The OpNet where to look
lambda - Lambda to check for
Returns:
The OpticalConnection or null if not found

getConnectionOfLambda

public static OpticalConnection getConnectionOfLambda(Glass net,
                                                      Lambda lambda)
Return the route that contains a lambda or null if not found

Parameters:
net - The OpNet where to look
lambda - Lambda to check for
Returns:
The OpticalConnection or null if not found

getSegment

public static OpticalChannelSegment getSegment(Glass net,
                                               Lambda lambda)
Utility function to find the Segment the lambda is assigned to

Parameters:
net - The network th elambda belongs to.
lambda - Lambda to check for
Returns:
The segment or null if no segment is found.