gov.nist.antd.optical
Class OpticalLink

java.lang.Object
  |
  +--com.renesys.raceway.SSF.Entity
        |
        +--SSF.Net.link
              |
              +--SSF.Net._link
                    |
                    +--gov.nist.antd.optical.OpticalLink
All Implemented Interfaces:
com.renesys.raceway.DML.Configurable, FailureInformation

public class OpticalLink
extends _link

The optical link contains a number of Fibers and Lambdas. This link only can be used with ONICs and OpticalLinkLayer. the default delay of this link is SSF.Net.Net.seconds(getDistance()*0.000000005)

 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  double ber
          Bit Error Rate of the link.
private  double delay
          Delay of the link in ticks.
private  double distance
          Distance between the two connected ONICs.
private  Fiber[] fibers
          The fibers contained in the link.
static int INITIAL_ARRAY_SIZE
          Constant for the fiber array.
private  int noAmplifiers
          Number of amplifiers between the ONICs.
private  int noFibers
          Number of fibers stored in the array.
private  int noRegenerators
          Number of regenerators between the ONICs.
private  boolean protection
          Indicates if this link is used as a protection link.
private  int protectionMode
          The mode of Protection ProtectionMode.NEVER, ProtectionMode.ONLY, or ProtectionMode.SHARED
private  java.util.Vector srlg
          This vector contains integers.
 
Fields inherited from class SSF.Net._link
inConfiguration
 
Fields inherited from class SSF.Net.link
 
Fields inherited from class com.renesys.raceway.SSF.Entity
 
Constructor Summary
OpticalLink(Net net, java.lang.String use_nhi)
          Default constructor.
 
Method Summary
 void addFiber(Fiber fiber)
          Add a fiber to this link.
 void addLambda(Fiber fiber, Lambda lambda)
          Add a lambda to the given fiber of this link.
 void addSrlg(int newSrlg)
          Set the Shared Risk Link Group for this optical link.
 void addSrlg(java.lang.Integer newSrlg)
          Set the Shared Risk Link Group for this optical link.
 void addSrlg(java.util.Vector newSrlg)
          Add the Shared Risk Link Group for this optical link.
private  void checkConfig()
          Check if the configuration of link, if enough fibers are available to provide bidirectional signaling.
private  void checkPair(com.renesys.raceway.DML.Configuration cfg)
          Checks the lamda pairs in this link.
protected  void clear()
          Removes all fibers of the link.
 void config(com.renesys.raceway.DML.Configuration cfg)
          Configure the OpticalLink.
protected  void configFiber(Fiber fiber)
          Find the port ID for the new fibers.
protected  void configFibers(com.renesys.raceway.DML.Configuration cfg)
          configure the fibers in this link.
 void configOptional(com.renesys.raceway.DML.Configuration cfg)
          Configure the optional parameters of the OpticalLink.
 long delay()
          Deprecated. Use the method getDelay().
 double getAvailableBandwidthFor(int hostID)
          Determines the maximum available bandwidth for the the sending host.
 double getBer()
          Return the Bit Error Rate.
 double getDelay()
          Get the delay of this link.
 double getDistance()
          Get the distance between the two ONIC's connected by this link.
 Fiber getFiber(int id)
          Return the specific fibers of this optical link.
 Fiber getFiber(int hostID, int portID)
          Return the specific fiber that has this port number in this Onic
 Fiber[] getFibers()
          Return the fibers which belong to this optical link.
 Lambda[] getLambdas(Fiber fiber)
          Return the lambdas that belong the fiber.
 double getMaxBandwidthFor(int hostID)
          Determines the maximum bandwidth for the the sending host.
 int getNoAmplifiers()
          Return the number of amplifiers on this optical link.
 int getNoFibers()
          Return the number of fibers which belong to this optical link.
 int getNoRegenerators()
          Return the number of regenerators on this optical link.
 int getProtectionMode()
          Returns the protection mode of the link.
 java.util.Vector getSrlg()
          Return the Shared Risk Link Groups of this optical link.
 boolean isBidirectional()
          Determines if this link is a bidirectional link or not.
 boolean isInSrlg(int srlg)
          Determines if the link belongs to the given shared risk link group.
 boolean isInSrlg(java.lang.Integer srlg)
          Determines if the link belongs to the given shared risk link group.
 boolean isProtection()
          Indicates if the link is used as a protection link.
protected  void notifyNIC()
          Notifies the ONIC for a failed Lambda.
 void removeFiber(Fiber fiber)
          Removes the given fiber from the link.
 void removeSrlg(int srlg)
          Remove the Shared Risk Link Group for this optical link.
 void removeSrlg(java.lang.Integer srlg)
          Remove the Shared Risk Link Group for this optical link.
private  void sendConfigMessage(com.renesys.raceway.DML.Configuration cfg)
          Checks if the Eventhandler has receivers and if so this message will send to them, otherwise not.
protected  void sendMessage(short messageType)
          Checks if the Eventhandler has receivers and this object is not in the configuration mode, this message will send the specified event.
 void setBer(double ber)
          Set the Bit Error Rate.
 void setDelay(double value)
          Get the delay of this link.
 void setDistance(double distance)
          Set the link's length.
 void setFailure(boolean newValue)
          Modify the failure attribute.
 void setNoAmplifiers(int newNoAmplifiers)
          Set the number of amplifiers on this optical link.
 void setNoRegenerators(int newNoRegenerators)
          Set the number of regenerators on this optical link.
 void setProtection(boolean protection)
          Set the attribute protection.
 void setProtectionMode(int newMode)
          Set the protection mode.
 void setSRLG(java.util.Vector newSRLG)
          Replaces the internal Vector with a clone of the new one.
 java.lang.String toString()
          Return the informations of the optical link
 
Methods inherited from class SSF.Net._link
getAttachedCount, getAttachedCount, getAttachedInterfaces, getAttachedInterfaces, getCidr, getDumpTo, getID, getIp, getIp, getIpaddr, getIpaddr, getLinkLayer, getLinkLayer, getNet, getNhi, getNICs, getPrefix, getPrefix, isFailure, setAttachedCount, setAttachedCount, setAttachedInterfaces, setAttachedInterfaces, setCidr, setDumpTo, setID, setIp, setIp, setIpaddr, setIpaddr, setLinkLayer, setLinkLayer, setNet, setNhi, setPrefix, setPrefix
 
Methods inherited from class com.renesys.raceway.SSF.Entity
alignment, alignTo, coalignedEntities, inChannels, init, joinAll, makeIndependent, now, outChannels, pauseAll, playRole, processes, resumeAll, startAll, startAll, startClient, startClient, startServer, W, Z
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INITIAL_ARRAY_SIZE

public static final int INITIAL_ARRAY_SIZE
Constant for the fiber array.

See Also:
Constant Field Values

ber

private double ber
Bit Error Rate of the link. (Default 0.0)


delay

private double delay
Delay of the link in ticks. (Default 0.0)


distance

private double distance
Distance between the two connected ONICs. (Default 1.0 km)


noAmplifiers

private int noAmplifiers
Number of amplifiers between the ONICs. (Default 0)


noRegenerators

private int noRegenerators
Number of regenerators between the ONICs. (Default 0)


protection

private boolean protection
Indicates if this link is used as a protection link. (Default false)


protectionMode

private int protectionMode
The mode of Protection ProtectionMode.NEVER, ProtectionMode.ONLY, or ProtectionMode.SHARED


noFibers

private int noFibers
Number of fibers stored in the array. (Default 0)


fibers

private Fiber[] fibers
The fibers contained in the link.


srlg

private java.util.Vector srlg
This vector contains integers. Each integer represents a shared Risk link Group.

Constructor Detail

OpticalLink

public OpticalLink(Net net,
                   java.lang.String use_nhi)
Default constructor.

Parameters:
net - The top-level modeling class that initiates this link.
use_nhi - NHI address of point of link definition
Method Detail

addFiber

public void addFiber(Fiber fiber)
Add a fiber to this link.

Parameters:
fiber - The fiber to add.

removeFiber

public void removeFiber(Fiber fiber)
                 throws DataIntegrityException
Removes the given fiber from the link.

Parameters:
fiber - The fiber that has to be removed
Throws:
DataIntegrityException - if the links data integrity is damaged.

clear

protected void clear()
Removes all fibers of the link.


addLambda

public void addLambda(Fiber fiber,
                      Lambda lambda)
               throws DataIntegrityException
Add a lambda to the given fiber of this link.

Parameters:
fiber - The fiber where we add the lambda.
lambda - The lambda to add.
Throws:
DataIntegrityException - The lambda and fiber don't fit together.

configOptional

public void configOptional(com.renesys.raceway.DML.Configuration cfg)
                    throws com.renesys.raceway.DML.configException
Configure the optional parameters of the OpticalLink.

Overrides:
configOptional in class _link
Parameters:
cfg - The configuration object.
Throws:
com.renesys.raceway.DML.configException - when a configuration error occured.

config

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

Specified by:
config in interface com.renesys.raceway.DML.Configurable
Overrides:
config in class _link
Parameters:
cfg - The configuration object.
Throws:
com.renesys.raceway.DML.configException - when a configuration error occured.

configFibers

protected void configFibers(com.renesys.raceway.DML.Configuration cfg)
                     throws com.renesys.raceway.DML.configException
configure the fibers in this link.

Parameters:
cfg - The DML configuration
Throws:
when - a configException occurs
com.renesys.raceway.DML.configException

configFiber

protected void configFiber(Fiber fiber)
Find the port ID for the new fibers.

Parameters:
fiber - The fiber to configure

sendConfigMessage

private void sendConfigMessage(com.renesys.raceway.DML.Configuration cfg)
Checks if the Eventhandler has receivers and if so this message will send to them, otherwise not.

Parameters:
cfg - The configuration instance.

checkPair

private void checkPair(com.renesys.raceway.DML.Configuration cfg)
                throws com.renesys.raceway.DML.configException
Checks the lamda pairs in this link.

Parameters:
cfg - The configuration object.
Throws:
com.renesys.raceway.DML.configException - An configuration exception occured.

checkConfig

private void checkConfig()
                  throws com.renesys.raceway.DML.configException
Check if the configuration of link, if enough fibers are available to provide bidirectional signaling. (2 times unidirectional in different direction or 1 bidirectional).

Throws:
com.renesys.raceway.DML.configException - if the configuration is not coorect.

getBer

public double getBer()
Return the Bit Error Rate.

Returns:
ber

getDistance

public double getDistance()
Get the distance between the two ONIC's connected by this link.

Returns:
The optical link's length.

delay

public long delay()
Deprecated. Use the method getDelay().

Get the delay of this link.

Overrides:
delay in class link
Returns:
The optical link's delay.

getDelay

public double getDelay()
Get the delay of this link.

Returns:
The optical link's delay.

setDelay

public void setDelay(double value)
Get the delay of this link.

Parameters:
value - The optical link's delay.

getFibers

public Fiber[] getFibers()
Return the fibers which belong to this optical link.

Returns:
Array of fibers.

getFiber

public Fiber getFiber(int id)
               throws IllegalIDException
Return the specific fibers of this optical link.

Parameters:
id - The fiber ID.
Returns:
The fiber or null if not existent.
Throws:
IllegalIDException - The passed ID is invalid.

getFiber

public Fiber getFiber(int hostID,
                      int portID)
               throws IllegalIDException
Return the specific fiber that has this port number in this Onic

Parameters:
hostID - the id of the node that see portID
portID - the portID of the fiber on the side of the host hostID
Returns:
the fiber or null if not existent.
Throws:
IllegalIDException - The passed ID is invalid.

getLambdas

public Lambda[] getLambdas(Fiber fiber)
Return the lambdas that belong the fiber.

Parameters:
fiber - One of the fiber that belong this optical link.
Returns:
Array of lambda's.

getNoAmplifiers

public int getNoAmplifiers()
Return the number of amplifiers on this optical link.

Returns:
nb_amplifier.

getNoRegenerators

public int getNoRegenerators()
Return the number of regenerators on this optical link.

Returns:
nb_regenerator.

getSrlg

public java.util.Vector getSrlg()
Return the Shared Risk Link Groups of this optical link.

Returns:
A clone of the internal Vector.

isInSrlg

public boolean isInSrlg(int srlg)
Determines if the link belongs to the given shared risk link group.

Parameters:
srlg - The number of the shared risk link group.
Returns:
True if the link belongs to the group; otherwise false.

isInSrlg

public boolean isInSrlg(java.lang.Integer srlg)
Determines if the link belongs to the given shared risk link group.

Parameters:
srlg - The number of the shared risk link group.
Returns:
True if the link belongs to the group; otherwise false.

isProtection

public boolean isProtection()
Indicates if the link is used as a protection link.

Returns:
True if the link is used as a protection.

getProtectionMode

public int getProtectionMode()
Returns the protection mode of the link.

Returns:
The int that indicates the mode.

getMaxBandwidthFor

public double getMaxBandwidthFor(int hostID)
Determines the maximum bandwidth for the the sending host.

Parameters:
hostID - the id of the sending host.
Returns:
The maximum bandwidth.

getAvailableBandwidthFor

public double getAvailableBandwidthFor(int hostID)
Determines the maximum available bandwidth for the the sending host.

Parameters:
hostID - the id of the sending host.
Returns:
The available bandwidth.

setBer

public void setBer(double ber)
Set the Bit Error Rate.

Parameters:
ber - The ber for this link.

setDistance

public void setDistance(double distance)
Set the link's length.

Parameters:
distance - The length of this link.

setFailure

public void setFailure(boolean newValue)
Modify the failure attribute. This method uses the inherited method but adds the failure propagation.

Overrides:
setFailure in class _link
Parameters:
newValue - True if the link becomes failed.

setNoAmplifiers

public void setNoAmplifiers(int newNoAmplifiers)
Set the number of amplifiers on this optical link.

Parameters:
newNoAmplifiers - number of amplifiers.

setNoRegenerators

public void setNoRegenerators(int newNoRegenerators)
Set the number of regenerators on this optical link.

Parameters:
newNoRegenerators - The number of regenerators.

setProtection

public void setProtection(boolean protection)
Set the attribute protection.

Parameters:
protection - True if the link becomes a protection one.

setProtectionMode

public void setProtectionMode(int newMode)
                       throws IllegalDataException,
                              DataIntegrityException
Set the protection mode.

Parameters:
newMode - the protection mode.
Throws:
IllegalDataExcetion - The given mode is not known.
DataIntegrityException - The given mode and the protection value is invalid (i.e. ProtectionMode.NEVER and isProtection()==true.
IllegalDataException

addSrlg

public void addSrlg(java.util.Vector newSrlg)
Add the Shared Risk Link Group for this optical link. This method does not check the Objects in the Vector. They MUST be instances of Integer.

Parameters:
newSrlg - A vector of SRLG that the link share.

addSrlg

public void addSrlg(int newSrlg)
Set the Shared Risk Link Group for this optical link.

Parameters:
newSrlg - The number of the srlg that has to be added

addSrlg

public void addSrlg(java.lang.Integer newSrlg)
Set the Shared Risk Link Group for this optical link.

Parameters:
newSrlg - The number of the srlg that has to be added

removeSrlg

public void removeSrlg(int srlg)
Remove the Shared Risk Link Group for this optical link.

Parameters:
srlg - The number of the srlg that has to be added

removeSrlg

public void removeSrlg(java.lang.Integer srlg)
Remove the Shared Risk Link Group for this optical link.

Parameters:
srlg - The number of the srlg that has to be added

setSRLG

public void setSRLG(java.util.Vector newSRLG)
Replaces the internal Vector with a clone of the new one.

Parameters:
newSRLG - The new shared risk link group Vector
Throws:
java.lang.NullPointerException - If the given SRLG is null

getNoFibers

public int getNoFibers()
Return the number of fibers which belong to this optical link.

Returns:
number of fibers.

isBidirectional

public boolean isBidirectional()
Determines if this link is a bidirectional link or not. This information is needed by the routing algorithm to figure out if there is a possible path through this link. The decission will be made by checking the existence of both, in- and out-fibers.

Returns:
true if this link is bidirectional, otherwise false.

toString

public java.lang.String toString()
Return the informations of the optical link

Overrides:
toString in class java.lang.Object
Returns:
the description

sendMessage

protected void sendMessage(short messageType)
Checks if the Eventhandler has receivers and this object is not in the configuration mode, this message will send the specified event.

Parameters:
messageType - the type of the message. The types are specified in the class gov.nist.antd.optical.event.monitor.EventHandler.

notifyNIC

protected void notifyNIC()
Notifies the ONIC for a failed Lambda. This method overwrites the method notifyNIC of _link

Overrides:
notifyNIC in class _link
Since:
1.2