SSF.Net
Class OpNet

java.lang.Object
  |
  +--com.renesys.raceway.SSF.Entity
        |
        +--SSF.Net.Net
              |
              +--SSF.Net.OpNet
All Implemented Interfaces:
com.renesys.raceway.DML.Configurable
Direct Known Subclasses:
Glass

public class OpNet
extends Net

Top-level modeling class for a network simulation. One OpNet serves as the initializer for the entire simulation; it contains hosts, routers (which are hosts), and links. Net also serves as the central resource for clock granularity information and translation among NHI, CIDR, and IP addressing schemes.

Net may be run from the command line; use the -help flag to learn the syntax. This class is an extension of the class Net of SSFNet

 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 configured
          If configured it will be set to true.
private  java.util.Vector finalizers
          Same use as SSFNet
private  long hct
          The number of nodes in the net
private static java.util.Hashtable timelineMap
           
 
Fields inherited from class SSF.Net.Net
cidrMap, frequency, generatorName, hosts, RunTime, sharingLevel, STREAM_PER_DISTRIBUTION, STREAM_PER_HOST, STREAM_PER_PROTOCOL, STREAM_PER_TIMELINE, streamName
 
Fields inherited from class com.renesys.raceway.SSF.Entity
 
Constructor Summary
(package private) OpNet()
          Deprecated. Use the class Glasss.class instead of OpNet.class
 
Method Summary
static SSF.Util.Random.RandomDistribution accessRandomDistribution(ProtocolSession forProtocol, com.renesys.raceway.DML.Configuration distcfg, java.lang.String requestName)
          Returns a reference to a random distribution that will be shared by consumers depending the value of .Net.randomstream.reproducibility_level Specification of the RandomDistribution is via a Configuration.
static SSF.Util.Random.RandomDistribution accessRandomDistribution(ProtocolSession forProtocol, java.lang.String distName, java.lang.String requestName)
          Returns a reference to a random distribution that will be shared by consumers depending the value of .Net.randomstream.reproducibility_level Specification of the RandomDistribution is by a name recognized by class method RandomStream.getDistribution(); the returned handle is for default values of the distribution's parameters.
static SSF.Util.Random.RandomStream accessRandomStream(ProtocolSession forProtocol, java.lang.String requestName)
          Returns a reference to a raw random number generator output specified by the global attribute .Net.randomstream; that will be shared by consumers depending the value of .Net.randomstream.reproducibility_level.
 void addAlgorithm(OpNet net, com.renesys.raceway.DML.Configuration algoCfg)
          Add an algorithm.
private  OpticalChannelSegment checkSegment(ExtRouter source, ExtRouter dest, int port, int lambda)
          Check if the segment exists between two nodes
 void computeIP()
          compute the IP addresses
private  void config_new_link(link L, com.renesys.raceway.DML.Configuration lcfg, java.lang.String default_timeline)
          Configure a new link
private  void config_new_router_or_host(Host H, com.renesys.raceway.DML.Configuration hcfg, java.lang.String default_timeline)
          Configure a new node
 void config(com.renesys.raceway.DML.Configuration cfg)
          Configure a network model.
private  Algorithm configAlgo(com.renesys.raceway.DML.Configuration cfg)
          Configure and return a centralized algorithm.
private  void configAlgorithms(com.renesys.raceway.DML.Configuration config)
          Configure the centralized algorithms
private  void configConnections(com.renesys.raceway.DML.Configuration cfg)
          Configure connections.
private  void configHostsRouters(com.renesys.raceway.DML.Configuration cfg)
          Configure the hosts and routers within the network.
private  void configHostsRouters(com.renesys.raceway.DML.Configuration cfg, java.lang.String in_nhi, java.lang.String default_timeline)
          Configure all nodes of this net.
private  void configLinks(com.renesys.raceway.DML.Configuration cfg)
          Configure all links of this net.
private  void configLinks(com.renesys.raceway.DML.Configuration cfg, java.lang.String in_nhi, java.lang.String default_timeline)
          Configure all links of this net.
private  void configNonStaticConnection(com.renesys.raceway.DML.Configuration cfg)
          Parse the DML to configure a non-static lightPath
 void configRandomStreams(com.renesys.raceway.DML.Configuration cfg)
          Configure the random streams.
private  void configStaticConnection(com.renesys.raceway.DML.Configuration cfg)
          Parse the DML to configure a static lightPath
private  void configStaticRoutes()
          Config the static routes for the IP layer
static void configTimeline(com.renesys.raceway.SSF.Entity forEntity, com.renesys.raceway.DML.Configuration cfg)
          Helper function to let Hosts, Routers, Links set their alignments consistently from their respective config files, which share a common optional "alignment" attribute.
private static void configTimeline(com.renesys.raceway.SSF.Entity forEntity, java.lang.String alignspec)
          configure the timeline for the given entity
private  void configureChannel(com.renesys.raceway.DML.Configuration cfg, java.util.Vector nodes, OpticalChannel oChannel)
          Set a channel out of the DML
 void createTopology(java.lang.String[] argv)
          This method is used to create a topology
 long getFrequency()
          Get the frequency of this net
 java.util.Hashtable getHosts()
          Get the table of the hosts.
(package private) static void glassMain(java.lang.String[] argv)
          Command line driver for the Glass class.
 java.lang.String ip_to_nhi(java.lang.String ipaddr)
          Return the global NHI address corresponding to the given IP address
static void main(java.lang.String[] argv)
          not used anymore.
 java.lang.String nhi_to_cidr(java.lang.String naddr)
          Return the CIDR block address corresponding to the given global NHI address.
 java.lang.String nhi_to_ip(java.lang.String naddr)
          Return the IP address corresponding to the given global NHI address
static long seconds(double s)
          Static convenience function for computing number of clock ticks in a given number of seconds; simply returns s*frequency.
 void start(java.lang.String[] argv)
          Start the simulation
static void syntax()
          Dump a summary of command-line syntax to standard error.
protected  void updateIPAdresses()
          Update the IP adresses of all interface Called after a modification in the tree.
 void wrapup(java.lang.Runnable finalizer)
          Same as SSFNet
 
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, toString, wait, wait, wait
 

Field Detail

finalizers

private java.util.Vector finalizers
Same use as SSFNet


hct

private long hct
The number of nodes in the net


timelineMap

private static java.util.Hashtable timelineMap

configured

private boolean configured
If configured it will be set to true.

Constructor Detail

OpNet

OpNet()
Deprecated. Use the class Glasss.class instead of OpNet.class

Default constructor

Method Detail

seconds

public static long seconds(double s)
Static convenience function for computing number of clock ticks in a given number of seconds; simply returns s*frequency. For example, if Net.frequency is 1000 (millisecond resolution), then Net.seconds(0.25) returns 250.

Parameters:
s - The time in seconds
Returns:
The number of clock ticks.

nhi_to_ip

public java.lang.String nhi_to_ip(java.lang.String naddr)
Return the IP address corresponding to the given global NHI address

Overrides:
nhi_to_ip in class Net
Parameters:
naddr - The NHI address.
Returns:
The corresponding IP address.

ip_to_nhi

public java.lang.String ip_to_nhi(java.lang.String ipaddr)
Return the global NHI address corresponding to the given IP address

Overrides:
ip_to_nhi in class Net
Parameters:
ipaddr - The IP address.
Returns:
The corresponding NHI address.

nhi_to_cidr

public java.lang.String nhi_to_cidr(java.lang.String naddr)
Return the CIDR block address corresponding to the given global NHI address.

Overrides:
nhi_to_cidr in class Net
Parameters:
naddr - The NHI address.
Returns:
The CIDR block address.

syntax

public static void syntax()
Dump a summary of command-line syntax to standard error.


glassMain

static void glassMain(java.lang.String[] argv)
Command line driver for the Glass class.

  Syntax: Glass [-nocheck]
                [-dump] 
                [-relax] 
                [-ip a.b.c.d/m] 
                maxtime dmlfile1 [ dmlfile2 [...dmlfileN]]

 -nocheck: don't schema-check the input DML file(s)
 -dump: dump NHI/CIDR/IP address tables, but don't actually run the model
 -relax: fail to enforce strict rules about CIDR/IP attributes
 -ip addr: allocate IP addresses from the given block (default: 0.0.0.0/0)

Parameters:
argv - The command parameters.

main

public static void main(java.lang.String[] argv)
not used anymore.

Parameters:
argv - Not used anymore.

wrapup

public void wrapup(java.lang.Runnable finalizer)
Same as SSFNet

Overrides:
wrapup in class Net

config

public void config(com.renesys.raceway.DML.Configuration cfg)
            throws com.renesys.raceway.DML.configException
Configure a network model.

REQUIRED ATTRIBUTES: none

OBSOLETE ATTRIBUTES:

OPTIONAL ATTRIBUTES:

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

configRandomStreams

public void configRandomStreams(com.renesys.raceway.DML.Configuration cfg)
                         throws com.renesys.raceway.DML.configException
Configure the random streams. Same as SSFNet

Overrides:
configRandomStreams in class Net
Parameters:
cfg - The DML configuration of the random streams.
Throws:
com.renesys.raceway.DML.configException - when a configuration error occured.

accessRandomDistribution

public static SSF.Util.Random.RandomDistribution accessRandomDistribution(ProtocolSession forProtocol,
                                                                          com.renesys.raceway.DML.Configuration distcfg,
                                                                          java.lang.String requestName)
Returns a reference to a random distribution that will be shared by consumers depending the value of .Net.randomstream.reproducibility_level Specification of the RandomDistribution is via a Configuration.

Parameters:
forProtocol - The protocol that share the random distribution
distcfg - The configuration of the random distribution
requestName - The stream name.
Returns:
a reference to a random distribution.

accessRandomDistribution

public static SSF.Util.Random.RandomDistribution accessRandomDistribution(ProtocolSession forProtocol,
                                                                          java.lang.String distName,
                                                                          java.lang.String requestName)
Returns a reference to a random distribution that will be shared by consumers depending the value of .Net.randomstream.reproducibility_level Specification of the RandomDistribution is by a name recognized by class method RandomStream.getDistribution(); the returned handle is for default values of the distribution's parameters. The usage including user-provided distribution parameters may be, from within an instance of a ProtocolSession ('this'):
 import cern.jet.random.*;
 RandomDistribution rnd =
                   Net.accessRandomDistribution(this, "Uniform", "foo");
 ((Uniform)rnd.getImplementation()).setState(0.,1.); // go under the covers
 for (int x=0; x<12000; x++) next_sample = rnd.nextDouble(); // etc.
 

Parameters:
forProtocol - The protocol that share the random distribution
distName - The name of the random distribution
requestName - The stream name.
Returns:
a reference to a random distribution.

accessRandomStream

public static SSF.Util.Random.RandomStream accessRandomStream(ProtocolSession forProtocol,
                                                              java.lang.String requestName)
Returns a reference to a raw random number generator output specified by the global attribute .Net.randomstream; that will be shared by consumers depending the value of .Net.randomstream.reproducibility_level. If .Net.randomstream is not provided, the default is:
 generatorName = "MersenneTwister" 
 stream = "DefaultStream"  // root for the initial seed values, via MD5
 reproducibility_level  = "timeline"

 usage:

 RandomStream rng = Net.accessRandomStream(this, "foo");
 for (int x=0; x<1000; x++) next_sample = rng.nextDouble();
 

Parameters:
forProtocol - The protocol that share the random distribution
requestName - The stream name.
Returns:
a reference to a random distribution.

configHostsRouters

private void configHostsRouters(com.renesys.raceway.DML.Configuration cfg)
                         throws com.renesys.raceway.DML.configException
Configure the hosts and routers within the network.

Parameters:
cfg - The DML configuration of the nodes.
com.renesys.raceway.DML.configException

configHostsRouters

private void configHostsRouters(com.renesys.raceway.DML.Configuration cfg,
                                java.lang.String in_nhi,
                                java.lang.String default_timeline)
                         throws com.renesys.raceway.DML.configException
Configure all nodes of this net.

Parameters:
cfg - The net configuration
in_nhi - The nhi address of the net
default_timeline - The timeline for all links
com.renesys.raceway.DML.configException

config_new_router_or_host

private void config_new_router_or_host(Host H,
                                       com.renesys.raceway.DML.Configuration hcfg,
                                       java.lang.String default_timeline)
                                throws com.renesys.raceway.DML.configException
Configure a new node

Parameters:
H - the new node to configure
hcfg - the node's configuration
default_timeline - The timeline for this node
Throws:
com.renesys.raceway.DML.configException - when an error occurs during the configuration

configAlgorithms

private void configAlgorithms(com.renesys.raceway.DML.Configuration config)
                       throws com.renesys.raceway.DML.configException
Configure the centralized algorithms

Parameters:
config - The configuration of the net
Throws:
com.renesys.raceway.DML.configException - when a configuration error occurs

configAlgo

private Algorithm configAlgo(com.renesys.raceway.DML.Configuration cfg)
                      throws com.renesys.raceway.DML.configException
Configure and return a centralized algorithm.

Parameters:
cfg - The configuration of the new algorithm
Returns:
The confiured CentralizedAlgorithm
Throws:
com.renesys.raceway.DML.configException - when a configuration error occured.

configConnections

private void configConnections(com.renesys.raceway.DML.Configuration cfg)
                        throws com.renesys.raceway.DML.configException
Configure connections.

Throws:
com.renesys.raceway.DML.configException - when a configuration error occured.

configNonStaticConnection

private void configNonStaticConnection(com.renesys.raceway.DML.Configuration cfg)
                                throws com.renesys.raceway.DML.configException
Parse the DML to configure a non-static lightPath

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

configStaticConnection

private void configStaticConnection(com.renesys.raceway.DML.Configuration cfg)
                             throws com.renesys.raceway.DML.configException
Parse the DML to configure a static lightPath

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

configureChannel

private void configureChannel(com.renesys.raceway.DML.Configuration cfg,
                              java.util.Vector nodes,
                              OpticalChannel oChannel)
                       throws com.renesys.raceway.DML.configException
Set a channel out of the DML

Parameters:
cfg - The configuration of the channel.
nodes - The list of nodes on the route.
oChannel - The new optical channel to be configured.
Throws:
com.renesys.raceway.DML.configException - if the channel is invalid.

checkSegment

private OpticalChannelSegment checkSegment(ExtRouter source,
                                           ExtRouter dest,
                                           int port,
                                           int lambda)
                                    throws com.renesys.raceway.DML.configException
Check if the segment exists between two nodes

Parameters:
source - The source node.
dest - The destination node.
port - The output port of the source.
lambda - The output lambda of the source.
Returns:
OpticalChannelSegment
Throws:
com.renesys.raceway.DML.configException - when a configuration error occured.

configTimeline

public static void configTimeline(com.renesys.raceway.SSF.Entity forEntity,
                                  com.renesys.raceway.DML.Configuration cfg)
Helper function to let Hosts, Routers, Links set their alignments consistently from their respective config files, which share a common optional "alignment" attribute. The values associated with that attribute are resolved globally, so that any two Hosts, Routers etc. that specify the same integer or string value will get the same alignment (and will therefore execute on the same processor). Alignments may also be specified for Net attributes, in which case all hosts, routers, and links within the Net get that alignment by default.

The default is to omit all "alignment" attributes, resulting in serial (single timeline) execution.

Parameters:
forEntity - The entity to set up
cfg - The entity configuration

configTimeline

private static void configTimeline(com.renesys.raceway.SSF.Entity forEntity,
                                   java.lang.String alignspec)
configure the timeline for the given entity

Parameters:
forEntity - The entity to set up
alignspec - the alignment specification.

configLinks

private void configLinks(com.renesys.raceway.DML.Configuration cfg)
                  throws com.renesys.raceway.DML.configException
Configure all links of this net.

Parameters:
cfg - The DML configuration of the links.
com.renesys.raceway.DML.configException

configLinks

private void configLinks(com.renesys.raceway.DML.Configuration cfg,
                         java.lang.String in_nhi,
                         java.lang.String default_timeline)
                  throws com.renesys.raceway.DML.configException
Configure all links of this net.

Parameters:
cfg - The net configuration
in_nhi - The nhi address of the net
default_timeline - The timeline for all links
com.renesys.raceway.DML.configException

config_new_link

private void config_new_link(link L,
                             com.renesys.raceway.DML.Configuration lcfg,
                             java.lang.String default_timeline)
                      throws com.renesys.raceway.DML.configException
Configure a new link

Parameters:
L - the new link to configure
lcfg - the link's configuration
default_timeline - The timeline for this link
Throws:
com.renesys.raceway.DML.configException - when an error occurs during the configuration

configStaticRoutes

private void configStaticRoutes()
                         throws com.renesys.raceway.DML.configException
Config the static routes for the IP layer

Throws:
com.renesys.raceway.DML.configException - if an error occurs

createTopology

public void createTopology(java.lang.String[] argv)
                    throws com.renesys.raceway.DML.configException,
                           ProtocolException,
                           com.renesys.raceway.DML.dmlException
This method is used to create a topology

Parameters:
argv - The same parameter as the main function
Throws:
com.renesys.raceway.DML.configException - If an exception occurs or the configuration will be calles a second time.
ProtocolException - An exception in a ProtocolSession occured
com.renesys.raceway.DML.dmlException - A DML exception occured.

start

public void start(java.lang.String[] argv)
Start the simulation

Parameters:
argv - The same parameter as the main function

getHosts

public java.util.Hashtable getHosts()
Get the table of the hosts.

Returns:
The hashtable of the hosts.

getFrequency

public long getFrequency()
Get the frequency of this net

Returns:
The frequency

computeIP

public void computeIP()
               throws com.renesys.raceway.DML.configException
compute the IP addresses

Throws:
com.renesys.raceway.DML.configException - If an exception occurs or the configuration

updateIPAdresses

protected void updateIPAdresses()
                         throws com.renesys.raceway.DML.configException
Update the IP adresses of all interface Called after a modification in the tree.

Throws:
com.renesys.raceway.DML.configException - If an exception occurs or the configuration

addAlgorithm

public void addAlgorithm(OpNet net,
                         com.renesys.raceway.DML.Configuration algoCfg)
                  throws com.renesys.raceway.DML.configException
Add an algorithm.

Parameters:
net - The net object that contains the topology.
algoCfg - The algorithm configuration
Throws:
com.renesys.raceway.DML.configException - If an exception occurs or the configuration