Wednesday 28 June 2017

Monday 24 April 2017

V Model



The V - model is a model where execution of processes happens in a sequential manner in V-shape. It is also known as Verification and Validation model.
V - Model is an extension of the waterfall model and is based on association of a testing phase for each corresponding development stage.
 So there are Verification phases on one side of the .V. and Validation phases on the other side. Coding phase joins the two sides of the V-Model.

Verification Phases

Following are the Verification phases in V-Model:
·    Requirement Analysis: This phase involves detailed communication with the customer to understand his expectations and exact requirement. This is a very important activity and need to be managed well, as most of the customers are not sure about what exactly they need. The acceptance test design planning is done at this stage as business requirements can be used as an input for acceptance testing.
·        System Design:  System design would comprise of understanding and detailing the complete hardware and communication setup for the product under development. System test plan is developed based on the system design. Doing this at an earlier stage leaves more time for actual test execution later.
·        Architectural Design: Architectural specifications are understood and designed in this phase. Usually more than one technical approach is proposed and based on the technical and financial feasibility the final decision is taken. System design is broken down further into modules taking up different functionality. This is also referred to as High Level Design (HLD).
·    Module Design: It is important that the design is compatible with the other modules in the system architecture and the other external systems. Unit tests are an essential part of any development process and helps eliminate the maximum faults and errors at a very early stage. Unit tests can be designed at this stage based on the internal module designs.

Coding Phases

The actual coding of the system modules designed in the design phase is taken up in the Coding phase. The best suitable programming language is decided based on the system and architectural requirements. The coding is performed based on the coding guidelines and standards. The code goes through numerous code reviews and is optimized for best performance before the final build is checked into the repository.

Validation Phases

Following are the Validation phases in V-Model:
·        Unit Testing: Unit tests designed in the module design phase are executed on the code during this validation phase. Unit testing is the testing at code level and helps eliminate bugs at an early stage, though all defects cannot be uncovered by unit testing.
·     Integration Testing: Integration testing is associated with the architectural design phase. Integration tests are performed to test the coexistence and communication of the internal modules within the system.
·        System Testing: System testing is directly associated with the System design phase. System tests check the entire system functionality and the communication of the system under development with external systems. Most of the software and hardware compatibility issues can be uncovered during system test execution.
·   Acceptance Testing: Acceptance testing is associated with the business requirement analysis phase and involves testing the product in user environment. Acceptance tests uncover the compatibility issues with the other systems available in the user environment. It also discovers the non functional issues such as load and performance defects in the actual user environment.

Saturday 25 February 2017

Isy Year Materials

C Programming  2 &3 Marks Questions of UNIT-1

Download 

C Short Answers 

Click to Download

 M-1 II & III Marks Questions of UNIT -1

Download

MM II & III Marks Questions of UNIT -1

Download

 Engineering Chemistry 2nd & 3rd Marks Questions of UNIT -1

Download 

Download 2

Download 3

Engineering physics SAQ (2M,3M)  5 units

Click to Download

Wednesday 22 February 2017

Steps for conducting the experiment


General Instructions


Follow are the steps to be followed in general to perform the experiments in Advanced Network Technologies Virtual Lab.

  1. Read the theory about the experiment
  2. View the simulation provided for a chosen, related problem
  3. Take the self evaluation to judge your understanding (optional, but recommended)
  4. Solve the given list of exercises

Experiment Specific Instructions


In the theory part we have learned how to work with NS2. In this section we now learn how to make your system ready so that you can work with Network Simulator 2.NS2 is a open source software. It can be downloaded from Internet and installed.

Basic Requirements:

  • A computer which is having access to the Internet
  • Minimum 512Mb RAM
  • Operating system: Linux(Ubuntu 10.04)
  • ns-2.34 package
  • gcc-4.4.3
  • make tools

The following instructions for downloading and installing ns2 are for a system with:

  • Operating System: Linux (Ubuntu 10.04)
  • ns2: 2.34
  • gcc: 4.4.3

Some of the known problems that have been faced during installation as well as their solutions have been discussed in one of the sections below.
The steps for installation should ideally be applicable for other version and/or configuration of Linux also. Any other problem that might arise would require further troubleshooting.

Downloading ns-2.34


To download ns2 go to http://www.isi.edu/nsnam/ns/ns-build.html. Here you can download the ns all-in-one package or you can download the packages separately.

Well, lets learn how to download the packages separately.

  1. First go to http://www.isi.edu/nsnam/ns/ns-build.html.
  2. Then download Tcl and Tk from http://www.tcl.tk/software/tcltk/downloadnow84.tml [note: the versions of Tcl and Tk must be same.]
  3. Download OTcl from: http://sourceforge.net/projects/otcl-tclcl/files/OTcl/1.13/
  4. Download Tclcl from : http://sourceforge.net/projects/otcl-tclcl/files/TclCL/1.19/
  5. Download ns-2 from :http://sourceforge.net/projects/nsnam/files/ns-2/2.34/
  6. Download nam from :http://sourceforge.net/projects/nsnam/files/nam-1/1.14/ [note : download only nam-1.14.tar.gz not ns-allinone package.]
  7. Download xgraph from: http://sourceforge.net/projects/nsnam/files/xgraph/xgraph-12.1/

Note: there are some other few things to be downloaded but that depends upon your requirement.For example, if some error occurs for absence of any package,then you need to detect the error and download the required package.

Installation


Here we will install the the packages separately

  1. All the files will be zip format.So at first you need to unzip all the files. the command to unzip the files:

  2. tar -xzvf <file_name>

    for e.g if we want to unzip the Tcl package the type: tar -xzvf tcl8.4.19
    To unzip all the files together use the following command:

    for ifile in ` ls *.tar.gz`
    do
    ar -xzvf $ifile
    done

  3. Next, we will install Tcl.The command required is:
  4. cd tcl8.4.19
    ls
    cd unix
    ./configure
    make
    sudo make install

  5. Install Tk:
  6. cd tk8.4.19
    ls
    cd unix
    ./configure
    make
    sudo make install

  7. Install OTcl:
  8. cd otcl-1.13
    /configure --with-tcl=../tcl8.4.19 #note-while configuring we need to specify the path of tcl
    make
    sudo make install

  9. Install Tclcl-1.19:
  10. cd tclcl-1.19
    ./configure --with-tcl=../tcl8.4.19 #note-while configuring we need to specify the path of tcl
    make
    sudo make install

  11. Install ns-2.34:
  12. cd ns-2.34
    /configure --with-tcl=../tcl8.4.19
    make
    sudo make install

  13. Install NAM:
  14. cd nam-1.14
    ./configure --with-tcl=../tcl8.4.19
    make
    sudo make install 

  15. Install xgraph: 
  16. cd xgraph-12.1
    ./configure
    make
    sudo make install

Probable problems that could appear while installing the packages and their solution


1. Tk was installed properly but it failed to run somehow.

How to identify this:

After installing tk8.4.19 try to run the script tk8.4.19/unix/wish from the terminal.A small window will open,close it. If no error messages appears in the terminal then Tk installation is successful and Tk is working properly. This can also be verified after installing nam and then trying to run nam. The error message would be something like:

nam:
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
invoked from within
"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D)}] units
}
bind Li..."

Solution:


If you get error messages then download the patch files tk-8.4.18-tkBind.patch and tk-8.4-lastevent.patch from http://bugs.gentoo.org/show_bug.cgi?id=225999.

then copy those files into Tk directory.Now apply the patches by using the following command:

  1. patch -p1 < tk-8.4.18-tkBind.patch
  2. patch -p1 < tk-8.4-lastevent.patch

If fail to apply the patches then open the patch, check the name of the file to be patched, and make the relevant modifications to that file accordingly.

Note: the contents of the original file are shown with a minus(-) sign at the beginning.The modified contents do begin with a plus(+) sign. The contents of the two patch files are shown below for easy reference:

--- tk8.4.18-orig/generic/tkBind.c 2006-07-21 08:26:54.000000000 +0200
+++ tk8.4.18/generic/tkBind.c 2008-07-05 12:17:10.000000000 +0200
@@ -586,6 +586,9 @@
/* ColormapNotify */                                 COLORMAP,
/* ClientMessage */                                  0,
/* MappingNotify */                                    0,
+#ifdef GenericEvent
+ /* GenericEvent */                                 0,
+#endif
/* VirtualEvent */                                        VIRTUAL,
/* Activate */                                               ACTIVATE,
/* Deactivate */                                          ACTIVATE,

and

--- generic/tk.h.orig                     2008-02-06 16:31:40.000000000 +0100
+++ generic/tk.h                          2008-07-24 08:21:46.000000000 +0200
@@ -635,17 +635,15 @@
*
*---------------------------------------------------------------------------
*/
-#define VirtualEvent                (LASTEvent)
-#define ActivateNotify              (LASTEvent + 1)
-#define DeactivateNotify         (LASTEvent + 2)
-#define MouseWheelEvent    (LASTEvent + 3)
-#define TK_LASTEVENT       (LASTEvent + 4)
+#define VirtualEvent               (MappingNotify + 1)
+#define ActivateNotify             (MappingNotify + 2)
+#define DeactivateNotify       (MappingNotify + 3)
+#define MouseWheelEvent   (MappingNotify + 4)
+#define TK_LASTEVENT       (MappingNotify + 5)

#define MouseWheelMask       (1L << 28)
-
#define ActivateMask                  (1L << 29)
#define VirtualEventMask          (1L << 30)
-#define TK_LASTEVENT        (LASTEvent + 4)

/*
After doing all these stuffs, do install Tk from beginning again and also verify whether 'wish' runs properly(as indicated above).

2. Problem while running 'make' for OTcl

otcl.o: In function `OTclDispatch':
/home/barun/Desktop/ns2/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local'
otcl.o: In function `Otcl_Init':
/home/barun/Desktop/ns2/otcl-1.13/otcl.c:2284: undefined reference to `__stack_chk_fail_local'
ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined
ld: final link failed: Nonrepresentable section on output
make: *** [libotcl.so] Error 1

Solution:

  1. goto the 'configure' file
  2. In line no. 5516

SHLIB_LD="ld -shared"
change the above to
SHLIB_LD="gcc -shared"
for further information you can gob to http://nsnam.isi.edu/nsnam/index.php/User_Information

3. Problem wile running ' sudo make install' for ns-2.34

ns: error while loading shared libraries: libotcl.so: cannot open shared object file: No such file or directory

Solution:

We need to set the following environment variables, and store them in the ~/.bashrc file.
 1    OTCL_LIB=/your/path/ns-2.34/otcl-1.13
2    NS2_LIB=/your/path/ns-2.34/lib
3    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB
Now open a new terminal, and type ns. This should now work without any error.

4. Problem while running 'make' for nam

rm -f tkcompat.o; gcc -o tkcompat.o -c -Wall -Wno-write-strings -DTCL_TK -DNO_VOID -DNDEBUG -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_13 -DHAVE_OTCL_H -DHAVE_LIBTK8_4 -DHAVE_TK_H -DHAVE_LIBTCL8_4 -DHAVE_TCLINT_H -DHAVE_TCL_H -I. -I/home/bibudhendu/Desktop/ns2/tclcl-1.19 -I/home/bibudhendu/Desktop/ns2/otcl-1.13 -I/usr/local/include -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic tkcompat.c

rm -f tkUnixInit.o; gcc -o tkUnixInit.o -c -Wall -Wno-write-strings -DTCL_TK -DNO_VOID -DNDEBUG -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_13 -DHAVE_OTCL_H -DHAVE_LIBTK8_4 -DHAVE_TK_H -DHAVE_LIBTCL8_4 -DHAVE_TCLINT_H -DHAVE_TCL_H -I. -I/home/bibudhendu/Desktop/ns2/tclcl-1.19 -I/home/bibudhendu/Desktop/ns2/otcl-1.13 -I/usr/local/include -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic tkUnixInit.c

rm -f xwd.o; gcc -o xwd.o -c -Wall -Wno-write-strings -DTCL_TK -DNO_VOID -DNDEBUG -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_13 -DHAVE_OTCL_H -DHAVE_LIBTK8_4 -DHAVE_TK_H -DHAVE_LIBTCL8_4 -DHAVE_TCLINT_H -DHAVE_TCL_H -I. -I/home/bibudhendu/Desktop/ns2/tclcl-1.19 -I/home/bibudhendu/Desktop/ns2/otcl-1.13 -I/usr/local/include -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic xwd.c

xwd.c:87:29: error: X11/Xmu/WinUtil.h: No such file or directory make: *** [xwd.o] Error 1

Solution:
Install the package libxmu-dev. Then run

./configure
make clean
make
sudo make install

5. Problem while running 'make' for xgraph

/usr/include/stdio.h:651: note: expected ‘size_t * __restrict__’ but argument is of type ‘char *’
dialog.c:780: error: too few arguments to function ‘getline’
dialog.c: In function ‘getline’:
dialog.c:899: error: argument ‘lptr’ doesn’t match prototype
/usr/include/stdio.h:651: error: prototype declaration
dialog.c:899: error: number of arguments doesn’t match prototype
/usr/include/stdio.h:651: error: prototype declaration
make: *** [dialog.o] Error 1

Solution:

Download the patch below-

http://archive.ubuntu.com/ubuntu/pool/universe/x/xgraph/xgraph_12.1-12.diff.gz

Note: copy and unzip the above patch file into xgraph-12.1
view source
print?
1 patch < xgraph_12.1-12.diff
After applying the patch if you see in get any problem with the configure.in file like

configure.in:3: version mismatch. This is Automake 1.11,
configure.in:3: but the definition used by this AM_INIT_AUTOMAKE
configure.in:3: comes from Automake 1.11.1. You should recreate
configure.in:3: aclocal.m4 with aclocal and run automake again.

then goto configure.in file and add 'AC_LOCAL' in the first line.

Basics of Network Simulation

Objectives


After completing this experiment you will be able to:

  • Identify ambiguities, inconsistencies and incompleteness from a requirements specification
  • Identify and state functional requirements
  • Identify and state non-functional requirements

Time Required


Around 3.00 hours

After completing this experiment, you can able to :

  •  Learn the basic idea about open source network simulator NS2 and how to download, install and work with NS2 using TCL programming.
  • Defining the different agents and their applications like TCP, FTP over TCP, UDP, CBR and CBR over UDP etc.
  • Identifying and solving the installation error of NS2.

Introduction


The network simulator is discrete event packet level simulator.The network simulator covers a very large number of application of different kind of protocols of different network types consisting of different network elements and traffic models.Network simulator is a package of tools that simulates behavior of networks such as creating network topologies, log events that happen under any load,analyze the events and understand the network. Well the main aim of our first experiment is to learn how to use network simulator and to get acquainted with the simulated objects and understand the operations of network simulation and we also need to analyze the behavior of the simulation object using network simulation.

Platform required to run network simulator


  • Unix and Unix like systems
  • Linux (Use Fedora or Ubuntu versions)
  • Free BSD
  • SunOS/Solaris
  • Windows 95/98/NT/2000/XP

Backend Environment of Network Simulator


Network Simulator is mainly based on two languages.They are C++ and OTcl. OTcl is the object oriented version of Tool Command language.The network simulator is a bank of of different network and protocol objects. C++ helps in the following way:

  •  It helps to increase the efficiency of simulation.
  • Its is used to provide details of the protocols and their operation.
  • It is used to reduce packet and event processing time.
  • OTcl helps in the following way:
  • With the help of OTcl we can describe different network topologies
  • It helps us to specify the protocols and their applications
  • It allows fast development
  • Tcl is compatible with many platforms and it is flexible for integration
  • Tcl is very easy to use and it is available in free

Basics of Tcl Programming (w.r.t. ns2)


Before we get into the program we should consider the following things:

  1. Initialization and termination aspects of network simulator.
  2. Defining the network nodes,links,queues and topology as well.
  3. Defining the agents and their applications
  4. Network Animator(NAM)
  5. Tracing

Initialization

To start a new simulator we write

  1. set ns [new Simulator]
From the above command we get that a variable ns is being initialized by using the set command. Here the code [new Simulator] is a instantiation of the class Simulator which uses the reserved word 'new'. So we can call all the methods present inside the class simulator by using the variable ns.

Creating the output files
1    #To create the trace files we write
2    
3     set tracefile1 [open out.tr w]
4     $ns trace-all $tracefile1
5    
6    #To create the nam files we write
7    
8     set namfile1 [open out.nam w]
9     $ns namtrace-all $namfile

In the above we create a output trace file out.tr and a nam visualization file out.nam. But in the Tcl script they are not called by their names declared,while they are called by the pointers initialized for them such as tracefile1 and namfile1 respectively.The line which starts with '#' are commented.The next line opens the file 'out.tr' which is used for writing is declared 'w'.The next line uses a simulator method trace-all by which we will trace all the events in a particular format.
The termination program is done by using a 'finish' procedure

01    # Defining the 'finish' procedure'
02    
03    proc finish {} {
04         global ns tracefile1 namfile1
05         $ns flush-trace
06         close $tracefile
07         close $namfile
08         exec nam out.nam &
09         exit 0
10        }

In the above the word 'proc' is used to declare a procedure called 'finish'.The word 'global' is used to tell what variables are being used outside the procedure.

'flush-trace' is a simulator method that dumps the traces on the respective files.the command 'close' is used to close the trace files and the command 'exec' is used to execute the nam visualization.The command 'exit' closes the application and returns 0 as zero(0) is default for clean exit.

In ns we end the program by calling the 'finish' procedure

1    #end the program
2    $ns at 125.0 "finish"


Thus the entire operation ends at 125 seconds.To begin the simulation we will use the command

1    #start the the simulation process
2    $ns run


Defining nodes,links,queues and topology
Way to create a node:
view source
print?
1 set n0 [ns node]

In the above we created a node that is pointed by a variable n0.While referring the node in the script we use $n0. Similarly we create another node n2.Now we will set a link between the two nodes.

1    $ns duplex-link $n0 $n2 10Mb 10ms DropTail

So we are creating a bi-directional link between n0 and n2 with a capacity of 10Mb/sec and a propagation delay of 10ms.

In NS an output queue of a node is implemented as a part of a link whose input is that node to handle the overflow at the queue.But if the buffer capacity of the output queue is exceeded then the last packet arrived is dropped and here we will use a 'DropTail' option.Many other options such as RED(Random Early Discard) mechanism, FQ(Fair Queuing), DRR(Deficit Round Robin), SFQ(Stochastic Fair Queuing) are available.

So now we will define the buffer capacity of the queue related to the above link

1    #Set queue size of the link
2    $ns queue-limit $n0 $n2 20

so, if we summarize the above three things we get

01    #create nodes
02    
03    set n0 [$ns node]
04    set n1 [$ns node]
05    set n2 [$ns node]
06    set n3 [$ns node]
07    set n4 [$ns node]
08    set n5 [$ns node]
09    
10    #create links between the nodes
11    
12    $ns duplex-link $n0 $n2 10Mb 10ms DropTail
13    $ns duplex-link $n1 $n2 10Mb 10ms DropTail
14    $ns simplex-link $n2 $n3 0.3Mb 100ms DropTail
15    $ns simplex-link $n3 $n2 0.3Mb 100ms DropTail
16    $ns duplex-link $n0 $n2 0.5Mb 40ms DropTail
17    $ns duplex-link $n0 $n2 0.5Mb 40ms DropTail
18    
19    #set queue-size of the link (n2-n3) to 20
20    $ns queue-limit $n2 $n3 20

Agents and applications


TCP

TCP is a dynamic reliable congestion protocol which is used to provide reliable transport of packets from one host to another host by sending acknowledgements on proper transfer or loss of packets.Thus TCP requires bi-directional links in order for acknowledgements to return to the source.

Now we will show how to set up tcp connection between two nodes

1    #setting a tcp connection
2    
3    set tcp [new Agent/TCP]
4    $ns attach-agent $n0 $tcp
5    set sink [new Agent/TCPSink]
6    $ns attach-agent $n4 $sink
7    $ns connect $tcp $sink
8    $tcp set fid_1
9    $tcp set packetSize_552

The command 'set tcp [new Agent/TCP]' gives a pointer called 'tcp' which indicates the tcp agent which is a object of ns.Then the command '$ns attach-agent $n0 $tcp' defines the source node of tcp connection. Next the command 'set sink [new Agent/TCPSink]' defines the destination of tcp by a pointer called sink. The next command '$ns attach-agent $n4 $sink' defines the destination node as n4.Next, the command '$ns connect $tcp $sink' makes the TCP connection between the source and the destination.i.e n0 and n4.When we have several flows such as TCP, UDP etc in a network. So, to identify these flows we mark these flows by using the command '$tcp set fid_1'. In the last line we set the packet size of tcp as 552 while the default packet size of tcp is 1000.
FTP over TCP

File Transfer Protocol(FTP) is a standard mechanism provided by the Internet for transferring files from one host to another. Well this is the most common task expected from a networking or a inter networking . FTP differs from other client server applications in that it establishes between the client and the server. One connection is used for data transfer and other one is used for providing control information. FTP uses the services of the TCP. It needs two connections. The well Known port 21 is used for control connections and the other port 20 is used for data transfer.

Well here we will learn in how to run a FTP connection over a TCP

1    #Initiating FTP over TCP
2    
3    set ftp [new Application/FTP]
4    $ftp attach-agent $tcp

In above,the command 'set ftp [new Application/FTP]' gives a pointer called 'ftp' which indicates the FTP application.Next, we attach the ftp application with tcp agent as FTP uses the services of TCP.

UDP

The User datagram Protocol is one of the main protocols of the Internet protocol suite.UDP helps the host to send send messages in the form of datagrams to another host which is present in a Internet protocol network without any kind of requirement for channel transmission setup. UDP provides a unreliable service and the datagrams may arrive out of order,appear duplicated, or go missing without notice. UDP assumes that error checking and correction is either not necessary or performed in the application, avoiding the overhead of such processing at the network interface level. Time-sensitive applications often use UDP because dropping packets is preferable to waiting for delayed packets, which may not be an option in a real-time system.

Now we will learn how to create a UDP connection in network simulator.
1    # setup a UDP connection
2    set udp [new Agent/UDP]
3    $ns attach-agent $n1 $udp
4    $set null [new Agent/Null]
5    $ns attach-agent $n5 $null
6    $ns connect $udp $null
7    $udp set fid_2

Similarly,the command 'set udp [new Agent/UDP]' gives a pointer called 'udp' which indicates the udp agent which is a object of ns.Then the command '$ns attach-agent $n1 $udp' defines the source node of udp connection. Next the command 'set null [new Agent/Null]' defines the destination of udp by a pointer called null. The next command '$ns attach-agent $n5 $null' defines the destination node as n5.Next, the command '$ns connect $udp $null' makes the UDP connection between the source and the destination.i.e n1 and n5.When we have several flows such as TCP,UDP etc in a network. So, to identify these flows we mark these flows by using the command '$udp set fid_2

Constant Bit Rate(CBR)

Constant Bit Rate (CBR) is a term used in telecommunications, relating to the quality of service.When referring to codecs, constant bit rate encoding means that the rate at which a codec's output data should be consumed is constant. CBR is useful for streaming multimedia content on limited capacity channels since it is the maximum bit rate that matters, not the average, so CBR would be used to take advantage of all of the capacity. CBR would not be the optimal choice for storage as it would not allocate enough data for complex sections (resulting in degraded quality) while wasting data on simple sections.

CBR over UDP Connection

1    #setup cbr over udp
2   
3    set cbr [new Application/Traffic/CBR]
4    $cbr attach-agent $udp
5    $cbr set packetSize_1000
6    $cbr set rate_0.01Mb
7    $cbr set random _false

In the above we define a CBR connection over a UDP one. Well we have already defined the UDP source and UDP agent as same as TCP. Instead of defining the rate we define the time interval between the transmission of packets in the command '$cbr set rate_0.01Mb'. Next, with the help of the command '$cbr set random _false' we can set random noise in cbr traffic.we can keep the noise by setting it to 'false' or we can set the noise on by the command '$cbr set random _1'. We can set by packet size by using the command '$cbr set packetSize_(packetsize).We can set the packet size up to sum value in bytes.

Scheduling Events

In ns the tcl script defines how to schedule the events or in other words at what time which event will occur and stop. This can be done using the command
$ns at  .
So here in our program we will schedule the ftp and cbr.
1    # scheduling the events

2  

3    $ns at 0.1 "cbr start"

4    $ns at 1.0 "ftp start"

5    $ns at 124.0 "ftp stop"

6    $ns at 124.5 "cbr stop"

Network Animator(NAM)

When we will run the above program in ns then we can can visualize the network in the NAM. But instead of giving random positions to the nodes, we can give suitable initial positions to the nodes and can form a suitable topology. So, in our program we can give positions to the nodes in NAM in the following way

1    #Give position to the nodes in NAM
2    
3    $ns duplex-link-op $n0 $n2 orient-right-down
4    $ns duplex-link-op $n1 $n2 orient-right-up
5    $ns simplex-link-op $n2 $n3 orient-right
6    $ns simplex-link-op $n3 $n2 orient-left
7    $ns duplex-link-op $n3 $n4 orient-right-up
8    $ns duplex-link-op $n3 $n5 orient-right-down

We can also define the color of cbr and tcp packets for identification in NAM.For this we use the following command

1    #Marking the flows
2    $ns color1 Blue
3    $ns color2 Red

To view the network animator we need to type the command: nam

Tracing


Tracing Objects

NS simulation can produce visualization trace as well as ASCII file corresponding to the events that are registered at the network. While tracing ns inserts four objects: EnqT,DeqT,RecvT & DrpT. EnqT registers information regarding the arrival of packet and is queued at the input queue of the link. When overflow of a packet occurs, then the information of thye dropped packet is registered in DrpT.DeqT holds the information abut the packet that is dequeued instantly.RecvT hold the information about the packet that has been received instantly.



Structure of Trace files

  1. The first field is event.It gives you four possible symbols '+' '-' 'r' 'd'.These four symbols correspond respectively to enqueued, dequeued, received and dropped.
  2. The second field gives the time at which the event occurs
  3. The third field gives you the input node of the link at which the event occurs
  4. The fourth field gives you the the output node at which the event occurs
  5. The fifth field shows the information about the packet type.i.e whether the packet is UDP or TCP
  6. The sixth field gives the packet size
  7. The seventh field give information about some flags
  8. The eight field is the flow id(fid) for IPv6 that a user can set for each flow in a tcl script.It is also used for specifying the color of flow in NAM display
  9. The ninth field is the source address
  10. The tenth field is the destination address
  11. The eleventh field is the network layer protocol's packet sequence number
  12. The last field shows the unique id of packet

Following are trace of two events:

r 1.84471 2 1 cbr 210 ------- 1 3.0 1.0 195 600
r 1.84566 2 0 ack 40 ------- 2 3.2 0.1 82 602

The trace file can be viewed with the cat command:

cat out.tr

Tuesday 14 February 2017

THE TCL SCRIPT GENERATOR

NSG 2.1 - THE TCL SCRIPT GENERATOR

NS2 Scenarios Generator (NSG) is a tcl script generator tool used to generate TCL Scripts automatically . . . !!!
NSG is a Java based tool that runs on any platform and can generate TCL Scripts for Wired as well as Wireless Scenarios for Network Simulator - 2. The procedure to execute these TCL Scripts on NS-2 is same as those of manually written TCL Scripts.

Some of the main features of NS2 Scenarios Generator (NSG) are as mentioned below:

(1) Creating Wired and Wireless nodes just by drag and drop.
(2) Creating Simplex and Duplex links for Wired network.
(3) Creating Grid, Random and Chain topologies.
(4) Creating TCP and UDP agents. Also supports TCP Tahoe, TCP Reno, TCP New-Reno and TCP Vegas.
(5) Supports Ad Hoc routing protocols such as DSDV, AODV, DSR and TORA.
(6) Supports FTP and CBR applications.
(7) Supports node mobility.
(8) Setting the packet size, start time of simulation, end time of simulation, transmission range and interference     range in case of wireless networks, etc.
(9) Setting other network parameters such as bandwidth, etc for wireless scenarios.

The Snapshots of NSG is as shown below:
 

 

Download NSG2 :

NSG2 (2007/5/20)
NSG2.1 (2008/11/18)
If you still wanna download NSG1 (previous version of NSG), it can be found here.
To execute NSG you need to install Java 6.0. NSG does not require any installation . . . !!! Just double click on the jar file to launch NSG. If it does not work, please see the instructions provided on the homepage of NSG here.
For more information on NSG and its previous versions, please visit the homepage of NSG here.

Launch NSG2 :

To execute NSG2, you have to install JAVA6.0 first. You can download JAVA6.0 from http://java.sun.com/. The details of JAVA6.0 installation, please refer to Sun JAVA site.
NSG2 doesn't need to be installed in your computer. You just download it and launch it with following instruction under TERMINAL command environment. 
In fact, on my computer system, Ubuntu 12.04 I just double click the NSG2.jar, and NSG2 will automatically launch. If it doesn't launch, you can also launch NSG2 as following instructions.
  • open terminal
  • change directory into the folder where NG2.1.jar is copied.
  • type this cammand
    java -jar NSG2.1.jar