gov.nist.antd.merlin.util
Class ComponentCreator

java.lang.Object
  |
  +--gov.nist.antd.merlin.util.ComponentCreator

public final class ComponentCreator
extends java.lang.Object

The component creator is used to create OXC's, Links, Fibers even after the topology is created. This tool will be used by network modeling tools.

 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

Field Summary
static int nextIP
          The "fake" IP adress to use for the new interfaces
 
Constructor Summary
private ComponentCreator()
          private constructor to avoid instantiation
 
Method Summary
static void addCentralizedAlgorithm(java.lang.String name, java.lang.String use, java.lang.String option, Glass net)
          Add an algorithm
static void addProtocolSession(java.lang.String name, java.lang.String use, java.lang.String option, Glass net)
          Add a protocolSession in a host
static void addProtocolSession(java.lang.String name, java.lang.String use, java.lang.String option, Host host)
          Add a protocolSession in a host
static void addScriptedEvent(java.lang.String type, double time, java.lang.String option, Glass net)
          Add a new scripted event
static Fiber createFiber(OpticalLink forLink, int host2ID, boolean bidir)
          This method creates a preconfigured Fiber and adds this to the given OpticalLink.
static Host createHost(Glass inNet, java.lang.String nhi)
          This method creates a preconfigured Router.
static Lambda createLambda(Fiber forFiber)
          This method creates a preconfigured Lambda and adds this to the given Fiber.
static LSR createLSR(Glass inNet, java.lang.String nhi)
          This method creates a preconfigured OXCEdgeRouter.
(package private) static NIC createNIC(Host forHost)
          This method creates a preconfigured NIC for the given host.
(package private) static ONIC createONIC(ExtRouter forHost)
          This method creates a preconfigured ONIC for the given host.
static OpticalLink createOpticalLink(ExtRouter host1, ExtRouter host2, boolean bidirectional)
          This method creates a preconfigured Link and connects the two given hosts with that link.
static OXC createOXC(Glass inNet, java.lang.String nhi)
          This method creates a preconfigured OXC.
static OXCEdgeRouter createOXCEdgeRouter(Glass inNet, java.lang.String nhi)
          This method creates a preconfigured OXCEdgeRouter.
static link createPtPLink(Host host1, Host host2)
          This method creates a preconfigured Link and connects the two given hosts with that link.
static Router createRouter(Glass inNet, java.lang.String nhi)
          This method creates a preconfigured Router.
static int getNextIPAddress()
          Get the available IP adresse and increment it
static int getNextNodeId(Glass net)
          Get the next available host id in the given net
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextIP

public static int nextIP
The "fake" IP adress to use for the new interfaces

Constructor Detail

ComponentCreator

private ComponentCreator()
private constructor to avoid instantiation

Method Detail

getNextIPAddress

public static int getNextIPAddress()
Get the available IP adresse and increment it

Returns:
the next available IP

createLambda

public static Lambda createLambda(Fiber forFiber)
This method creates a preconfigured Lambda and adds this to the given Fiber.

Parameters:
forFiber - the Fiber the Lambda has to be generated for.
Returns:
The generated preconfigured lambda.
Throws:
java.lang.RuntimeException - Some program bug - Should never occur.

createFiber

public static Fiber createFiber(OpticalLink forLink,
                                int host2ID,
                                boolean bidir)
This method creates a preconfigured Fiber and adds this to the given OpticalLink. The fiber will contain 2 data Lambdas and one control lambda with. The fiber is unidirectional

Parameters:
forLink - The OpticalLink the Lambda has to be generated for.
host2ID - The ID of host2 (the receiver).
bidir - Inidicate if the fiber is bidirectional.
Returns:
The generated preconfigured Fiber.
Throws:
java.lang.RuntimeException - Some program bug - Should never occur.

createONIC

static ONIC createONIC(ExtRouter forHost)
This method creates a preconfigured ONIC for the given host.

Parameters:
forHost - The host the onic has to be configured for.
Returns:
The generated preconfigured ONIC.
Throws:
java.lang.RuntimeException - Some program bug - Should never occur.

createNIC

static NIC createNIC(Host forHost)
This method creates a preconfigured NIC for the given host.

Parameters:
forHost - The host the nic has to be configured for.
Returns:
The generated preconfigured NIC.
Throws:
java.lang.RuntimeException - Some program bug - Should never occur.

createOpticalLink

public static OpticalLink createOpticalLink(ExtRouter host1,
                                            ExtRouter host2,
                                            boolean bidirectional)
This method creates a preconfigured Link and connects the two given hosts with that link. This Method will also add a ONINC to the given host.

Parameters:
host1 - The host 1
host2 - The host 2
bidirectional - Indicates if the new link must contain a bidirectional fiber or two unidirectional fibers.
Returns:
The generated preconfigured Link. (Bidirectional)
Throws:
java.lang.RuntimeException - Some program bug - Should never occur.

createPtPLink

public static link createPtPLink(Host host1,
                                 Host host2)
This method creates a preconfigured Link and connects the two given hosts with that link. This Method will also add a ONINC to the given host.

Parameters:
host1 - The host 1
host2 - The host 2
Returns:
The generated preconfigured Link. (Bidirectional)
Throws:
java.lang.RuntimeException - Some program bug - Should never occur.

createOXCEdgeRouter

public static OXCEdgeRouter createOXCEdgeRouter(Glass inNet,
                                                java.lang.String nhi)
This method creates a preconfigured OXCEdgeRouter. The Router contains the following protocolSessions: ip, oxcswitch, framingAdaptation

Parameters:
inNet - The OpNet where to add the new OXCEdgeRouter.
nhi - The nhi to use for the new OXCEdgeRouter.
Returns:
The generated preconfigured OXCEdgeRouter.
Throws:
java.lang.RuntimeException - Some program bug - Should never occur.

createLSR

public static LSR createLSR(Glass inNet,
                            java.lang.String nhi)
This method creates a preconfigured OXCEdgeRouter. The Router contains the following protocolSessions: ip, oxcswitch, framingAdaptation

Parameters:
inNet - The OpNet where to add the new OXCEdgeRouter.
nhi - The nhi to use for the new OXCEdgeRouter.
Returns:
The generated preconfigured OXCEdgeRouter.
Throws:
java.lang.RuntimeException - Some program bug - Should never occur.

createOXC

public static OXC createOXC(Glass inNet,
                            java.lang.String nhi)
This method creates a preconfigured OXC. The OXC contains the following protocolSessions: ip, oxcswitch, framingAdaptation

Parameters:
inNet - The OpNet where to add the new OXC.
nhi - The nhi to use for the new OXC.
Returns:
The generated preconfigured OXC or null.
Throws:
java.lang.RuntimeException - Some program bug - Should never occur.

createRouter

public static Router createRouter(Glass inNet,
                                  java.lang.String nhi)
This method creates a preconfigured Router.

Parameters:
inNet - The OpNet where to add the new Router.
nhi - The nhi to use for the new Router.
Returns:
The generated preconfigured Router or null.
Throws:
java.lang.RuntimeException - Some program bug - Should never occur.

createHost

public static Host createHost(Glass inNet,
                              java.lang.String nhi)
This method creates a preconfigured Router.

Parameters:
inNet - The OpNet where to add the new Router.
nhi - The nhi to use for the new Router.
Returns:
The generated preconfigured Router.
Throws:
java.lang.RuntimeException - Some program bug - Should never occur.

getNextNodeId

public static int getNextNodeId(Glass net)
Get the next available host id in the given net

Parameters:
net - The topology container.
Returns:
the next available host id.

addCentralizedAlgorithm

public static void addCentralizedAlgorithm(java.lang.String name,
                                           java.lang.String use,
                                           java.lang.String option,
                                           Glass net)
Add an algorithm

Parameters:
name - The name of the algorithm
use - The class name of the algorithm
option - The optional attributes of this algorithm
net - The net that stores the algorithms

addProtocolSession

public static void addProtocolSession(java.lang.String name,
                                      java.lang.String use,
                                      java.lang.String option,
                                      Host host)
Add a protocolSession in a host

Parameters:
name - The name of the protocol
use - The class name of the protocol
option - The optional attributes of this algorithm
host - The host where to add the protocol

addProtocolSession

public static void addProtocolSession(java.lang.String name,
                                      java.lang.String use,
                                      java.lang.String option,
                                      Glass net)
Add a protocolSession in a host

Parameters:
name - The name of the protocol
use - The class name of the protocol
option - The optional attributes of this algorithm
net - The OpNet that contains the nodes

addScriptedEvent

public static void addScriptedEvent(java.lang.String type,
                                    double time,
                                    java.lang.String option,
                                    Glass net)
Add a new scripted event

Parameters:
type - The event's type
time - The time to fire this event
option - The attributes other than type and time (like id)
net - The net object