Sunday 13 November 2016

CREATING TOPOLOGY AND MARKING FLOWS IN NS2

We use the following code in order to have some control over the layout of the network which is to be drawn in network simulator.
Its syntax is as:
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up

$ns duplex-link-op $n2 $n3 orient right




 Assuming we have four nodes n0,n1,n2,n3 which are created using syntax as stated earlier.
Also we assume that the nodes are connected as n0n2,n1n2,n3n2 and using duplex links which can also be written using syntax .

MARKING FLOWS:

In order to mark the flows coming from different agents i.e. to recognize which packets are coming from which nodes, we use the following code:
$udp set class- 1
$udp set class- 2
We assume that these udp agents are applied to nodes in our network.
In order to assign colors to packets coming from different nodes we use the following code:
$ns color 1 blue
$ns color 2 red


No comments:

Post a Comment