gov.nist.antd.optical
Class Fiber

java.lang.Object
  |
  +--gov.nist.antd.optical.AbstractObject
        |
        +--gov.nist.antd.optical.Fiber
All Implemented Interfaces:
FailureInformation

public class Fiber
extends AbstractObject
implements FailureInformation

The physical fiber the link uses.

 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  boolean bidirectional
          Indicates if the fiber is bidirectional (true) or unidirectional (false).
static int BW_ALL
          Constant for the method getBandwidth.
static int BW_CONTROL
          Constant for the method getBandwidth.
static int BW_DATA
          Constant for the method getBandwidth.
private  double deltaWavelength
          The space between 2 wavelengths in nm
private  boolean failure
          Indicates a failure of the fiber itself.
private  int host1PortID
          The port id of the host 1.
private  int host2ID
          If this fiber is unidirectional this attribute contains the ID address of the receiver == host2.
private  int host2PortID
          The port id of the host 2.
private  int id
          The id of the fiber.
protected  boolean inConfiguration
          Indicator if the class is in the configuration mode (true).
static int INITIAL_ARRAY_SIZE
          Constant for the fiber array.
private  Lambda[] lambdas
          The lambdas used in this fiber.
private  OpticalLink link
          The link the fiber is used for.
private  int noLambdas
          Number of lambdas assigned to the Lambda.
private  boolean protection
          Indicates if this fiber is used as a protection fiber.
private  int protectionMode
          The mode of Protection ProtectionMode.NEVER, ProtectionMode.ONLY, or ProtectionMode.SHARED
private  double startWavelength
          The starting point for the wavelength.
private  boolean used
          Indicates if this fiber is in use.
 
Constructor Summary
Fiber(OpticalLink link)
          Default constructor.
 
Method Summary
 void addControlLambda(Lambda lambda)
          Modifies the status of the given lambda to use for control plane.
 void addLambda(Lambda lambda)
          Add a lambda in this fiber.
 void config(com.renesys.raceway.DML.Configuration cfg)
          Configure the Fiber.
protected  void configHost2(com.renesys.raceway.DML.Configuration cfg)
          Configures host2 or the receiver.
protected  void configID(java.lang.String value)
          Configure the optional parameters of the Fiber.
protected  void configLambdas(com.renesys.raceway.DML.Configuration cfg)
          Configure the lambdas of the fiber.
protected  void configOptional(com.renesys.raceway.DML.Configuration cfg)
          Configure the optional parameters of the Fiber.
protected  void configPortID(com.renesys.raceway.DML.Configuration cfg)
          Configure the ports of the fiber.
protected  java.lang.Object[] createArray(int size)
          Creates an Lambda array of the specified size.
protected  void generateLambdas(double fiberBandwidth, int noLambdas, boolean control)
          Autogeneration of the lambdas.
 double getBandwidth(int type)
          Compute the max.
 double getBandWidth(int type, boolean maximum)
          Compute the bandwidth.
 Lambda[] getControlLambdas()
          Returns all control lambdas.
 Lambda[] getDataLambdas()
          Returns an array containing all data lambdas.
 double getDeltaWavelength()
          Get the deltaWavelength value.
 int getHost1ID()
          Returns the host1 id of this fiber.
protected  ONIC getHost1ONIC()
          Determines the sender ONIC.
 int getHost2ID()
          Returns the host2 id of this fiber.
protected  ONIC getHost2ONIC()
          Determines the receiver ONIC.
 int getID()
          Get the fiber id.
 Lambda getLambda(int lambdaID)
          Find the specified lambda of this fiber.
 Lambda[] getLambdas()
          Find all lambda's that belong this fiber.
 OpticalLink getLink()
          Get the link the fiber is attached.
 double getMaximumBandwidth(int type)
          Compute the maximum bandwidth.
 double getNextWavelength()
          Get the next available wavelength
 int getPortID(boolean host2)
          Get the fibers port id for host1 (sender) or host2 (receiver)
 int getPortID(int hostID)
          Get the fibers port id on the specific host.
 int getProtectionMode()
          Returns the protection mode of the fiber.
 int getReceiverID()
          Deprecated. use getHost2ID() instead.
protected  ONIC getReceiverONIC()
          Deprecated. use getHost2ONIC() instead.
protected  ONIC getSenderONIC()
          Deprecated. use getHost1ONIC() instead.
 double getStartWavelength()
          Get the starting wavelength value.
 boolean isAvailable()
          Determines if the fiber is available.
 boolean isBidirectional()
          Returns if the fiber is bidirectional.
 boolean isDepthFailure()
          Determines if fiber, the lambdas in the fiber, or the link is failed.
 boolean isFailure()
          Determines if the fiber itself is failed.
 boolean isProtection()
          Informs if the fiber is used to protect an other fiber.
 boolean isUsed()
          Informs if the fiber is used.
 boolean isWavelengthUsed(double wavelength)
          Check if this wavelength is used in one of the lambda
private  void notifyONIC()
          Notifies the ONIC for a failed fiber.
 void removeLambda(Lambda lambda)
          Delete a lambda in this fiber.
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 setBidirectional(boolean bidirectional)
          Set the fiber as uni- or bidirectional
 void setDeltaWavelength(double deltaWavelength)
          Set the deltaWavelength.
 void setFailure(boolean newValue)
          Set the attribute failure.
 void setHost2ID(int host2ID)
          Set the ID of the host2 (receiver for unidirectional links) of this fiber.
 void setID(int newId)
          Set the fiber's id.
protected  void setNoElements(int size)
          Set the number of elements.
 void setPortID(boolean host2, int id)
          Set the fiber's id.
 void setProtection(boolean protection)
          Set the attribute protection.
 void setProtectionMode(int newMode)
          Set the protection mode.
 void setReceiverID(int receiverID)
          Deprecated. use setHost2ID instead.
 void setStartWavelength(double wavelength)
          Set the startWavelength.
 void setUsed(boolean used)
          Set the attribute used.
 java.lang.String toString()
          Return the informations of the optical link
 
Methods inherited from class gov.nist.antd.optical.AbstractObject
addElement, clear, isElementOf, removeElement
 
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

BW_DATA

public static final int BW_DATA
Constant for the method getBandwidth. Request only the bandwidth for data

See Also:
Constant Field Values

BW_CONTROL

public static final int BW_CONTROL
Constant for the method getBandwidth. Request only the bandwidth for control

See Also:
Constant Field Values

BW_ALL

public static final int BW_ALL
Constant for the method getBandwidth. Request the total bandwidth

See Also:
Constant Field Values

failure

private boolean failure
Indicates a failure of the fiber itself.


protection

private boolean protection
Indicates if this fiber is used as a protection fiber.


protectionMode

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


bidirectional

private boolean bidirectional
Indicates if the fiber is bidirectional (true) or unidirectional (false).


noLambdas

private int noLambdas
Number of lambdas assigned to the Lambda. The value of noLambdas need not to be the same as lambdas.length() !!


id

private int id
The id of the fiber. This id has to be unique at the ONIC.


host1PortID

private int host1PortID
The port id of the host 1. This host will be the sender for an unidirectional fiber.


host2PortID

private int host2PortID
The port id of the host 2. This host will be the receiver for an unidirectional fiber.


host2ID

private int host2ID
If this fiber is unidirectional this attribute contains the ID address of the receiver == host2.


used

private boolean used
Indicates if this fiber is in use.


inConfiguration

protected boolean inConfiguration
Indicator if the class is in the configuration mode (true).


lambdas

private Lambda[] lambdas
The lambdas used in this fiber.


link

private OpticalLink link
The link the fiber is used for.


startWavelength

private double startWavelength
The starting point for the wavelength. It is the central point. The value is in nm.


deltaWavelength

private double deltaWavelength
The space between 2 wavelengths in nm

Constructor Detail

Fiber

public Fiber(OpticalLink link)
Default constructor.

Parameters:
link - The attached link.
Method Detail

addControlLambda

public void addControlLambda(Lambda lambda)
                      throws DataIntegrityException
Modifies the status of the given lambda to use for control plane.

Parameters:
lambda - The lambda to use for control plane.
Throws:
DataIntegrityException - The lambda could not be added.

addLambda

public void addLambda(Lambda lambda)
               throws DataIntegrityException
Add a lambda in this fiber.

Parameters:
lambda - The lambda to add.
Throws:
DataIntegrityException - The lambda could not be added.

getID

public int getID()
Get the fiber id.

Returns:
The id.

getPortID

public int getPortID(boolean host2)
Get the fibers port id for host1 (sender) or host2 (receiver)

Parameters:
host2 - if true the port id of the host2 (receiver), otherwise the requested id is host1 (sender).
Returns:
The id of host1 or host2.

getPortID

public int getPortID(int hostID)
              throws IllegalIDException
Get the fibers port id on the specific host.

Parameters:
hostID - The id of the host we want the port number.
Returns:
The id of the specified onic.
IllegalIDException

getLambdas

public Lambda[] getLambdas()
Find all lambda's that belong this fiber.

Returns:
The lambda's inside this fiber.

getLambda

public Lambda getLambda(int lambdaID)
Find the specified lambda of this fiber.

Parameters:
lambdaID - The id of the lambda to find.
Returns:
The lambda inside this fiber or null if not existent.

getLink

public OpticalLink getLink()
Get the link the fiber is attached.

Returns:
The attribute link.

getReceiverID

public int getReceiverID()
Deprecated. use getHost2ID() instead.

Returns the receiver's id of this fiber.

Returns:
receiverIP The ONIC IP.

getHost2ID

public int getHost2ID()
Returns the host2 id of this fiber.

Returns:
The host2ID.
Since:
1.1

getHost1ID

public int getHost1ID()
Returns the host1 id of this fiber.

Returns:
The host1ID
Since:
1.1

isAvailable

public boolean isAvailable()
Determines if the fiber is available. The fiber is available if the method isDepthFailure() returns false and at least one data lambda (isControl()==false) is available.

Returns:
True if at least one lambda is not used.

isFailure

public boolean isFailure()
Determines if the fiber itself is failed.

Specified by:
isFailure in interface FailureInformation
Returns:
True if the fiber is failed.

isDepthFailure

public boolean isDepthFailure()
Determines if fiber, the lambdas in the fiber, or the link is failed. At least one lambda and the link must work to return a false (conrol lambda incl.).

Returns:
True if the fiber or its related components are failed.

isProtection

public boolean isProtection()
Informs if the fiber is used to protect an other fiber.

Returns:
The attibute protection.

getProtectionMode

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

Returns:
The int that indicates the mode.

isUsed

public boolean isUsed()
Informs if the fiber is used.

Returns:
True if the fiber is used.

isBidirectional

public boolean isBidirectional()
Returns if the fiber is bidirectional.

Returns:
true if the fiber is bidirectional.
Since:
1.1

removeLambda

public void removeLambda(Lambda lambda)
Delete a lambda in this fiber.

Parameters:
lambda - The lambda to remove.

setFailure

public void setFailure(boolean newValue)
Set the attribute failure.

Parameters:
newValue - The new value.

getReceiverONIC

protected ONIC getReceiverONIC()
Deprecated. use getHost2ONIC() instead.

Determines the receiver ONIC.

Returns:
the receivers ONIC

getHost2ONIC

protected ONIC getHost2ONIC()
Determines the receiver ONIC.

Returns:
the receivers ONIC
Since:
1.1

getSenderONIC

protected ONIC getSenderONIC()
Deprecated. use getHost1ONIC() instead.

Determines the sender ONIC.

Returns:
the senders ONIC

getHost1ONIC

protected ONIC getHost1ONIC()
Determines the sender ONIC.

Returns:
the senders ONIC
Since:
1.1

setPortID

public void setPortID(boolean host2,
                      int id)
               throws IllegalIDException,
                      DataIntegrityException
Set the fiber's id. The ID must be unique in the ONIC.

Parameters:
host2 - indicates if this port id is on the side of host2 (==receiver) if true or the side of host1 (senders).
id - The new id.
Throws:
IllegalIDException - the given id is illegal (<0).
DataIntegrityException - the id is already used.

setID

public void setID(int newId)
           throws IllegalIDException,
                  DataIntegrityException
Set the fiber's id. The id is unique in the onic / optical link

Parameters:
newId - The new id.
Throws:
IllegalIDException - the given id is illegal (<0).
DataIntegrityException - the id is already used.

setProtection

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

Parameters:
protection - The new value.

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

setReceiverID

public void setReceiverID(int receiverID)
                   throws DataIntegrityException
Deprecated. use setHost2ID instead.

Set the ID of the receiver for this fiber.

Parameters:
receiverID - the ID of an ExtRouter.
Throws:
DataIntegrityException - if the fiber is not connected to the host with this id.

setHost2ID

public void setHost2ID(int host2ID)
                throws DataIntegrityException
Set the ID of the host2 (receiver for unidirectional links) of this fiber.

Parameters:
host2ID - the ID of an ExtRouter.
Throws:
DataIntegrityException - if the fiber is not connected to the host with this id.
Since:
1.1

setUsed

public void setUsed(boolean used)
Set the attribute used.

Parameters:
used - The used value.

setBidirectional

public void setBidirectional(boolean bidirectional)
Set the fiber as uni- or bidirectional

Parameters:
bidirectional - if true, the fiber becomes bidirectional.
Since:
1.1

setStartWavelength

public void setStartWavelength(double wavelength)
Set the startWavelength.

Parameters:
wavelength - The starting value for wavelength.

getStartWavelength

public double getStartWavelength()
Get the starting wavelength value.

Returns:
The starting wavelength value.

setDeltaWavelength

public void setDeltaWavelength(double deltaWavelength)
Set the deltaWavelength.

Parameters:
deltaWavelength - The value for the space between 2 lambdas.

getDeltaWavelength

public double getDeltaWavelength()
Get the deltaWavelength value.

Returns:
The deltaWavelength value.

getDataLambdas

public Lambda[] getDataLambdas()
Returns an array containing all data lambdas.

Returns:
an array of lambdas.

getControlLambdas

public Lambda[] getControlLambdas()
Returns all control lambdas. The first element in the array is the default control lambda received by getControlLambda(), the following control lambdas are looked up by checking the lambda array.

Returns:
an array of control lambdas.

createArray

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

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

setNoElements

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

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

configOptional

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

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

configID

protected void configID(java.lang.String value)
                 throws com.renesys.raceway.DML.configException
Configure the optional parameters of the Fiber.

Parameters:
value - The value of the id.
Throws:
com.renesys.raceway.DML.configException - The value is not valid.

configHost2

protected void configHost2(com.renesys.raceway.DML.Configuration cfg)
                    throws com.renesys.raceway.DML.configException
Configures host2 or the receiver. This depends on the direction of the fiber.

Parameters:
cfg - The configuration object.
Throws:
com.renesys.raceway.DML.configException - If the configuration is not valid.

configPortID

protected void configPortID(com.renesys.raceway.DML.Configuration cfg)
                     throws com.renesys.raceway.DML.configException
Configure the ports of the fiber.

Parameters:
cfg - The configuration object.
Throws:
com.renesys.raceway.DML.configException - The port configuration is not good.

configLambdas

protected void configLambdas(com.renesys.raceway.DML.Configuration cfg)
                      throws com.renesys.raceway.DML.configException
Configure the lambdas of the fiber.

Parameters:
cfg - The configuration object.
Throws:
com.renesys.raceway.DML.configException - The port configuration is not good.

generateLambdas

protected void generateLambdas(double fiberBandwidth,
                               int noLambdas,
                               boolean control)
                        throws com.renesys.raceway.DML.configException
Autogeneration of the lambdas.

Parameters:
fiberBandwidth - The bandwidth of the fiber
noLambdas - The number of lambdas to add in the fiber
control - Indicates if we have to have control lambdas
Throws:
when - a DataIntegrity occurs.
com.renesys.raceway.DML.configException

config

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

Parameters:
cfg - The configuration object.
Throws:
com.renesys.raceway.DML.configException - The configuration is not good.

toString

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

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

getNextWavelength

public double getNextWavelength()
Get the next available wavelength

Returns:
the wavelength

isWavelengthUsed

public boolean isWavelengthUsed(double wavelength)
Check if this wavelength is used in one of the lambda

Parameters:
wavelength - The wavelength to check.
Returns:
true if the wavelength is used

getBandwidth

public double getBandwidth(int type)
Compute the max. available bandwidth.

Parameters:
type - The type of requested bandwidth (Fiber.BW_ALL, Fiber.BW_CONTROL, or Fiber.BW_DATA).
Returns:
the bandwidth

getMaximumBandwidth

public double getMaximumBandwidth(int type)
Compute the maximum bandwidth.

Parameters:
type - The type of requested bandwidth (Fiber.BW_ALL, Fiber.BW_CONTROL, or Fiber.BW_DATA).
Returns:
The maximum bandwidth of this fiber.

getBandWidth

public double getBandWidth(int type,
                           boolean maximum)
Compute the bandwidth. The available bandwidth will be calculated by using the lambdas that are available and not reserved only.

Parameters:
type - The type of requested bandwidth (Fiber.BW_ALL, Fiber.BW_CONTROL, or Fiber.BW_DATA).
maximum - Indicates if the result is the available bandwith (false) or the maximum bandwidth (true).
Returns:
the bandwidth

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.

notifyONIC

private void notifyONIC()
Notifies the ONIC for a failed fiber.