Saturday 2 May 2015

NS (version 2) is an object-oriented, discrete event driven network simulator developed at UC Berkely written in C++ and OTcl. NS is primarily useful for simulating local and wide area networks. Although NS is fairly easy to use once you get to know the simulator, it is quite difficult for a first time user, because there are few user-friendly manuals. Even though there is a lot of documentation written by the developers which has in depth explanation of the simulator, it is written with the depth of a skilled NS user. The purpose of this project is to give a new user some basic idea of how the simultor works, how to setup simulation networks, where to look for further information about network components in simulator codes, how to create new network components, etc., mainly by giving simple examples and brief explanations based on our experiences. Although all the usage of the simulator or possible network simulation setups may not be covered in this project, the project should help a new user to get started quickly.

Purpose

NS (version 2) is an object-oriented, discrete event driven network simulator developed at UC Berkely written in C++ and OTcl. NS is primarily useful for simulating local and wide area networks. Although NS is fairly easy to use once you get to know the simulator, it is quite difficult for a first time user, because there are few user-friendly manuals. Even though there is a lot of documentation written by the developers which has in depth explanation of the simulator, it is written with the depth of a skilled NS user. The purpose of this project is to give a new user some basic idea of how the simultor works, how to setup simulation networks, where to look for further information about network components in simulator codes, how to create new network components, etc., mainly by giving simple examples and brief explanations based on our experiences. Although all the usage of the simulator or possible network simulation setups may not be covered in this project, the project should help a new user to get started quickly.

Overview

NS is an event driven network simulator developed at UC Berkeley that simulates variety of IP networks. It implements network protocols such as TCP and UPD, traffic source behavior such as FTP, Telnet, Web, CBR and VBR, router queue management mechanism such as Drop Tail, RED and CBQ, routing algorithms such as Dijkstra, and more. NS also implements multicasting and some of the MAC layer protocols for LAN simulations. The NS project is now a part of the VINT project that develops tools for simulation results display, analysis and converters that convert network topologies generated by well-known generators to NS formats. Currently, NS (version 2) written in C++ and OTcl (Tcl script language with Object-oriented extensions developed at MIT) is available. This document talks briefly about the basic structure of NS, and explains in detail how to use NS mostly by giving examples. Most of the figures that are used in describing the NS basic structure and network components are from the 5th VINT/NS Simulator Tutorial/Workshopslides and the NS Manual (formerly called "NS Notes and Documentation"), modified little bit as needed. For more information about NS and the related tools, visit the VINT project home page.

Figure 1. Simplified User's View of NS
As shown in Figure 1, in a simplified user's view, NS is Object-oriented Tcl (OTcl) script interpreter that has a simulation event scheduler and network component object libraries, and network setup (plumbing) module libraries (actually, plumbing modules are implemented as member functions of the base simulator object). In other words, to use NS, you program in OTcl script language. To setup and run a simulation network, a user should write an OTcl script that initiates an event scheduler, sets up the network topology using the network objects and the plumbing functions in the library, and tells traffic sources when to start and stop transmitting packets through the event scheduler. The term "plumbing" is used for a network setup, because setting up a network is plumbing possible data paths among network objects by setting the "neighbor" pointer of an object to the address of an appropriate object. When a user wants to make a new network object, he or she can easily make an object either by writing a new object or by making a compound object from the object library, and plumb the data path through the object. This may sound like complicated job, but the plumbing OTcl modules actually make the job very easy. The power of NS comes from this plumbing.
Another major component of NS beside network objects is the event scheduler. An event in NS is a packet ID that is unique for a packet with scheduled time and the pointer to an object that handles the event. In NS, an event scheduler keeps track of simulation time and fires all the events in the event queue scheduled for the current time by invoking appropriate network components, which usually are the ones who issued the events, and let them do the appropriate action associated with packet pointed by the event. Network components communicate with one another passing packets, however this does not consume actual simulation time. All the network components that need to spend some simulation time handling a packet (i.e. need a delay) use the event scheduler by issuing an event for the packet and waiting for the event to be fired to itself before doing further action handling the packet. For example, a network switch component that simulates a switch with 20 microseconds of switching delay issues an event for a packet to be switched to the scheduler as an event 20 microsecond later. The scheduler after 20 microsecond dequeues the event and fires it to the switch component, which then passes the packet to an appropriate output link component. Another use of an event scheduler is timer. For example, TCP needs a timer to keep track of a packet transmission time out for retransmission (transmission of a packet with the same TCP packet number but different NS packet ID). Timers use event schedulers in a similar manner that delay does. The only difference is that timer measures a time value associated with a packet and does an appropriate action related to that packet after a certain time goes by, and does not simulate a delay.
NS is written not only in OTcl but in C++ also. For efficiency reason, NS separates the data path implementation from control path implementations. In order to reduce packet and event processing time (not simulation time), the event scheduler and the basic network component objects in the data path are written and compiled using C++. These compiled objects are made available to the OTcl interpreter through an OTcl linkage that creates a matching OTcl object for each of the C++ objects and makes the control functions and the configurable variables specified by the C++ object act as member functions and member variables of the corresponding OTcl object. In this way, the controls of the C++ objects are given to OTcl. It is also possible to add member functions and variables to a C++ linked OTcl object. The objects in C++ that do not need to be controlled in a simulation or internally used by another object do not need to be linked to OTcl. Likewise, an object (not in the data path) can be entirely implemented in OTcl. Figure 2 shows an object hierarchy example in C++ and OTcl. One thing to note in the figure is that for C++ objects that have an OTcl linkage forming a hierarchy, there is a matching OTcl object hierarchy very similar to that of C++.

Figure 2. C++ and OTcl: The Duality

Figure 3. Architectural View of NS
Figure 3 shows the general architecture of NS. In this figure a general user (not an NS developer) can be thought of standing at the left bottom corner, designing and running simulations in Tcl using the simulator objects in the OTcl library. The event schedulers and most of the network components are implemented in C++ and available to OTcl through an OTcl linkage that is implemented using tclcl. The whole thing together makes NS, which is a OO extended Tcl interpreter with network simulator libraries.
This section briefly examined the general structure and architecture of NS. At this point, one might be wondering about how to obtain NS simulation results. As shown in Figure 1, when a simulation is finished, NS produces one or more text-based output files that contain detailed simulation data, if specified to do so in the input Tcl (or more specifically, OTcl) script. The data can be used for simulation analysis (two simulation result analysis examples are presented in later sections) or as an input to a graphical simulation display tool called Network Animator (NAM) that is developed as a part of VINT project. NAM has a nice graphical user interface similar to that of a CD player (play, fast forward, rewind, pause and so on), and also has a display speed controller. Furthermore, it can graphically present information such as throughput and number of packet drops at each link, although the graphical information cannot be used for accurate simulation analysis.

Where to Find What?

Before going into a discussion of how to extend NS, let's briefly examine what information is stored in which directory or file. Figure 17 shows a part of the directory structure of the simulator if you installed it using the ns-allinone-2.1b package.


Figure 17. NS Directory Structure
Among the sub-directories of ns-allinone-2.1b, ns-2 is the place that has all of the simulator implementations (either in C++ or in OTcl), validation test OTcl scripts and example OTcl scripts. Within this directory, all OTcl codes and test/example scripts are located under a sub-directory called tcl, and most of C++ code, which implements event scheduler and basic network component object classes, except the WWW related ones, are located in the main level. For example, if you want to see the implementation of the UDP agent, you should go to "ns-allinone-2.1b/ns-2" directory, and open up "udp.h", "udp.cc" and the files that contain the implementation of ancestor classes of UDP as needed. For the class hierarchy of network components, refer to Figure 6 in the "Network Components" section. From now on, it is assumed that you are already in "ns-allinone-2.1b" directory.
The tcl directory has sub-directories, among which the lib directory that contains OTcl source codes for the most basic and essential parts of the NS implementation (agent, node, link, packet, address, routing, and etc.) is the place one as a user or as a developer will visit the most. Note that the OTcl source codes for LAN, Web, and Multicast implementations are located in separate subdirectories of tcl. Following is a partial list of files in "ns-2/tcl/lib" directory.
  • ns-lib.tcl: The simulator class and most of its member function definitions except for LAN, Web, and Multicast related ones are located here. If you want to know which member functions of the Simulator object class are available and how they work, this is a place to look.
     
  • ns-default.tcl: The default values for configurable parameters for various network components are located here. Since most of network components are implemented in C++, the configurable parameters are actually C++ variables made available to OTcl via an OTcl linkage function, bind(C++_variable_nameOTcl_variable_name). How to make OTcl linkages from C++ code is described in the next section.
     
  • ns-packet.tcl: The packet header format initialization implementation is located here. When you create a new packet header, you should register the header in this file to make the packet header initialization process to include your header into the header stack format and give you the offset of your header in the stack. A new header creating example is shown in "Add New Application and Agent" section.
     
  • other OTcl files: Other OTcl files in this directory, contain OTcl implementation of compound network objects or the front end (control part) of network objects in C++. The FTP application is entirely implemented in OTcl and the source code is located in "ns-source.tcl".
     
Two sub-directories of tcl that might be interesting for a user who wants to know how to design a specific simulation are ex and test. The former directory contains various example simulation scripts and the latter contains simulation scripts that validate the NS installed in your machine by running various simulations and comparing the results with the expected results.

Tcl: The User Language

As mentioned in the overview section, NS is basically an OTcl interpreter with network simulation object libraries. It is very useful to know how to program in OTcl to use NS. This section shows an example Tcl and OTcl script, from which one can get the basic idea of programming in OTcl. These examples are from the 5th VINT/NS Simulation Tutorial/Workshop. This section and the sections after assumes that the reader installed NS, and is familiar with C and C++.
Example 1 is a general Tcl script that shows how to create a procedure and call it, how to assign values to variables, and how to make a loop. Knowing that OTcl is Object-orieneted extension of Tcl, it is obvious that all Tcl commands work on OTcl - the relationship between Tcl and Otcl is just same as C and C++. To run this script you should download ex-tcl.tcl, and type "ns ex-tcl.tcl" at your shell prompt - the command "ns" starts the NS (an OTcl interpreter). You will also get the same results if you type "tcl ex-tcl.tcl", if tcl8.0 is installed in your machine.
ex-tcl.tcl

Example 1. A Sample Tcl Script
In Tcl, the keyword proc is used to define a procedure, followed by an procedure name and arguments in curly brackets. The keyword set is used to assign a value to a variable. [expr ...] is to make the interpreter calculate the value of expression within the bracket after the keyword. One thing to note is that to get the value assigned to a variable, $ is used with the variable name. The keyword puts prints out the following string within double quotation marks. The following shows the result of Example 1.
The next example is an object-oriented programming example in OTcl. This example is very simple, but shows the way which an object is created and used in OTcl. As an ordinary NS user, the chances that you will write your own object might be rare. However, since all of the NS objects that you will use in a NS simulation programming, whether or not they are written in C++ and made available to OTcl via the linkage or written only in OTcl, are essentially OTcl objects, understanding OTcl object is helpful.
ex-otcl.tcl

Example 2. A Sample OTcl Script
Example 2 is an OTcl script that defines two object classes, "mom" and "kid", where "kid" is the child class of "mom", and a member function called "greet" for each class. After the class definitions, each object instance is declared, the "age" variable of each instance is set to 45 (for mom) and 15 (for kid), and the "greet" member function of each object instance is called. The keyword Class is to create an object class and instproc is to define a member function to an object class. Class inheritance is specified using the keyword -superclass. In defining member functions, $self acts same as the "this" pointer in C++, and instvar checks if the following variable name is already declared in its class or in its superclass. If the variable name given is already declared, the variable is referenced, if not a new one is declared. Finally, to create an object instance, the keyword new is used as shown in the example. Downloading ex-otcl.tcl and executing "ns ex-otcl.tcl" will give you the following result:

Simple Simulation Example

This section shows a simple NS simulation script and explains what each line does. Example 3 is an OTcl script that creates the simple network configuration and runs the simulation scenario in Figure 4. To run this simulation, download "ns-simple.tcl" and type "ns ns-simple.tcl" at your shell prompt.


Figure 4. A Simple Network Topology and Simulation Scenario
This network consists of 4 nodes (n0, n1, n2, n3) as shown in above figure. The duplex links between n0 and n2, and n1 and n2 have 2 Mbps of bandwidth and 10 ms of delay. The duplex link between n2 and n3 has 1.7 Mbps of bandwidth and 20 ms of delay. Each node uses a DropTail queue, of which the maximum size is 10. A "tcp" agent is attached to n0, and a connection is established to a tcp "sink" agent attached to n3. As default, the maximum size of a packet that a "tcp" agent can generate is 1KByte. A tcp "sink" agent generates and sends ACK packets to the sender (tcp agent) and frees the received packets. A "udp" agent that is attached to n1 is connected to a "null" agent attached to n3. A "null" agent just frees the packets received. A "ftp" and a "cbr" traffic generator are attached to "tcp" and "udp" agents respectively, and the "cbr" is configured to generate 1 KByte packets at the rate of 1 Mbps. The "cbr" is set to start at 0.1 sec and stop at 4.5 sec, and "ftp" is set to start at 1.0 sec and stop at 4.0 sec.
ns-simple.tcl

Example 3. A Simple NS Simulation Script
The following is the explanation of the script above. In general, an NS script starts with making a Simulator object instance.
  • set ns [new Simulator]: generates an NS simulator object instance, and assigns it to variable ns (italics is used for variables and values in this section). What this line does is the following:
     
    • Initialize the packet format (ignore this for now)
    • Create a scheduler (default is calendar scheduler)
    • Select the default address format (ignore this for now)
       
    The "Simulator" object has member functions that do the following:
     
    • Create compound objects such as nodes and links (described later)
    • Connect network component objects created (ex. attach-agent)
    • Set network component parameters (mostly for compound objects)
    • Create connections between agents (ex. make connection between a "tcp" and "sink")
    • Specify NAM display options
    • Etc.
       
    Most of member functions are for simulation setup (referred to as plumbing functions in the Overview section) and scheduling, however some of them are for the NAM display. The "Simulator" object member function implementations are located in the "ns-2/tcl/lib/ns-lib.tcl" file.
     
  • $ns color fid color: is to set color of the packets for a flow specified by the flow id (fid). This member function of "Simulator" object is for the NAM display, and has no effect on the actual simulation.
     
  • $ns namtrace-all file-descriptor: This member function tells the simulator to record simulation traces in NAM input format. It also gives the file name that the trace will be written to later by the command $ns flush-trace. Similarly, the member function trace-all is for recording the simulation trace in a general format.
     
  • proc finish {}: is called after this simulation is over by the command $ns at 5.0 "finish". In this function, post-simulation processes are specified.
     
  • set n0 [$ns node]: The member function node creates a node. A node in NS is compound object made of address and port classifiers (described in a later section). Users can create a node by separately creating an address and a port classifier objects and connecting them together. However, this member function of Simulator object makes the job easier. To see how a node is created, look at the files: "ns-2/tcl/libs/ns-lib.tcl" and "ns-2/tcl/libs/ns-node.tcl".
     
  • $ns duplex-link node1 node2 bandwidth delay queue-type: creates two simplex links of specified bandwidth and delay, and connects the two specified nodes. In NS, the output queue of a node is implemented as a part of a link, therefore users should specify the queue-type when creating links. In the above simulation script, DropTail queue is used. If the reader wants to use a RED queue, simply replace the word DropTail with RED. The NS implementation of a link is shown in a later section. Like a node, a link is a compound object, and users can create its sub-objects and connect them and the nodes. Link source codes can be found in "ns-2/tcl/libs/ns-lib.tcl" and "ns-2/tcl/libs/ns-link.tcl" files. One thing to note is that you can insert error modules in a link component to simulate a lossy link (actually users can make and insert any network objects). Refer to the NS documentation to find out how to do this.
     
  • $ns queue-limit node1 node2 number: This line sets the queue limit of the two simplex links that connect node1 and node2 to the number specified. At this point, the authors do not know how many of these kinds of member functions of Simulator objects are available and what they are. Please take a look at "ns-2/tcl/libs/ns-lib.tcl" and "ns-2/tcl/libs/ns-link.tcl", or NS documentation for more information.
     
  • $ns duplex-link-op node1 node2 ...: The next couple of lines are used for the NAM display. To see the effects of these lines, users can comment these lines out and try the simulation.
Now that the basic network setup is done, the next thing to do is to setup traffic agents such as TCP and UDP, traffic sources such as FTP and CBR, and attach them to nodes and agents respectively.
  • set tcp [new Agent/TCP]: This line shows how to create a TCP agent. But in general, users can create any agent or traffic sources in this way. Agents and traffic sources are in fact basic objects (not compound objects), mostly implemented in C++ and linked to OTcl. Therefore, there are no specific Simulator object member functions that create these object instances. To create agents or traffic sources, a user should know the class names these objects (Agent/TCP, Agnet/TCPSink, Application/FTP and so on). This information can be found in the NS documentation or partly in this documentation. But one shortcut is to look at the "ns-2/tcl/libs/ns-default.tcl" file. This file contains the default configurable parameter value settings for available network objects. Therefore, it works as a good indicator of what kind of network objects are available in NS and what are the configurable parameters.
     
  • $ns attach-agent node agent: The attach-agent member function attaches an agent object created to a node object. Actually, what this function does is call the attach member function of specified node, which attaches the given agent to itself. Therefore, a user can do the same thing by, for example, $n0 attach $tcp. Similarly, each agent object has a member function attach-agent that attaches a traffic source object to itself.
     
  • $ns connect agent1 agent2: After two agents that will communicate with each other are created, the next thing is to establish a logical network connection between them. This line establishes a network connection by setting the destination address to each others' network and port address pair.
Assuming that all the network configuration is done, the next thing to do is write a simulation scenario (i.e. simulation scheduling). The Simulator object has many scheduling member functions. However, the one that is mostly used is the following:
  • $ns at time "string": This member function of a Simulator object makes the scheduler (scheduler_ is the variable that points the scheduler object created by [new Scheduler] command at the beginning of the script) to schedule the execution of the specified string at given simulation time. For example, $ns at 0.1 "$cbr start" will make the scheduler call a start member function of the CBR traffic source object, which starts the CBR to transmit data. In NS, usually a traffic source does not transmit actual data, but it notifies the underlying agent that it has some amount of data to transmit, and the agent, just knowing how much of the data to transfer, creates packets and sends them.
After all network configuration, scheduling and post-simulation procedure specifications are done, the only thing left is to run the simulation. This is done by $ns run.

Event Scheduler

This section talks about the discrete event schedulers of NS. As described in the Overview section, the main users of an event scheduler are network components that simulate packet-handling delay or that need timers. Figure 5 shows each network object using an event scheduler. Note that a network object that issues an event is the one who handles the event later at scheduled time. Also note that the data path between network objects is different from the event path. Actually, packets are handed from one network object to another using send(Packet* p) {target_->recv(p)}; method of the sender and recv(Packet*, Handler* h = 0) method of the receiver.



Figure 5. Discrete Event Scheduler
NS has two different types of event schedulers implemented. These are real-time and non-real-time schedulers. For a non-real-time scheduler, three implementations (List, Heap and Calendar) are available, even though they are all logically perform the same. This is because of backward compatibility: some early implementation of network components added by a user (not the original ones included in a package) may use a specific type of scheduler not through public functions but hacking around the internals. The Calendar non-real-time scheduler is set as the default. The real-time scheduler is for emulation, which allow the simulator to interact with a real network. Currently, emulation is under development although an experimental version is available. The following is an example of selecting a specific event scheduler:
. . .
set ns [new Simulator]
$ns use-scheduler Heap
. . .
Another use of an event scheduler is to schedule simulation events, such as when to start an FTP application, when to finish a simulation, or for simulation scenario generation prior to a simulation run. An event scheduler object itself has simulation scheduling member functions such as at time "string" that issue a special event called AtEvent at a specified simulation time. An "AtEvent" is actually a child class of "Event", which has an additional variable to hold the givenstring. However, it is treated the same as a normal (packet related) event within the event scheduler. When a simulation is started, and as the scheduled time for an AtEvent in the event queue comes, the AtEvent is passed to an "AtEvent handler" that is created once and handles all AtEvents, and the OTcl command specified by the string field of the AtEvent is executed. The following is a simulation event scheduling line added version of the above example.
. . .
set ns [new Simulator]
$ns use-scheduler Heap
$ns at 300.5 "complete_sim"
. . .

proc complete_sim {} {
. . .
}
You might noticed from the above example that at time "string" is a member function of the Simulator object (set ns[new Simulator]). But remember that the Simulator object just acts as a user interface, and it actually calls the member functions of network objects or a scheduler object that does the real job. Followings are a partial list and brief description of Simulator object member functions that interface with scheduler member functions:
Simulator instproc now # return scheduler's notion of current time
Simulator instproc at args # schedule execution of code at specified time
Simulator instproc at-now args # schedule execution of code at now
Simulator instproc after n args # schedule execution of code after n secs
Simulator instproc run args # start scheduler
Simulator instproc halt # stop (pause) scheduler

Network Components

This section talks about the NS components, mostly compound network components. Figure 6 shows a partial OTcl class hierarchy of NS, which will help understanding the basic network components. For a complete NS class hierarchy, visit http://www-sop.inria.fr/rodeo/personnel/Antoine.Clerget/ns.


Figure 6. Class Hierarchy (Partial)
The root of the hierarchy is the TclObject class that is the superclass of all OTcl library objects (scheduler, network components, timers and the other objects including NAM related ones). As an ancestor class of TclObject, NsObject class is the superclass of all basic network component objects that handle packets, which may compose compound network objects such as nodes and links. The basic network components are further divided into two subclasses, Connector and Classifier, based on the number of the possible output data paths. The basic network objects that have only one output data path are under the Connector class, and switching objects that have possible multiple output data paths are under the Classifier class.
  • Node and Routing
  • A node is a compound object composed of a node entry object and classifiers as shown in Figure 7. There are two types of nodes in NS. A unicast node has an address classifier that does unicast routing and a port classifier. A multicast node, in addition, has a classifier that classify multicast packets from unicast packets and a multicast classifier that performs multicast routing.


    Figure 7. Node (Unicast and Multicast)
    In NS, Unicast nodes are the default nodes. To create Multicast nodes the user must explicitly notify in the input OTcl script, right after creating a scheduler object, that all the nodes that will be created are multicast nodes. After specifying the node type, the user can also select a specific routing protocol other than using a default one.
    • Unicast
    • $ns rtproto type
      type: Static, Session, DV, cost, multi-path
       
    • Multicast
    • $ns multicast (right after set $ns [new Scheduler])
      $ns mrtproto type
      type: CtrMcast, DM, ST, BST
    For more information about routing, refer to the NS Manual located at http://www.isi.edu/nsnam/ns/ns-documentation.html. The documentation has chapters talk about unicast and multicast routing.
  • Link
  • A link is another major compound object in NS. When a user creates a link using a duplex-link member function of a Simulator object, two simplex links in both directions are created as shown in Figure 8.

    Figure 8. Link
    One thing to note is that an output queue of a node is actually implemented as a part of simplex link object. Packets dequeued from a queue are passed to the Delay object that simulates the link delay, and packets dropped at a queue are sent to a Null Agent and are freed there. Finally, the TTL object calculates Time To Live parameters for each packet received and updates the TTL field of the packet.
    • Tracing
    • In NS, network activities are traced around simplex links. If the simulator is directed to trace network activities (specified using $ns trace-all file or $ns namtrace-all file), the links created after the command will have the following trace objects inserted as shown in Figure 9. Users can also specifically create a trace object of type typebetween the given src and dst nodes using the create-trace {type file src dst} command.

    Figure 9. Inserting Trace Objects
      When each inserted trace object (i.e. EnqT, DeqT, DrpT and RecvT) receives a packet, it writes to the specified trace file without consuming any simulation time, and passes the packet to the next network object. The trace format will be examined in the General Analysis Example section.
    • Queue Monitor
    • Basically, tracing objects are designed to record packet arrival time at which they are located. Although a user gets enough information from the trace, he or she might be interested in what is going on inside a specific output queue. For example, a user interested in RED queue behavior may want to measure the dynamics of average queue size and current queue size of a specific RED queue (i.e. need for queue monitoring). Queue monitoring can be achieved using queue monitor objects and snoop queue objects as shown in Figure 10.


    Figure 10. Monitoring Queue
      When a packet arrives, a snoop queue object notifies the queue monitor object of this event. The queue monitor using this information monitors the queue. A RED queue monitoring example is shown in the RED Queue Monitor Example section. Note that snoop queue objects can be used in parallel with tracing objects even though it is not shown in the above figure.
  • Packet Flow Example
  • Until now, the two most important network components (node and link) were examined. Figure 11 shows internals of an example simulation network setup and packet flow. The network consist of two nodes (n0 and n1) of which the network addresses are 0 and 1 respectively. A TCP agent attached to n0 using port 0 communicates with a TCP sink object attached to n1 port 0. Finally, an FTP application (or traffic source) is attached to the TCP agent, asking to send some amount of data.


    Figure 11. Packet Flow Example
    Note that the above figure does not show the exact behavior of a FTP over TCP. It only shows the detailed internals of simulation network setup and a packet flow.

    Trace Analysis Example



    This section shows a trace analysis example. Example 4 is the same OTcl script as the one in the "Simple Simulation Example" section with a few lines added to open a trace file and write traces to it. For the network topology it generates and the simulation scenario, refer to Figure 4 in the "Simple Simulation Example" section. To run this script download "ns-simple-trace.tcl" and type "ns ns-simple-trace.tcl" at your shell prompt.
    ns-simple-trace.tcl

    Example 4. Trace Enabled Simple NS Simulation Script (modified from Example 3)
    Running the above script generates a NAM trace file that is going to be used as an input to NAM and a trace file called "out.tr" that will be used for our simulation analysis. Figure 13 shows the trace format and example trace data from "out.tr".


    Figure 13. Trace Format Example
    Each trace line starts with an event (+, -, d, r) descriptor followed by the simulation time (in seconds) of that event, and from and to node, which identify the link on which the event occurred. Look at Figure 9 in the "Network Components" section to see where in a link each type of event is traced. The next information in the line before flags (appeared as "------" since no flag is set) is packet type and size (in Bytes). Currently, NS implements only the Explicit Congestion Notification (ECN) bit, and the remaining bits are not used. The next field is flow id (fid) of IPv6 that a user can set for each flow at the input OTcl script. Even though fid field may not used in a simulation, users can use this field for analysis purposes. The fid field is also used when specifying stream color for the NAM display. The next two fields are source and destination address in forms of "node.port". The next field shows the network layer protocol's packet sequence number. Note that even though UDP implementations do not use sequence number, NS keeps track of UDP packet sequence number for analysis purposes. The last field shows the unique id of the packet.
    Having simulation trace data at hand, all one has to do is to transform a subset of the data of interest into a comprehensible information and analyze it. Down below is a small data transformation example. This example uses a command written in perl called "column" that selects columns of given input. To make the example work on your machine, you should download "column" and make it executable (i.e. "chmod 755 column"). Following is a tunneled shell command combined with awk, which calculates CBR traffic jitter at receiver node (n3) using data in "out.tr", and stores the resulting data in "jitter.txt".
    cat out.tr | grep " 2 3 cbr " | grep ^r | column 1 10 | awk '{dif = $2 - old2; if(dif==0) dif = 1; if(dif > 0) {printf("%d\t%f\n", $2, ($1 - old1) / dif); old1 = $1; old2 = $2}}' > jitter.txt
    This shell command selects the "CBR packet receive" event at n3, selects time (column 1) and sequence number (column 10), and calculates the difference from last packet receive time divided by difference in sequence number (for loss packets) for each sequence number. The following is the corresponding jitter graph that is generated using gnuplot. The X axis show the packet sequence number and the Y axis shows simulation time in seconds.


    Figure 14. CBR Jitter at The Receiving Node (n3)
    You might also check for more utilities in the Example Utilities section.
    This section showed an example of how to generate traces in NS, how to interpret them, and how to get useful information out from the traces. In this example, the post simulation processes are done in a shell prompt after the simulation. However, these processes can be included in the input OTcl script, which is shown in the next section.

    RED Queue Monitor Example

    This section shows a RED queue monitoring example. Example 5 is an OTcl script written by Polly Huang, which sets up the network topology and runs the simulation scenario shown in Figure 15. Note that a RED queue that can hold up to 25 packets is used for the link r1-r2, and we want to see how the RED queue works by measuring the dynamics of current and average queue size. To run this script, download "red.tcl" and type "ns red.tcl" at your shell prompt.


    Figure 15. RED Queue Monitor Example Setup
    red.tcl

    Example 5. RED Queue Monitor Simulation Script
    There are couple of things to note in the above script. First, more advanced Simulator object member function create-connection is used to create TCP connections. Second, take a good look at queue tracing (monitoring) part of the script. These lines make a variable to point the RED queue object, call its member function trace to monitor the current queue size (curq_) and average queue size (avg_), and make them write the results to the file "all.q". Following are the two queue trace output formats for average queue size and current queue size.
    a time avg_q_size
    Q time crnt_q_size
    Now that the all commands needed for RED queue monitoring is done except closing the "all.q" file when the simulation is done, the remaining work designs a post-simulation process. This script, using awk, does this process of transforming the monitored information into XGraph (a plotter) input format, and launches it to draw the given information (see Figure 16).


    Figure 16. Red Queue Trace Graph

    Trace Analysis Utilities

    Here is a collection of trace analysis utilities that have been useful:

    • Much parsing is easy if you can extract columns. Here is a helper-perl utility called "column" that breaks a text output into columns, separated by whitespace. It is used by many of the scripts below.
    • Here is a simple perl called stats.pl script that prints some stats along the bottleneck link (node 1 to node 2, in this case) of an output file stats.tr. Run it with the command: stats.pl -l1 1 -l2 2 -max 1.5 stats.tr.
    • Here is a tunneled shell command called jitter.sh combined with awk, which calculates CBR traffic jitter at receiver node (n3) using data in "out.tr", and stores the resulting data in "jitter.txt". This shell command selects the "CBR packet receive" event at n3, selects time (column 1) and sequence number (column 10), and calculates the difference from last packet receive time divided by difference in sequence number (for loss packets) for each sequence number.

    OTcl Linkage

    Extending NS by adding a new basic network object usually involves working around making OTcl linkage from C++ code, since the object class in the data path should be written in C++ for efficiency reason. This section introduces C++/OTcl linkages available in NS by giving an example of creating a simple and dull agent called "MyAgent" that has no behavior of an agent (i.e. no packet creation and transmission). Figures 18 to 21 show parts of the C++ source file for "MyAgent", together which makes a complete implementation (with 3 extra header lines). Also, an OTcl script with which you can test "MyAgent" is presented at the end of this section.

  • Export C++ class to OTcl
  • Suppose that you created a new network object class in C++, say "MyAgent" that is derived from the "Agent" class, and want to make it possible to create an instance of this object in OTcl. To do this you have to define a linkage object, say "MyAgentClass", which should be derived from "TclClass". This linkage object creates an OTcl object of specified name ("Agent/MyAgentOtcl" in this example), and creates a linkage between the OTcl object and the C++ object ("MyAgent" in this example), of which the instance launching procedure is specified in the "create" member function. Figure 18 shows the "MyAgent" class definition and the linkage class definition.

    Figure 18. Example C++ Network Component and The Linkage Object
    When NS is first started, it executes the constructor for the static variable "class_my_agent", and thus an instance of "MyAgentClass" is created. In this process, the "Agent/MyAgentOtcl" class and its appropriate methods (member functions) are created in OTcl space. Whenever a user in OTcl space tries to create an instance of this object using the command "new Agent/MyAgentOtcl", it invokes "MyAgentClass::create" that creates an instance of "MyAgent" and returns the address. Note that creating a C++ object instance from OTcl does not mean that you can invoke member functions or access member variables of the C++ object instance from OTcl.

  • Export C++ class variables to OTcl
  • Suppose your new C++ object, "MyAgent", has two parameter variables, say "my_var1" and "my_var2", that you want to configure (or change) easily from OTcl using the input simulation script. To do this you should use a binding function for each of the C++ class variables you want to export. A binding function creates a new member variable of given name (first argument) in the matching OTcl object class ("Agent/MyAgentOtcl"), and create bi-directonal bindings between the OTcl class variable and the C++ variable whose address is specified as the second variable. Figure 19 shows how to make bindings for "my_var1" and "my_var2" shown in Figure 18.

    Figure 19. Variable Binding Creation Example
    Note that the binding functions are placed in the "MyAgent" constructor function to establish the bindings when an instance of this object is created. NS support four different binding functions for five different variable types as follows:
    - bind(): real or integer variables
    - bind_time(): time variable
    - bind_bw(): bandwidth variable
    - bind_bool(): boolean variable
    In this way, a user designing and running a simulation using an OTcl script can change or access configurable parameters (or variable values) of network components implemented in C++. Note that whenever you export a C++ variable, it is recommended that you also set the default value for that variable in the "ns-2/tcl/lib/ns-lib.tcl" file. Otherwise, you will get a warning message when you create an instant of your new object.

  • Export C++ Object Control Commands to OTcl.
  • In addition to exporting some of your C++ object variables, you may also want to give the control of your C++ object to OTcl. This is done by defining a "command" member function of your C++ object ("MyAgent"), which works as an OTcl command interpreter. As a matter of fact, an OTcl command defined in a "command" member function of a C++ object looks the same as a member function of the matching OTcl object to a user. Figure 20 shows an example "command" member function definition for the "MyAgent" object in Figure 18.

    Figure 20. Example OTcl command interpreter
    When an instance of the shadow OTcl that matches the "MyAgent" object is created in OTcl space (i.e. set myagent [new Agent/MyAgentOtcl]), and the user tries to call a member function of that object (i.e. $myagent call-my-priv-func), OTcl searches for the given member function name in the OTcl object. If the given member function name cannot be found, then it invokes the "MyAgent::command" passing the invoked OTcl member function name and arguments in argc/argv format. If there is an action defined for the invoked OTcl member function name in the "command" member function, it carries out what is asked and returns the result. If not, the "command" function for its ancestor object is recursively called until the name is found. If the name cannot be found in any of the ancestors, an error message is return to the OTcl object, and the OTcl object gives an error message to the user. In this way, an user in OTcl space can control a C++ object's behavior.

  • Execute an OTcl command from C++.
  • As you implement a new network object in C++, you might want to execute an OTcl command from the C++ object. Figure 21 shows the implementation of "MyPrivFunc" member function of "MyAgent" in Figure 18, which makes an OTcl interpreter print out the value in "my_var1" and "my_var2" private member variables.

    Figure 21. Execute OTcl command from a C++ Object
    To execute an OTcl command from C++, you should get a reference to "Tcl::instance()" that is declared as a static member variable. This offers you a couple of functions with which you can pass an OTcl command to the interpreter (the first line of "MyPrivFunc" does this). This example shows two ways to pass an OTcl command to the interpreter. For a complete list of OTcl command passing functions, refer to the NS documentation.

  • Compile, run and test "MyAgent"
  • Until now, we examined the essential OTcl linkages available in NS using the "MyAgent" example. Assuming that running and testing this example would help the reader's understanding further, we present a procedure that helps you to compile, run and test "MyAgent".
    1. Download "ex-linkage.cc" file, and save it under the "ns-2" directory.
    2. Open "Makefile", add "ex-linkage.o" at the end of object file list.
    3. Re-compile NS using the "make" command.
    4. Download the "ex-linkage.tcl" file that contains "MyAgent" testing OTcl commands. (see Figure 22 for the input script and the result)
    5. Run the OTcl script using command "ns ex-linkage.tcl".
    ex-linkage.tcl

    Figure 22. Test OTcl Script and The Result

    Add New Application and Agent

    (Tested with ns-2.1b8a, ns-2.1b9a and ns-2.26)

    Objective
    We want to build a multimedia application that runs over a UDP connection, which simulates the behavior of an imaginary multimedia application that implements "five rate media scaling" that can respond to network congestion to some extent by changing encoding and transmission policy pairs associated with scale parameter values.

  • Application Description
  • In this implementation, it is assumed that when a connection is established, the sender and the receiver agree on 5 different sets of encoding and transmission policy pairs, and associate them with 5 scale values (0-4). For simplicity reasons, it is also assumed that a constant transmission rate is determined for each of the encoding and transmission policy pairs, and every pair uses packets of the same size regardless of the encoding scheme.
    Basically, "five rate media scaling" works as follow. The sender starts with transmission rate associated with scale 0, and changes transmission rates according to the scale value that the receiver notifies. The receiver is responsible for monitoring network congestion and determining the scale factor. For congestion monitoring, a simple periodical (for every RTT second) packet loss monitoring is used, and even a single packet loss for each period is regarded as network congestion. If congestion is detected, the receiver reduces the scale parameter value to half and notifies the sender of this value. If no packet loss is detected, the receiver increases the value by one and notifies the sender.

  • Problem Analysis
  • Before implementing this application, the UDP agent implementation is examined and one major problem is found. Since a UDP agent allocates and sends network packets, all the information needed for application level communication should be handed to the UDP agent as a data stream. However, the UDP implementation allocates packets that only have a header stack. Therefore, we need to modify the UDP implementation to add a mechanism to send the data received from the application. It is also noted that we might want to use this application for further research on IP router queue management mechanisms. Therefore, we need a way to distinguish this type of multimedia stream from other types of streams. That is, we also need to modify UDP agent to record data type in one of IP header fields that is currently not used.

  • Note on NS Versions
  • The locations of C++ source files in NS version 2.1b9a are slightly changed from 2.1b8a. In ns-2.1b9a, C++ source files are categorized and placed in sub-directories under the main ns-2 directory. For example, "packet.h" to "common/packet.h", "agent.h" to "common/agent.h" and "app.h" is moved to "apps/app.h". However, the locations of OTcl files are same as before ("tcl/lib/ns-packet.tcl", "tcl/lib/ns-default.tcl" and etc.)
  • Design and Implementation
  • For the application, we decided to take the CBR implementation and modify it to have the "five level media scaling" feature. We examined the C++ class hierarchy, and decided to name the class of this application as "MmApp" and implement as a child class of "Application". The matching OTcl hierarchy name is "Application/MmApp". The sender and receiver behavior of the application is implemented together in "MmApp". For the modified UDP agent that supports "MmApp", we decided to name it "UdpMmAgent" and implement it as a child class of "UdpAgent". The matching OTcl hierarchy name is "Agent/UDP/UDPmm"
    • MmApp Header: For the application level communication, we decided to define a header of which the structure named in C++ "hdr_mm". Whenever the application has information to transmit, it will hand it to "UdpMmAgent" in the "hdr_mm" structure format. Then, "UdpMmAgent" allocates one or more packets (depending on the simulated data packet size) and writes the data to the multimedia header of each packet. Figure 23 shows the header definition, in which a structure for the header and a header class object, "MultimediaHeaderClass" that should be derived from "PacketHeaderCalss" is defined. In defining this class, the OTcl name for the header ("PacketHeader/Multimedia") and the size of the header structure defined are presented. Notice that bind_offset() must be called in the constructor of this class.

      Figure 23. MM Header Structure & Class (in "udp-mm.h" & "udp-mm.cc")


      Figure 24 (a). Add to the "packet.h" file (C++)

      Figure 24 (b). Add to the "ns-packet.tcl" file (Otcl)
      We also add lines to packet.h and ns-packet.tcl as shown in Figure 24 (a) and (b) to add our "Mulltimedia" header to the header stack. At this point, the header creation process is finished, and "UdpMmAgent" will access the new header via hdr_mm::access() member function. Please refer to NS Manual for detailed information on header creation and access methods. For the rest of the application and the modified UDP agent description, refer directly to "mm-app.h", "mm-app.cc", "udp-mm.h" and "udp-mm.cc" files as needed.
       
    • MmApp Sender: The sender uses a timer for scheduling the next application data packet transmission. We defined the "SendTimer" class derived from the "TimerHandler" class, and wrote its "expire()" member function to call "send_mm_pkt()" member function of the "MmApp" object. Then, we included an instance of this object as a private member of "MmApp" object referred to as "snd_timer_". Figure 25 shows the "SendTimer" implementation.

      Figure 25. SendTimer Implementation.
      Before setting this timer, "MmApp" re-calculates the next transmission time using the transmission rate associated with the current scale value and the size of application data packet that is given in the input simulation script (or use the default size). The "MmApp" sender, when an ACK application packet arrives from the receiver side, updates the scale parameter.
       
    • MmApp Receiver: The receiver uses a timer, named "ack_timer_", to schedule the next application ACK packet transmission of which the interval is equal to the mean RTT. When receiving an application data packet from the sender, the receiver counts the number of received packets and also counts the number of lost packets using the packet sequence number. When the "ack_timer_" expires, it invokes the "send_ack_pkt" member function of "MmApp", which adjusts the scale value looking at the received and lost packet accounting information, resets the received and lost count to 0, and sends an ACK packet with the adjusted scale value. Note that the receiver doesn't have any connection establishment or closing methods. Therefore, starting from the first packet arrival, the receiver periodically sends ACK packets and never stops (this is a bug).
       
    • UdpMmAgent: The "UdpMmAgent" is modified from the "UdpAgent" to have the following additional features: (1) writing to the sending data packet MM header the information received from a "MmApp" (or reading information from the received data packet MM header and handing it to the "MmApp"), (2) segmentation and re-assembly ("UdpAgent" only implements segmentation), and (3) setting the priority bit (IPv6) to 15 (max priority) for the "MmApp" packets.
       
    • Modify "agent.h": To make the new application and agent running with your NS distribution, you should add two methods to "Agent" class as public. In the "command" member function of the "MmApp" class, there defined an "attach-agent" OTcl command. When this command is received from OTcl, "MmApp" tries to attach itself to the underlying agent. Before the attachment, it invokes the "supportMM()" member function of the underlying agent to check if the underlying agent support for multimedia transmission (i.e. can it carry data from application to application), and invokes "enableMM()" if it does. Even though these two member functions are defined in the "UdpMmAgnet" class, it is not defined in its base ancestor "Agent" class, and the two member functions of the general "Agent" class are called. Therefore, when trying to compile the code, it will give an error message. Inserting the two methods as public member functions of the "Agent" class (in "agent.h") as follows will solve this problem.

      Figure 26 (a). Add two member functions to "Agent" class.
    • Modify "app.h": You also need to add an additional member function "recv_msg(int nbytes, const char *msg)" to "Application" class as shown in Figure 26 (b). This member function, which was included in the "Application" class in the old versions of NS (ns-2.1b4a for sure), is removed from the class in the latest versions (ns-2.1b8a for sure). Our multimedia application was initially written for the ns-2.1.b4a, and therefore requires "Application::recv_msg()" member function for ns-2.1b8a or later versions.

      Figure 26 (b). Add a member function to "Application" class.
    • Set default values for new parameter in the "ns-default.tcl": After implementing all the parts of the application and agent, the last thing to do is to set default values for the newly introduced configurable parameters in the "ns-default.tcl" file. Figure 26 shows an example of setting the default values for configurable parameters introduced by "MmApp".

      Figure 27. Default parameter value settings

  • Download and Compile
  • Here is a checklist that should be done before recompiling your NS.
    1. Download "mm-app.h", "mm-app.cc", "udp-mm.h" and "udp-mm.cc") to the "ns-2" directory.
    2. Make sure you registered the new application header by modifying "packet.h" and "ns-packet.tcl" as shown in Figure 24 (a) and (b).
    3. Add supportMM() and enableMM() methods to the "Agent" class in "agent.h" as shown in Figure 26 (a).
    4. Add recv_msg() method to the "Application" class in "app.h" as shown in Figure 26 (b).
    5. Set default values for the newly introduced configurable parameters in "ns-default.tcl" as described in Figure 27. Be SURE to complete this last step. Otherwise, all five-scale rates are initialized to zero unless specified in the input simulation script (i.e., the test simulation script given below will not transmit any frames).
    Be SURE to complete the last (5th) step. Otherwise, all five-scale rates are initialized to zero unless specifically given in the input simulation script (i.e., the test simulation script given below will not transmit any frames).

    After you've done all things in the checklist, modify your "Makefile" as needed (include "mm-app.o" and "udp-mm.o" in the object file list) and re-compile your NS. Be SURE to run "make clean" and "make depend" before you re-compile your modified NS, otherwise the new application may not transmit any packets. It is generally a good practice to do "make depend" after you make changes in "Makefile" before a re-compile.

  • Test Simulation
  • Figure 28 shows a simulation topology and scenario that is used to test "MmApp", and Figure 29 shows the test simulation script. Download this script and test the newly added components.

    Figure 28. Test Simulation Topology and Scenario

    ex-mm-app.tcl

    Figure 29. "MmApp" Test Simulation Script

    Add New Queue

    (Tested with ns-2.1b8a, ns-2.1b9a and ns-2.26)


  • Objective
  • To build a simple drop-tail router output queue that uses a round-robin dequeue scheduling for priority 15 packets (from a "MmApp" over "UDPmm") and the other packets in the queue. That is, while priority 15 packets and other packets coexist in the queue, it dequeues the oldest packets of each type one by one in turn.

  • Design
  • The queue has two logical FIFO queues, say LQ1 and LQ2, of which the total size is equal to the size of physical queue (PQ), i.e. LQ1 + LQ2 = PQ. To implement a normal drop-tail enqueue behavior, when a packet is to be enqueued, the enqueue manager checks if size of LQ1 + LQ2 is less than maximum allowed PQ size. If so, the packet will be enqueued to an appropriate logical queue. To implement the round-robin dequeue scheduling, the dequeue manager tries to dequeue one packet from a logical queue and the next one from the other logical queue in turn. I.e. packets in the two logical queues are dequeued at 1:1 ratio if both queues have packets.

  • Implementation
  • We named the C++ name for this queue object "DtRrQueue" (Drop-Tail Round-Robin Queue) that is derived from "Queue" class. The matching OTcl name is "Queue/DTRR". When the "recv" member function that is implemented in the "Queue" class (in "queue.cc") receives a packet, it invokes the "enqueue" member function of the queue object and invokes "dequeue" if the link object is not blocked. When the link came from a blocked state, it also calls the "dequeue" member function of its queue object. Therefore, we needed to write "enqueue" and "dequeue" member functions of the "DtRrQueue" object class. Figure 30 shows the "DtRrQueue" class definition and its "enqueue" and "dequeue" member functions. For the complete implementation, refer to "dtrr-queue.h" and "dtrr-queue.cc" files. Since the codes are really easy to understand, no further explanation is given.


    Figure 30. "DtRrQueue" class implementation

  • Test Simulation
  • We used the simulation script used for testing "MmApp" over "UDPmm" in the previous section with changing the RED queue to DTRR queue for the link r1-r2. The changes to the script are show in Figure 31. Download this script and test your newly added queue components.
    ex-dtrr-queue.tcl

    Figure 31. "DtRrQueue" test simulation script

    Packet in ns2



    A NS packet is composed of a stack of headers, and an optional data space (see Figure 12). As briefly mentioned in the "Simple Simulation Example" section, a packet header format is initialized when a Simulator object is created, where a stack of all registered (or possibly useable) headers, such as the common header that is commonly used by any objects as needed, IP header, TCP header, RTP header (UDP uses RTP header) and trace header, is defined, and the offset of each header in the stack is recorded. What this means is that whether or not a specific header is used, a stack composed of all registered headers is created when a packet is allocated by an agent, and a network object can access any header in the stack of a packet it processes using the corresponding offset value.


    Figure 12. NS Packet Format
    Usually, a packet only has the header stack (and a data space pointer that is null). Although a packet can carry actual data (from an application) by allocating a data space, very few application and agent implementations support this. This is because it is meaningless to carry data around in a non-real-time simulation. However, if you want to implement an application that talks to another application cross the network, you might want to use this feature with a little modification in the underlying agent implementation. Another possible approach would be creating a new header for the application and modifying the underlying agent to write data received from the application to the new header. The second approach is shown as an example in a later section called "Add New Application and Agent".
    Network SimulatorFor Windows
     
    "Network Simulator (NS) is a discrete event simulator targeted at networking research. NS provides substantial support for simulation of TCP, routing, and multicast protocols over wired and wireless (local and satellite) networks". You may find more info about NS at Information Science Institue's homepage.
    Here you could find concise notes about how to use NS on Windows. Downloading, Installing, and Compiling NS has been described and some useful related tools has been introduced.
       
     A Sample NS project of mine may be downloaded here. It includes a general TCL script which could be considered as Queue Experimentation Benchmark. A source code shows how to trace various queue parameter values in a typical network topology. It is not well documented and the interested user may follow the NS manual along with comments in the presented script and source codes.

    Things to download
    If you want to just install and run NS on windows without having to compile the source code the following list includes the minimum things to download:
    NAM is a Tcl/TK based animation tool for viewing network simulation traces and real world packet traces. ActiveTCL is binary build of Tcl for Windows from ActiveState. Cygwin is a UNIX environment, developed by Red Hat, for Windows.
    If you want to install, compile and run NS on windows the following list includes the minimum things to download:

    How to install
    You may follow these steps to install NS on Windows:
    • Make a new folder on hard disk (Let's call it D:\NsProjects)
    • Copy downloaded NS binary for windows (e.g. ns-2.1b9a-win32.exe) to D:\NsProjects and rename it as ns.exe
    • Copy downloaded NS binary for windows (e.g. nam-1.0a11a-win32.exe) to D:\NsProjects and rename it as nam.exe
    • Go to downloaded Cyqwin directory and install it. (Run setup.exe and select "Install from local directory")
    • Go to downloaded ActiveTCL directory and install it (e.g. run ActiveTcl8.3.4.2-1-win32-ix86.exe)
    • Restart computer after installing ActiveTCL. It may not ask for restarting but you have to do this for initializing some of the system environment variables.
    • Create a sample TCL script for NS. You may find many sample TCL scripts in NS manuals. For example get this one (example2.tcl). Copy the tcl script to D:\NsProjects.
    Now you have all of the required files. Follow these steps for running NS:
    • Run Cygwin
    • In Cygwin window use "cd" commands and go to D:\NsProjects (You may use "mount" command without any parameter to have the list of the mounted file systems. e.g. you may go to /cygdrive/D/NsProjects)
    • In Cygwin window run "ns example2.tcl"

    Useful related tools
    • TraceGraph: This is a very useful analysis tool for NS written by Jaroslaw Malek. It uses MATLAB 6.0 run-time libraries. You may find out more about and download it here.
    • GnuPlot: This is the well known "General purpose plotting program". VINT's proposed plotting tool for NS is "xgraph", but it is just available in X-Windows. GnuPlot may be used as graphing tool in Windows. You may find out more about and download it here. (Link1)
    • Javis: Javis is the Java implementation of Nam, the network animator which can show animations of Nam trace files.You may find out more about and download it here.

    How to compile

    All download links
    WBJEEM

    WELCOME WBJEEM 2015

    The West Bengal Joint Entrance Examinations Board was formed in the year 1962 for the purpose of holding Common Entrance Examinations for the Undergraduate Level Engineering Courses in the State of West Bengal. The endeavour of the Board has always been directed towards enhancement of transparency in conducting Common Entrance Examinations for various professional Undergraduate and Postgraduate level courses in the State through effective state-of-the-art technology. Online application and admission through e–Counselling is operational for the undergraduate level Engineering and Medical courses of the State......Read More...

    Download Admit Card

    Projects in Chennai

    ABOUT NS2:
    NS (Network Simulator occurrence complex simulators, specifically are discrete-event network simulator, mainly used in investigate and training. NS-2 is a very popular discrete event Network Simulator which is widely used in the research field of Wired, Wireless and Satellite Networks across both academia and industry as a way of designing, testing and evaluating new and existing protocols and arc useful tool for teaching purposes.
    NS-2 comes fully equipped of protocols, models, algorithms and accessory tools. NS-2 is an open source network simulator which is freely available for academic research purpose. The number of tools/modules and cost, NS NS is a discrete event simulator targeted at networking research. N substantial support for simulation of TCP, routing, and multicast protocols over wired and wireless (local and satellite) networks.

    NS-2 started as a variant of the REAL network simulator in 1989 and has since been supported by the Virtual Inte that is a DARPA-funded research project whose aim is to build a network simulator.

    WHY NS2? When the system under research is complex to either follow an analytical approach or implement it in real time to study its behav the solution that ultimately makes it feasible by mimicking the actual process. Network researches wholly depend on the availability of numerous simulation tools like O tools it would be difficult to even imagine the advancements we have reached in networking. Of the numerous tools available, Network Simulator or NS2 (as it is famously called) stands distinct from the rest of the simulators.

    FUTURE SCOPE OF NS2:
    NS2 uses C++ language to implement the research projects. the C/C++ Programming language is immeasurable. C and C++ ruled out the software programming structures in our life or in the entire software fields. C/C++ is basic for all the programming languages for today’s life. C/C++ produces the great future for excellent programmers. C/C++ is the basic software structure for all the programming languages like Java, Android, C# and so on.

    WHO SHOULD ATTEND?
     College students those who are all having academic training in this session. Fresher’s or Job seekers in the latest technologies. Who are all want to development their knowledge in emerging technologies People who are all want their carrier in the software developer Interested candidates in latest emerging technologies AFTER COURSE COMPLETION: Will be experienced in writing the basic programming languages. Will be able to write all the robust code around the I/O operation codes Will be able to directly apply relevant skills in the workplace in the latest project using NS2. Will be able to design security controls and incorporate into applications Will be able for the essentials of Object  Basic Fundamentals and handling the software Environments SOFTWARE DEVELOPMENT & RESEARCH DIVISION

    WHO SHOULD ATTEND? College students those who are all having academic training in this session. seekers in the latest technologies. Who are all want to development their knowledge in emerging technologies People who are all want their carrier in the software developer Interested candidates in latest emerging technologies AFTER COURSE COMPLETION: Will be experienced in writing the basic programming languages. Will be able to write all the robust code around the I/O operation codes Will be able to directly apply relevant skills in the workplace in the latest Will be define your own Programming development in NS2 Courses completion certificate with ISO standardized for job opportunities Assurance of 100% placement able to design security controls and incorporate into applications Will be able for the essentials of Object oriented programming Basic Fundamentals and handling the software Environments


    The project deliverables for JAVA / DOTNET /ANDROID / NS2 / MATLAB are:

    1) PROJECT BASEPAPER, Abstract Document
    2) Complete Source code, Database
    3) Final Report / Document
              (Document consists of basic contents of about Abstract, Bibilography, Conclusion, Implementation, I/P & O/P Design, Introduction, Literature Survey, Organisation Profile, Screen Shots, Software Environment, System Analysis, System Design, System Specification, System Study, System Testing)
              (The chapter System Design consists of 5 diagrams: Data Flow, Use Case, Sequence, Class, Activity Diagram)
    3) Review Documents and PPT (for 4 Reviews)
    4) How to run Help file/Video file.

     


    INTRODUCTION

    Network Simulator is software used to simulate a wide range of real world networks and study the behavior of the network without using physical network components. The program performs this by tracing the interactions between the different network entities (hosts/routers, data links, packets, etc) using mathematical formulas. The behavior of the network can be observed for the various user inputs. Various attributes of the environment can also be modified in a controlled manner to access these behaviors under different conditions.
    Simulation processes are based on the actual behaviors of network devices and protocols. We have presented a practical use for the implementation of network design and analysis tools.

    Problem statement
    The SNiP Network Simulator helps in design, study and observe the behavior of various networks without using the actual networking components. It also plots required graphs to study the data transfers carried out, packets dropped and collisions occurred.

    SYSTEM DESIGN

    4.1 Architecture

    2.1.1 Drawing the network topology
    The network devices are drawn on the work panel by clicking on the appropriate network device in the toolbox provided at the top of the editor.
    As we see in other editing software’s, the SNiP Network Simulator provides a toolbox containing the network devices such as node, router, switch etc to draw the network topology.
    The network devices are drawn on a work panel by clicking on the appropriate device icon from the toolbox and on the work panel. The properties are set by selecting the properties option from the context menu, which can be invoked by right clicking the network device icon drawn on the work panel.

    2.1.2 Setting up properties
    The properties are the characteristics associated with the network devices. All the network devices are set to the default property when it is drawn. The properties of different types of network devices are maintained differently in structure and all the objects which represent the same network device are stored in the same array. The properties of a network device are displayed by just right clicking on the appropriate device and selecting properties option from the context menu. The properties then changed and saved. The saved properties overwrite the existing value and the array list is updated.

    2.1.3 Compiler: To compile the topology
    The compilation unit compiles the topology drawn. Two different branches are used for the compilation of algorithmic simulation and real world simulation. The compiler checks for the syntax error in the properties of all the network devices and connection errors if any mismatch occurred in connection.


    The compilation unit further generates warnings and messages. Warnings are not errors but some cautions generated may be remembering the user to set some properties for network devices or remembering to connect the network device if any connection is left out. Once the topology becomes error free, then the compiler translates all the properties set to the network topology to commands for the simulation engine.

    2.1.4 Command Prompt
    The command prompt is used to enter commands to set the properties of network entities and replaces all GUI interfaces with commands. As shown in the above figure, the command prompt interacts with network topology and compiler.
    Example “add node 1 stcp 127.0.0.1” adds the “stcp 127.0.0.1” to node 1.
    The user can use to compile the simulation by the command “compile”. The connection establishment details can be entered directly into the command prompt. The sequence of connection establishment is dumped by the simulation engine to the command prompt.

    2.1.5 Simulation engine
    The simulation engine does data transfer as simulation. It establishes the connection, generates the packets, sends them to the router, and forwards to the other network devices and thus controls the data transfer. It also logs all the packets sent to the network.
    The simulation engine is associated with the algorithms. It calculates the shortest path for the connection establishment, generates the packets in constant rate from a sender and sends through the link in link speed, stores in router buffer and does the data transfer as data transfer occurs in real network.

    Elements of simulation engine are
    • Packet generator
    • Data transfer unit
    • Timer.


    2.1.6 Packet generator
    The packet generator generates the packets. The packet size is pre defined in the properties of a node. The packet generator is associated with the timer. The packet generator generates the packets in a definite time intervals.
    The packet generator generates TPDUs for the acknowledgements from a active sender or receiver.

    2.1.7 Data transfer unit
    The data transfer unit transfers the data packets in the network. Path for the packet transfer, speed of connection, and the packet itself is the input to the data transfer unit. The data transfer unit is synchronized with the timer. Depending on the bandwidth and time the data transfer unit transmits the packet as it occurs in real network.

    2.1.8 Timer
    The timer gives the timing signals to the simulation engine. When it updates the time, it gives the signal to the simulation engine. The simulation calls the packet generator and transmits the generated packets to the network.

    2.1.9 Stack Trace: Packet details
    The stack trace gives the details of all packets. It has the following fields
    Time: Gives the exact time in which the packet is transmitted.
    Size: Gives the size of the packet.
    From: Gives the source host name from where the packet is transferred.
    To: Gives the destination host number to where the packet is transferred.
    Route: Gives the route for the packet transfer.
    Status: Contains the status of the packet. If the packet is dropped it contains “dropped” else “transmitted”.

    2.1.10 Graph Plotting: Selecting log details for graph plotting
    Graph of transmitted and dropped packet can be plotted using graph plot tool. The graph plot tool takes the stack trace as input. Depending on the status in stack trace, the graph plot tool divides the entire packet history into transmitted and dropped packets and thus plots the graph.

    2.1.11 Play back of the data transfer
    After the simulation is finished, the simulation server will send back the simulation result files to the GUI program. A log file is created and the file will be the input for playback. The playback gives the packet transfer information in GUI.

    The packet animation trace file can be replayed later by the packet animation player. The performance curve of these log files can be plotted by the performance monitor.

    2.2 Features
    The SNiP Network Simulator has many useful features listed as follows:

    • Its simulation speed is high and its simulation results are repeatable.
    • The SNiP Simulator runs on windows platform.
    • There is no need for kernel up-gradation and manual invocation of external processes.
    • It provides a highly integrated and professional GUI environment. This GUI can help a user

     Draw network topologies.
     Configure the protocol modules used inside a node.
     Specify the moving paths of nodes.
     Plot network performance graphs.
     Playing back the animation of a logged packet transfer trace, etc. All these operations can be easily and intuitively done with the GUI.

    SNiP uses a simple but effective syntax to describe the settings and configurations of a simulation job. These descriptions' are generated by the GUI and stored in a file. Normally the GUI will automatically transfer the file to the simulation engine for execution. However, if a researcher wants to try his (her) novel device or network configurations that the current GUI does not support, he (she) can totally bypass the GUI and generate the suite of description file by himself (herself) using the command prompt . The commands entered in the command prompt are directly transferred to the simulation engine for execution.



    Chapter 3
    DETAILED DESIGN

    3.1 Front end design
    The front end is designed using .NET and visual C#. The front end includes a network editor and GUI design. The network editor contains toolbox and menus.
    The SNiP Simulator model contains 32 windows forms and 7 separate code files. The starting Windows form is SimCont.cs which is a Multiple Document Interface (MDI) parent. The SimCont form holds the instance of WorkPanel form as MDI child. The SimCont form contains a toolbox, which contains different icons for network devices. SimCont also contains a menu strip. The menu strip holds File, Edit, Tools, Simulate and Help menus and submenus.
    The first form which loads into the memory is loadingfrm.cs. It calls SimCont.cs and further AObj.cs. The AObj.cs allocates objects and memory for those objects.
    Network devices are drawn by clicking on the toolbar and then Work Panel. Every network device is associated with a form and some procedures inside the form for construction of new devices, to set the properties. When the new devices are created default properties are set. All the network devices including link are associated with different structure and an array list. The structure maintains the behavior of the device whereas the array list contains instances of those structures.
    Every Network device is linked with a context menu strip. Right-clicking the device invokes the menu. The menu contains items such as Cut, Copy, Delete, Properties etc. Clicking on the properties invoke the form associated with the network device which contains the characteristics of the device. Lines can be drawn from one network device to other. Line drawing procedure is written in LineFrm.cs. The line drawing is done by calling DrawALine function inside the LineFrm.cs. The DrawALine function calls midpoint line algorithm written inside Midline.cs code module, to find out all points of the line for packet transfer animation.
    The CompPro.cs windows form contains the definition for errors and warnings. It contains definition for 7 errors and 3 warnings. All the errors and warnings are associated with an ID.
    ConnectionFrm.cs establishes the connection. It establishes a path from an active sender to receiver. It finds a shortest path among them and establishes the connection and makes the sender and receiver ready for packet transfer.
    It contains a structure STCP which contains three fields. The first field represents the active sender of the connection. Second field gives the active receiver. The last field gives the path for data transfer.
    LineFrm.cs, RouterFrm.cs, NodeFrm.cs, HubFrm.cs, SwitchFrm.cs are the Windows forms for the represents the characteristics of Network Connector, Router, Node, Hub and Switch respectively. Selecting properties of the respective device by right clicking on it invokes particular Windows form associated with it.
    Other windows forms
    Windows Forms Description
    SettingsFrm.cs This is designed for the customization of the simulator. The form contains options to set the colors in playback, data and time limit for simulation etc
    StackTrace.cs is designed to display a stack trace window after the simulation. The form contains a listbox which contains ID, Size, Source, Destination and for status of the packet.

    GraphControl.cs Draws a graph. The input for the control is the x co-ordinate and y co-ordinate points and scale for drawing.
    GraphFrm.cs This provides a Windows form for GraphControl.cs. Along with this it also mines the data form the simulation to draw the graph and adds GraphControl.cs.

    ImgList.cs Contains a list of icons for toolbox.
    TransactionLdFrm.cs Displays a loading form signifying the completion of transaction.
    GraphSelectFrm.cs Displays all nodes in a combo box and provides options to select the graph type such as transfer graph of drop graph
    CmdPromptFrm Invokes the command prompt. The command prompt can be used to interact with all the network devices and used to run the simulation.

    3.2 Algorithms
    Algorithm/Function Description
    MidLine Algorithm Mid Point line algorithm.
    Upon drawing every link, this algorithm is called.
    Saves all X and Y points of a line in an Arraylist.
    FileWrite FileRead Functions Writes and reads the entire network drawn in the WorkPanel. All network devices are written into the file in a format and the same format is used for reading the file.
    CompileAll Compiles the simulation. If any syntax error exists in the topology then it displays the error else the simulation is ready to run. The run button is enabled.
    TransferData Animation for transfer of data in real time. The procedure takes bandwidth and data size to be transferred and calculates the time required for data transfer.
    DrawGraph This function draws the graph. The input is X co-ordinate points and Y co-ordinate points and scale.
    StackTrace This function displays the status of every packet transferred from a source to a destination.
    CnctNetDFrm Contains information about the network links. The bandwidth and type of the links can be changed here.
    GetAIp This function gets a random IP address. The IP address returned from this function contains 4 fields, and all fields within the range 0-255
    SimulateAll Simulates the entire network from the connection establishment phase until the end of the data transfer. This procedure creates log files, which gives the details of data transfer.
    FlushAll Flushes all the buffer arrays associated with the actual buffer of routers, switches hubs. Also clears all the file transfers.
    TCPpiar Finds out shortest path form a source to a destination and stores for shortest path for TCP connection.
    FwdRouterToRouter Forwards packets from router to router.
    FwdRouterToSwitch Forwards packets from router to switch.
    FwdRouterToHub Forwards packets from router to hub.
    FwdSwitchToRouter Forwards packets from switch to router.
    FwdSwitchToSwitch Forwards packets from switch to switch.
    FwdSwitchToHub Forwards packets from switch to hub.
    FwdHubToRouter Forwards packets from hub to router.
    FwdHubToSwitch Forwards packets from hub to switch.
    FwdHubToHub Forwards packets from hub to hub.

    STRUCTURES Description

    SNODE
    To hold the properties of a node. A Node has the following properties.
    Node Number: All the nodes are numbered to identify the node.
    IP Address: This field holds the IP address of the node
    X and Y hold the position of the node icon.
    Pb holds the picture box which contains icon of the node.
    DCmd holds the command entered into a node.


    SROUTER To hold the properties of a router. A router has the following properties.
    Router Name: Holds the name of the router.
    Router Number: All the routers are numbered to identify the router.
    Pb holds the picture box which contains icon of the router.
    X and Y hold the position of the node icon.
    ConD : Holds the connection information
    maxBuf : Holds the buffer size of the router

    fillBuf : Holds the filled buffer information
    pckTs: Arraylist that holds the packets as a queue.

    SLINE Holds the link information. The line link information includes the bandwidth of the link and description about the link.

    SHUB Holds the properties of hub. This includes the buffer size of the hub, unique number assigned to the hub for identification.

    SPACKET
    Holds packet information. Packet information includes size of the packet, source and destination of the packet.

    SSTACK Holds a stack entry. The stack entry includes a SPACKET, source and destination of the packet and status of the packet which gives the information about whether the packet is sent successfully or not.

    STCP Holds the source, destination and path for TCP connection.

    SNODECMD Holds the command entered at the node.
    The command includes the command string start time to start the data transfer.
    3.1 Introduction
    A simulation is an imitation of some real thing, state of affairs, or process. The act of simulating something generally entails representing certain key characteristics or behaviors of a selected physical or abstract system.
    A computer simulation is an attempt to model a real-life situation on a computer so that it can be studied to see how the system works. By changing variables, predictions may be made about the behavior of the system.

    3.2 Network simulator
    A network simulator is a piece of software that simulates a network, without an actual network being present. Network simulators serve a variety of needs. Compared to the cost and time involved in setting up an entire test bed containing multiple networked computers, routers and infrastructure, network simulators are relatively fast and inexpensive. They allow engineers to test scenarios that might be particularly difficult or expensive to simulate using real hardware- for instance, simulating the effects of a sudden burst in traffic on a network service. Networking simulators are particularly useful in allowing designers to test new networking protocols or changes to existing protocols in a controlled and reproducible environment.
    Network Simulators, as the name suggests are used by researchers to design various kinds of networks, simulate and then analyze the effect of various parameters on the network performance. A typical network simulator like NS2, encompasses a wide range of networking technologies and help the users to build complex networks from basic building blocks like variety of nodes and links. With the help of simulators one can design hierarchical networks using various types of nodes like computers, hubs, bridges, routers, optical cross connects, multicast routers, mobile units, etc. Various types of Wide Area Network (WAN) technologies like packet, circuit, burst switching etc and Local Area Network (LAN) technologies like Ethernet, token rings etc can all be simulated with a typical simulator and the user can test, analyze various standard results apart from devising some novel protocol or strategy for routing etc.
    There are a wide variety of network simulators, ranging from the very simple to the very complex. Minimally, a network simulator must enable a user to represent a graph of a network, specifying the nodes on the network and the links between those nodes. More complicated systems may allow the user to specify everything about the protocols used to handle network traffic. Graphical applications allow users to easily visualize the workings of their simulated environment. Text-based applications may provide a less intuitive interface, but may permit more advanced forms of customization. Others, such as GTNets, are programming-oriented, providing a programming framework that the user then customizes to create an application that simulates the networking environment that he or she wishes to test.

    3.3 Introduction to TCP Protocol
    Introduction to TCP (Transmission Control Protocol)
    TCP was specially designed to provide a reliable end-to-end byte stream over an unreliable inter network. An inter-network differs from a single network because different parts may have widely different topologies, bandwidths, delays, packet sizes, and other parameters. TCP was designed to dynamically adapt to properties of the inter network and to be robust in the face of many kinds of failures.
    Each machine supporting TCP has a TCP transport entity, either a library procedure, a user process, or part of the kernel. In all cases, it manages TCP streams and interfaces to the IP layer. A TCP entity accepts user data streams from local processes breaks them up into pieces not exceeding 64KB and sends each piece as a separate IP datagram. When datagrams containing TCP data arrive at a machine, they are given to the TCP entity, which reconstructs the original byte streams.
    The IP layer gives no guarantee that datagrams will be delivered properly, so it is up to TCP to time out and retransmit them as needed. Datagrams that do arrive may well do so in the wrong order; it is also up to TCP to reassemble them into messages in the proper sequence. In short, TCP must furnish the reliability that most users want and that IP does not provide.

    TCP 7000
    FTP 21 file transfer
    Tenet 23 remote login

    3.4 The SNiP Network Simulator
    SNiP Network simulator attempts to provide real world network simulation. Real world network simulation is associated with the protocols used in real world. It includes TCP/IP, UDP, FTP, etc. SNiP provides a user friendly interface to draw and simulate the topology, playback to view the data transfers, stack trace to view the data transfer of each and every packet transferred. Along with this it also provides graph drawing tool, which can be used to plot the graph giving details about in-throughput, out-throughput, collisions occurred at all the network devices.
    The real time network simulation tool provides the user exact time required for data transfer for a specified bandwidth and datum under various conditions.
    The SNiP Network simulator can be used by professionals for studying real world networks, problems encountered, and for educational purposes.

    3.5 System Requirement Specification
    Once the analysis is complete, the requirements must be written or specified. The final output is the Software Requirements Specification document (SRS).The SRS captures the complete software requirements for the project Network Simulator. This SRS will describe the different functionalities of GUI Network Simulator. This SRS outlines the product requirements on functional basis. The SRS will define how our team envision the final product and the characteristics or functionalities it must have

    --> The system should have a work panel or work window to design the network topology.
    --> The system should have a toolbox with different tools to draw network devices.
    --> The system should contain a compiler for compilation and running of network drawn.
    -->The system should have facilities like editing the network topology, setting up properties for network devices and playback.
    --> The system should provide some tools such as graph plotting tool, stack trace, command prompt which helps to study the behavior of the simulation.
    --> The system should provide printing tool to print the network topology.
    --> The system should implement some algorithm such as Prims algorithm to find out the shortest path spanning tree with in the topology.

    Work Panel: To design the network topology
    The work panel is a tool to draw the network. The network devices are drawn on work panel by selecting appropriate network device on the toolbox provided at the top of the editor and drawing on the work panel.

    Tool box: To draw network devices
    The SNiP Network Simulator provides a toolbox which contains standard tools for standard operation such as “open” to open a file or “save” to save the file and Network toolbox containing network devices such as node, router, switch etc to draw the network topology.

    Properties: Setting up properties
    The properties are the network characteristics of particular network device. The properties are set by right-clicking on the network devices and selecting “Properties” option. Different types of network devices have different properties.
    Example: Node has the properties like IP address, transmission mode, commands required for establishment of connections.
    Router contains properties like buffer size, router name, router ID and routing table.

    Compiler: compiles the simulation
    The SNiP Simulator contains a compiler which compiles the topology before the simulation. The compiler detects the errors and warnings and displays if any. If no errors found, then it converts properties of all network devices to commands.

    Command Prompt
    The command prompt is used to control the topology and properties of network devices. The connection establishment details can be entered directly to the command prompt. The command prompt replaces all GUI interfaces with commands. The sequence of connection establishment is dumped by the system to the command prompt.

    Stack Trace: Packet details
    Stack trace gives the information about all the packets transmitted in the network form one network device to other.

    Graph Plotting: Selecting log details for graph plotting
    Graph of transmitted and dropped packets can be plotted using graph plot tool. The graph plot tool takes the log file of the simulation.

    Algorithmic simulation: Simulation of standard algorithms
    The algorithmic simulation is used to simulate the algorithm. Algorithmic simulation uses only nodes and network links. Distances are assigned to the links directly from the link properties.


    3.6 Configuration
    3.6.1 Hardware Configuration
    No special hardware configuration is required. Hardware configuration which is sufficient to run Windows XP is sufficient.

    3.6.2 Software Configuration
    A software package is created from software package building provided by visual studio. The software package should be installed. Before installing the software the existing system should be upgraded to Windows XP Service Pack 2.0 and .NET framework should be installed. After the installation of framework the package is ready to run. The package creates a desktop icon and start menu icon.

    FEASIBILITY STUDY

    2.1 Introduction
    In the feasibility study we check whether the SNiP simulator project can be developed within the available software and hardware technologies. We also check whether the system to be developed is cost effective and whether it satisfies all the proposed requirements.
    During feasibility study various constraints such as time constraints, budgetary constraints, resource constraints etc are studied.
    The network simulator accounts for great amount of feasibility since the actual behavior of the system is simulated in a stand alone system which allows us to test the characteristics of the network by giving various inputs and analyzing the respective outputs in a short time and less amount of people involved
    The project is developed in Visual C# under .NET framework using Visual Studio 2005. The Visual Studio 2005 facilitates the development of Graphical User Interface (GUI) comprising various forms for different purposes using languages like Visual C#, Visual J#, Visual C++, VB .NET. The software developed in Visual Studio is compatible to run in any newer version of Windows.

    2.2 Existing System
    Whenever a new system is developed it is either a new product or is a further development of some existing product. There can be some drawback in the existing product. Most of the simulators do not have good user interfaces. Often being command oriented, they demand trained users. Some simulators require a Kernel up gradation which requires reinstallation of the operating systems. It acts as an over head and thus making it less user friendly.


    2.3 Proposed System
    The SNiP Network Simulator has a good Graphical User Interface. It can be installed and run on windows without any kernel upgradation. SNiP Network simulator attempts to provide real world network simulation. Real world network simulation is associated with the protocols used in real world. It includes TCP/IP, UDP, FTP, etc. SNiP provides a user friendly interface to draw and simulate the topology, playback to view the data transfers, stack trace to view the data transfer of each and every packet transferred. Along with this it also provides graph drawing tool, which can be used to plot the graph giving details about in-throughput, out-throughput, collisions occurred at all the network devices. The real time network simulation tool provides the user exact time required for data transfer for a specified bandwidth and datum under various conditions. The SNiP Network simulator can be used by professionals for studying real world networks, problems encountered, and for educational purposes.

    2.4 System Feasibility
    This study checks whether the proposed system satisfies all the requirements that are specified in the proposal. The SNiP Network simulator can simulate a variety of networks accurately.

    2.4.1 Operational Feasibility
    What are the users’ needs and how does a developer system meets them? A user interactive system is provided and the user can build the topology, specify the working environment and put constraints according to the needs.

    2.4.2 Technical Feasibility
    Technical feasibility is concerned with determining whether it is possible to code the project using the language selected. Visual C# is used and the developer software is Visual Studio 2005.
    Visual studio is a toolkit to develop windows based applications. It supports a variety of languages for the software development.
    The .NET framework is a completely new model for building systems on the windows family of operating systems.

    Features of .NET and Visual Studio
    • Full interoperability with existing win32 code: .NET allows invoking raw C based functions from managed code.
    • Complete and total language interaction: Unlike classic COM, .NET supports cross language inheritance, cross-language exception handling and cross language debugging. A common runtime engine shared by all .NET aware languages.
    • Multithreading: .NET provides multithreading. This allows the software to run modules in parallel.
    • Direct access to Windows APIs: .NET provides a direct access to windows APIs. The APIs including the DLL (Dynamic Link Library) functions.
    • Visual studio provides GUI design tools for designing the software. It simplifies the overhead of coding to an extent, and helps to reduce the software development time and provides a better user friendly system.

    2.4.3 Economical Feasibility
    Economical feasibility is used for evaluating the effectiveness of a system. The project does not involve any special hardware other than standard specifications.

    TESTING

    6.1 Introduction
    Software Testing is the process used to help identify the correctness, completeness, security, and quality of developed computer software. Testing is a process of technical investigation, performed on behalf of stakeholders, that is intended to reveal quality-related information about the product with respect to the context in which it is intended to operate. This includes, but is not limited to, the process of executing a program or application with the intent of finding errors. Quality is not an absolute; it is value to some person. With that in mind, testing can never completely establish the correctness of arbitrary computer software; testing furnishes a 'criticism' or comparison that compares the state and behavior of the product against a specification. An important point is that software testing should be distinguished from the separate discipline of Software Quality Assurance (SQA), which encompasses all business process areas, not just testing.

    6.2 White box and black box testing
    White box and black box testing are terms used to describe the point of view a test engineer takes when designing test cases. Black box being an external view of the test object and white box being an internal view. Software Testing is the process of executing software in a controlled manner; in order to answer the question “Does this software behave as specified?” Software testing is used in association with verification and validation. Verification is the checking of or testing of items, including software, for conformance and consistency with an associated specification. Software testing is just one kind of verification, which also uses techniques such as reviews, inspections, and walk-throughs. Validation is the process of checking what has been specified is what the user actually wanted.
    Validation: Are we doing the right job?
    Verification: Are we doing the job right?

    6.3 Unit Testing
    In unit testing each unit (basic component) of the software is tested to verify that the detailed design for the unit has been correctly implemented.
    The basic components such as command prompt, packet generator, timer, simulation engine are checked and verified to ensure that the detailed design is implemented.

    6.4 Integration testing
    In integration testing progressively larger groups of tested software components corresponding to elements of the architectural design are integrated and tested until the software works as a whole.
    After testing all the basic software components, the components are integrated to work as a single system and tested until the software works as whole.

    6.5 System testing
    In system testing the software is integrated to the overall product and tested to show that all requirements are met.
    In this step the software is tested to weather it meets the requirements to work as a network simulator.

    6.6 Regression Testing
    Changes made in order to fix bugs or develop further functionality may cause previously successful tests to fail, so regression testing is used to repeat the earlier successful tests to ensure that changes made in the software have not introduced new bugs/side effects.


    6.7 Test the front-end actions
    It has been checked whether the front end is responding properly for different user actions.