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

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 distance {in km} * 1000 / speed of light in glass {meter / seconds}. The speed of light in glass is 199,861,638 m/s (vacuumspeed / refractive index of 1.5).
By specifying the delay in the DML the automatic configuration will be skipped.

The following DML parameters can be used:

 OpticalLink [
   id               # Must be unique in the net.
Only 2 attache statements are allolwed in the optical link!
   attach            # The nhi of the firs host and the interface in 
                             # brackets. Example attach 4(0)                  
   attach            # The nhi of the second host and the interface in 
                             # brackets. Example attach 3(1)
   
   (OPTIONAL inherited from link)
   distance          # Distance in km, affects the delay if no delay 
                             # is specified.
   delay             # In seconds. If no delay is specified, it will 
                             # be calculated automatically.
   ber               # Bit Error Rate / just as attribute
   noAmplifiers   
   noRegenerators 
   srlg              # The Shared Risk Link Group is a comma separated
                             # list of positive integer values.
   protection     
   protectionMode 
   
   cidr              # The cidr block address. 
   ip                # The ip of the link.
   tcpdump           # Name of the dump output file.
             
   Fiber [  # The fiber section can be repeated multiple times
    ...     # If no fiber is specified, 2 unidirectional fibers will be 
            # created, each one has 1 control and 9 data lambdas. Each lambda 
            # has a bandwidth of 2.5 Gbps.
   ]
 ]
 

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

 VERSION CONTROL
 -----------------------------------------------------------------------------
 Name - YYYY/MM/DD - VERSION - ACTION
 borchert - 2001/05/29 - 1.0 - Source created.
 borchert - 2001/06/06 - 1.1 - upgrade to ssf 1.2.2 - change of ssf core.
 borchert - 2001/09/13         removed deprecated function calls in method
                               checkConfig()
                               and getFiber (int hostID, int portID).
 borchert - 2001/09/15         removed function getBandwidth.
 borchert - 2001/09/19         fixed the configuration bug of bidirectional 
                               fibers.
 borchert - 2001/09/27         Added FAILURE and CHANGE event into the method
                               setFailure.
 borchert - 2001/10/26         Add the interface FailureInformation.
 borchert - 2001/10/26 - 1.2 - Add failure notification.
 rouil    - 2002/02/14 -     - Complete documentation.
 borchert - 2002/03/04 - 1.3 - Moved interface Failureinformation into package
                               gov.nist.antf.ssf.
 borchert - 2002/03/12 - 1.4 - Removed interface FailureInformation. moved it 
                               into the superclass _link.
                             - Changed the method setFailure. The ONIC 
                               notification is moved in _link nic 
                               notification.
                             - Removed method isFailure. Moved to _link.
                             - Removed attribute failure. Moved to _link.
                             - Attribute id moved to _link.
                             - Renamed private method notifyONIC to notifyNIC
                               and changed the visibility modifier to 
                               protected.
 rouil    - 2002/03/26 - 1.5 - Updated according to SSF 1.4
 borchert - 2002/04/25       - Removed obsolete import statements.
 rouil    - 2002/04/29 - 1.6 - Moved attribute inConfiguration to super class.
                               Updated call of deprecated methods.
 rouil    - 2002/06/08 - 1.7 - Removed duplicate call to setID.
 rouil    - 2002/06/18 - 1.8 - Extended OXCEdgeRouter to ExtRouter
 rouil    - 2002/07/08 -     - Fixed bug in setFailure.
 rouil    - 2002/07/17 -     - Fixed bug by moving the call to the options
                               before the creation of the OpticalLinkLayer.
 rouil    - 2002/08/14 - 1.9 - Added getSrlgString for saving
                             - getDelay() return the delay in seconds and delay()
                               the delay in ticks.
 rouil    - 2002/09/25 - 2.0 - Deprecated the methods using ID to identify a
                               node and created methods using NHI address.
 rouil    - 2002/10/01 - 2.1 - Updated methods accessing fiber.
 rouil    - 2002/10/03       - Updated call to isDuplicateNodeId.
 borchert - 2002/10/08       - Fix bug in configuration of the delay.
                               If no delay is specified the delay will be 
                               calculated.
                             - Removed method notifyNIC. This method violated 
                               the SSF principles.
 borchert - 2002/10/15       - Removed unused code and changed toString 
                               method.
 klink    - 2002/11/04       - fixed bug, autoconfiguration of fiber
 borchert - 2002/12/31       - Moved the conifguration of the distance to be
                               configured before the delay will be calculated.
                             - Added the DML documentation.
 borchert - 2003/01/05 - 2.2 - Reconnected the channels by changing the link 
                               delay.
 rouil    - 2003/01/05 - 2.3 - Fixed autogeneration of fibers.
                               Updated reMap method.
 

Author:
borchert
, klink , rouil

Field Summary
private  double ber
          Bit Error Rate of the link.
private  double delay
          Delay of the link in ticks.
private  double delaySecond
          The delay of the link is seconds (Default 0.0)
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.
static double LIGHTSPEED
          Speed of light (m/s) in glass with refractive index of 1.5
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)
          Creates a link with the given nhi.
 
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()
          Get the delay of this link in Ticks.
 double getAvailableBandwidthFor(int hostID)
          Deprecated. Use getAvailableBandwidthFor (String hostNhi)
 double getAvailableBandwidthFor(java.lang.String hostNhi)
          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 in second (to match the setDelay).
 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)
          Deprecated. Use getFiber (String hostNhi, int portID)
 Fiber getFiber(java.lang.String hostNhi, 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.
 java.lang.String getSrlgString()
          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 reMap(ONIC outONIC, ONIC inONIC)
          Reattaches the channels of the given NICs.
 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, getNhi, getNICs, getPrefix, getPrefix, hasMultipleTimeLines, isFailure, isFailure, reMap, setAttachedCount, setAttachedCount, setAttachedInterfaces, setAttachedInterfaces, setCidr, setDumpTo, setFailure, 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, reset, resumeAll, startAll, startAll, startClient, startClient, startServer, wx, Yx
 
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

LIGHTSPEED

public static final double LIGHTSPEED
Speed of light (m/s) in glass with refractive index of 1.5

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 will be calculated in the config)


delaySecond

private double delaySecond
The delay of the link is seconds (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)
Creates a link with the given nhi.

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:
The Bit Error Rate.

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()
Get the delay of this link in Ticks.

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

getDelay

public double getDelay()
Get the delay of this link in second (to match the setDelay).

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

setDelay

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

Overrides:
setDelay in class _link
Parameters:
value - The optical link's delay.

reMap

protected void reMap(ONIC outONIC,
                     ONIC inONIC)
Reattaches the channels of the given NICs.

Parameters:
outONIC - The NIC where the outChannel has to be connected.
inONIC - The NIC where the inChannel has to be connected.

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
Deprecated. Use getFiber (String hostNhi, int portID)

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.

getFiber

public Fiber getFiber(java.lang.String hostNhi,
                      int portID)
               throws IllegalIDException
Return the specific fiber that has this port number in this Onic.

Parameters:
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.
Since:
2.1

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.

getSrlgString

public java.lang.String getSrlgString()
Return the Shared Risk Link Groups of this optical link.

Returns:
The list of SRLG as a string or null.

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)
                                throws TopologyException
Deprecated. Use getAvailableBandwidthFor (String hostNhi)

Determines the maximum available bandwidth for the the sending host.

Parameters:
hostID - the id of the sending host.
Returns:
The available bandwidth.
Throws:
TopologyException - when duplicate node IDs.

getAvailableBandwidthFor

public double getAvailableBandwidthFor(java.lang.String hostNhi)
Determines the maximum available bandwidth for the the sending host.

Parameters:
hostNhi - the NHI 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.
See Also:
_link.setFailure(Entity,boolean)

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.