SSF.Net
Class _NIC

java.lang.Object
  |
  +--SSF.OS.ProtocolSession
        |
        +--SSF.Net.NIC
              |
              +--SSF.Net._NIC
All Implemented Interfaces:
com.renesys.raceway.DML.Configurable, FailureInformation
Direct Known Subclasses:
ONIC

public class _NIC
extends NIC
implements FailureInformation

This class contains modificatrion that has to be moved later in the NIC. this class is used for compatibility purposes.
The _NIC has the following dml setup attributes:
use FailureModule useDefault FailureModule for all _NICs that do not have a specific failure module installed.

 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

Nested Class Summary
private  class _NIC.NotificationTimer
          This class is used to detect the lol event at the simulation time it occurs.
 
Field Summary
private  Callback callbackModule
          The module that implements the failure handling.
private  boolean debug
          For debug purposes of this NIC only (use in dml: debug true)
protected static boolean DEBUG
          For debug purposes of all NICS (use in dml: DEBUG true).
protected  java.lang.String defaultFailureModuleName
          No default failure module available for this class.
private  boolean failure
          If the _NIC has a failure.
private  FailureModule failureModule
          The failure processing module.
protected  boolean inConfiguration
          Indicator if the class is in the configuration mode (true).
 double inPacketBytes
          Number of already received bytes.
private  int inPacketCount
          Number of already received packages.
private  InputMonitor inputMonitor
          Input packet monitor.
private  MPLSInterfaceInfo interfaceInfo
          The interface information.
private  boolean isLSRInterface
           
private  boolean messageMonitor
          Indicates if the message monitoring is enabled or not.
private  boolean multicast
          Indicates if the interfacetype is a tunnel.
 double outPacketBytes
           
 int outPacketCount
           
 double prevInPacketBytes
          Size of received bytes since the lase request.
private  int prevInPacketCount
          of received packets since the lase request.
 double prevOutPacketBytes
           
 int prevOutPacketCount
           
private  boolean tunnel
          Indicates if the interfacetype is a tunnel.
 
Fields inherited from class SSF.Net.NIC
attachedProtocol, BINARY_TCPDUMP, BIT_RATE, buffersize, CHECK_FOR_SYNS, COUNT_FLAKY_DROPS, DEFAULT_BIT_RATE, DEFAULT_BUFFERSIZE, DEFAULT_DELAY, DEFAULT_FLAKINESS, DELAY, dumpTo, FLAKINESS, flakyDrops, flakyGen, FREQUENCY, ID, ifaceUp, IN, ipAddr, isVirtual, link_hw, maskBits, OUT, queueManager, queueMonitor, receiver
 
Fields inherited from class SSF.OS.ProtocolSession
name, use
 
Constructor Summary
protected _NIC(ProtocolGraph g, int use_id)
          Constructs the _NIC.
 
Method Summary
protected  void checkLinkStatus(FailureInformation component)
          This method will be called to detect a failure or a recovery of components.
 void config(com.renesys.raceway.DML.Configuration cfg)
          Configure the ONIC.
 void configFailureModule(com.renesys.raceway.DML.Configuration cfg)
          Configures the failure module.
private  void createInputMonitor(com.renesys.raceway.DML.Configuration config)
          Instantiate and configure an input monitor
protected  void debug(java.lang.String message)
          Generates the debug output.
 double getBandwidth()
           
 FailureModule getFailureModule()
          Returns the internal failure module.
 double getInPacketBytes()
          Returns the number of bytes since the last request of received bytes.
 int getInPacketCount()
          Returns the number of packets since the last request of received packets.
 MPLSInterfaceInfo getInterfaceInfo()
          Returns the Interface information.
 int getInterfaceType()
          Returns the type of interface.
 double getOutPacketBytes()
           
 int getOutPacketCount()
           
 tcpDump getTcpDump()
          Return the TcpDump or null
 void init()
          Overwrite the init to initialise the input monitor
 boolean isDebug()
          Return if the ONIC is in debug mode
 boolean isFailure()
          Returns the failure status of the ONIC.
static boolean isGlobalDebug()
          This static method returns the global debug state of the ONICs.
 boolean isIfaceUp()
          Returns true if the interface is up.
 boolean isLSRInterface()
          Returns if the interface is a LSR interface.
 boolean isMessageMonitor()
          Returns true if this interface provides message monitoring.
protected  void prepareTimer(EventMessage msg, double afterDelay)
          This method determines the affected lambdas of a los of light or its recovery and creates a timer to handle the event.
protected  boolean processOutMessage(ProtocolMessage message)
          This method process and monitor output messaged.
protected  void processPacketEvent(PacketEvent pevt)
          This method is calles by the package receiving process.
 boolean push(ProtocolMessage message, ProtocolSession fromSession)
          Process a ProtocolMessage pushed down from above, by handing it off to the queueManager to be written out to the network.
 void registerForFailure(Callback newCallbackModule)
          Registers for failures in the link.
protected  void sendMessage(short messageType, java.lang.Object message)
          Checks if the Eventhandler has receivers and this object is not in the configuration mode, this message will send the specified event.
 void setFailure(boolean newValue)
          Set and reset the failure value.
 void setFailureModule(java.lang.String className)
          Set the failure module fopr this ONIC.
 void setInterfaceInfo(MPLSInterfaceInfo newInterfaceInfo)
          Set the Interface information.
 void setInterfaceType(int newType)
          Set the interface type.
 void setLSRInterface(boolean isLSR)
          Specify if the interface is a LSR interface or not.
 void setMessageMonitor(boolean enable)
          Set the message monitoring for true or false.
 
Methods inherited from class SSF.Net.NIC
bitrate, close, delay, down, drop_flaky, drop, frequency, interfaceIdentifier, ipAddrString, isUp, open, toString, up
 
Methods inherited from class SSF.OS.ProtocolSession
closed, debugIdentifier, inGraph, opened, pushAfterDelay, pushAfterDelayFailed, setGraph, version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

protected static boolean DEBUG
For debug purposes of all NICS (use in dml: DEBUG true).


messageMonitor

private boolean messageMonitor
Indicates if the message monitoring is enabled or not.

Since:
1.8

debug

private boolean debug
For debug purposes of this NIC only (use in dml: debug true)


failure

private boolean failure
If the _NIC has a failure. (Default = false)


inPacketCount

private int inPacketCount
Number of already received packages.


prevInPacketCount

private int prevInPacketCount
of received packets since the lase request.


inPacketBytes

public double inPacketBytes
Number of already received bytes.


prevInPacketBytes

public double prevInPacketBytes
Size of received bytes since the lase request.


outPacketCount

public int outPacketCount

prevOutPacketCount

public int prevOutPacketCount

outPacketBytes

public double outPacketBytes

prevOutPacketBytes

public double prevOutPacketBytes

interfaceInfo

private MPLSInterfaceInfo interfaceInfo
The interface information. Specialized for MPLS Interfaces.


tunnel

private boolean tunnel
Indicates if the interfacetype is a tunnel.


multicast

private boolean multicast
Indicates if the interfacetype is a tunnel.


isLSRInterface

private boolean isLSRInterface

callbackModule

private Callback callbackModule
The module that implements the failure handling.


failureModule

private FailureModule failureModule
The failure processing module. If null after configuration the failure detection is disabled.


defaultFailureModuleName

protected java.lang.String defaultFailureModuleName
No default failure module available for this class. Subclasses have to overwrite this value to get a default failure module.


inputMonitor

private InputMonitor inputMonitor
Input packet monitor. Use the interface PacketQueueMonitor.


inConfiguration

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

Constructor Detail

_NIC

protected _NIC(ProtocolGraph g,
               int use_id)
        throws ProtocolException
Constructs the _NIC.

Parameters:
g - The protocol graph attached to this ONIC.
use_id - The id to use for this ONIC.
Throws:
ProtocolException
Method Detail

isGlobalDebug

public static final boolean isGlobalDebug()
This static method returns the global debug state of the ONICs.

Returns:
true if all ONICs are in the debug mode.

debug

protected void debug(java.lang.String message)
Generates the debug output.

Parameters:
message - The message that has to be printed.

isDebug

public boolean isDebug()
Return if the ONIC is in debug mode

Returns:
true if the ONIC is in debug mode

processPacketEvent

protected void processPacketEvent(PacketEvent pevt)
This method is calles by the package receiving process.

Overrides:
processPacketEvent in class NIC
Parameters:
pevt - the package event.

processOutMessage

protected boolean processOutMessage(ProtocolMessage message)
This method process and monitor output messaged.

Parameters:
message - The ProtocolMessage.

sendMessage

protected void sendMessage(short messageType,
                           java.lang.Object message)
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.
message - The message that has to be send.
Since:
2.2

config

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

Specified by:
config in interface com.renesys.raceway.DML.Configurable
Overrides:
config in class NIC
Parameters:
cfg - The configuration object.
Throws:
com.renesys.raceway.DML.configException

configFailureModule

public void configFailureModule(com.renesys.raceway.DML.Configuration cfg)
                         throws com.renesys.raceway.DML.configException
Configures the failure module.

Parameters:
cfg - the configuration object of the _NIC.
Throws:
com.renesys.raceway.DML.configException - when the configuration of the failure module fails.

createInputMonitor

private void createInputMonitor(com.renesys.raceway.DML.Configuration config)
                         throws com.renesys.raceway.DML.configException
Instantiate and configure an input monitor

Parameters:
config - The DML configuration of the monitor
com.renesys.raceway.DML.configException

registerForFailure

public void registerForFailure(Callback newCallbackModule)
Registers for failures in the link.

Parameters:
newCallbackModule - the module that has to be registered.

prepareTimer

protected void prepareTimer(EventMessage msg,
                            double afterDelay)
This method determines the affected lambdas of a los of light or its recovery and creates a timer to handle the event.

Parameters:
msg - The message that has to be propagated.
afterDelay - the delay.

init

public void init()
          throws ProtocolException
Overwrite the init to initialise the input monitor

Overrides:
init in class NIC
Throws:
ProtocolException - when the init failed

checkLinkStatus

protected void checkLinkStatus(FailureInformation component)
This method will be called to detect a failure or a recovery of components. This method will create a SSF timer that notifies the registered protocols in this simulation time tick plus a delay specified in the eventmessage.
The components ONIC, OpticalLink, Fiber, and Lambda are calling this method after they processed their setFailure (boolean) method.

Parameters:
component - The component that requested the checking of light status

setFailureModule

public void setFailureModule(java.lang.String className)
                      throws com.renesys.raceway.DML.configException
Set the failure module fopr this ONIC.

Parameters:
className - The name of the failure module class.
Throws:
com.renesys.raceway.DML.configException - an configException occured.

getFailureModule

public FailureModule getFailureModule()
Returns the internal failure module.

Returns:
th einternal failure model.

isFailure

public boolean isFailure()
Returns the failure status of the ONIC. The ONIC also indicates a failure if the host (OXCEdgeRouter) reports an error (isFailure()==true).

Specified by:
isFailure in interface FailureInformation
Returns:
true if an failure was detected.

setFailure

public void setFailure(boolean newValue)
Set and reset the failure value.

Parameters:
newValue - the new failure value.

getInPacketCount

public int getInPacketCount()
Returns the number of packets since the last request of received packets.

Returns:
The number of packets since the last request.

getInPacketBytes

public double getInPacketBytes()
Returns the number of bytes since the last request of received bytes.

Returns:
The number of bytes since the last request.

getOutPacketCount

public int getOutPacketCount()

getOutPacketBytes

public double getOutPacketBytes()

getBandwidth

public double getBandwidth()

isIfaceUp

public boolean isIfaceUp()
Returns true if the interface is up.

Returns:
if the interface is up.

setInterfaceInfo

public void setInterfaceInfo(MPLSInterfaceInfo newInterfaceInfo)
Set the Interface information.

Parameters:
newInterfaceInfo - the interface information.

getInterfaceInfo

public MPLSInterfaceInfo getInterfaceInfo()
Returns the Interface information.

Returns:
the interface information.

setInterfaceType

public void setInterfaceType(int newType)
Set the interface type.


getInterfaceType

public int getInterfaceType()
Returns the type of interface. If the interface is an instance of ONIC the returnvalue will be MPLSInterfaceInfo.ONIC_TYPE. Is the interface not an instance of ONIC or a subclass of it, the return value will be MPLSInterfaceInfo.NIC_TYPE. I sthe interface is a tunnel the return value will be MPLSInterfaceInfo.TUNNE_TYPE.

Returns:
the ype of interface.

setLSRInterface

public void setLSRInterface(boolean isLSR)
Specify if the interface is a LSR interface or not.

Parameters:
isLSR - specifies if the interface is a LSR interface or not.

isLSRInterface

public boolean isLSRInterface()
Returns if the interface is a LSR interface.

Returns:
if the interface is a LSR interface.

push

public boolean push(ProtocolMessage message,
                    ProtocolSession fromSession)
Process a ProtocolMessage pushed down from above, by handing it off to the queueManager to be written out to the network. This method overwrites the push method of NIC.

Overrides:
push in class NIC
Parameters:
message - The protocol message (header) that has to be pushed.
fromSession - The session that initiated the push call.
Returns:
true if the push call proceeded, otherwise false.

getTcpDump

public tcpDump getTcpDump()
Return the TcpDump or null

Returns:
The tcpDump

setMessageMonitor

public void setMessageMonitor(boolean enable)
Set the message monitoring for true or false.

Since:
1.8

isMessageMonitor

public boolean isMessageMonitor()
Returns true if this interface provides message monitoring.

Returns:
true if this interface provides message monitoring.
Since:
1.8