[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
DV routing
Dear All,
we have a problem with DV routing:
we have defined four nodes and told the simulator to use dynamic
routing.
There is a CBR agent attached to n0 and a Null agent attached to n3.
Simulation time is 5.0 seconds. Changing the cost of the duplex-link
between n0
and n3 at 2.5, we expect the routing to be updated and the traffic to be
re-routered
through the nodes n1 and n2.
The Tcl script (you can see it below) doesn't contain syntax errors, but
the packets
aren't re-routered. Which is a correct way to change the cost of a link
at a
certain moment of the simuation?
set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf
proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam &
exit 0 }
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
$ns cost $n0 $n1 2
$ns cost $n1 $n0 2
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
$ns cost $n1 $n2 1
$ns cost $n2 $n1 1
$ns duplex-link $n2 $n3 1Mb 10ms DropTail
$ns cost $n2 $n3 5
$ns cost $n3 $n2 5
$ns duplex-link $n3 $n0 1Mb 10ms DropTail
$ns cost $n0 $n3 1
$ns cost $n3 $n0 1
$ns rtproto DV
set cbr0 [new Agent/CBR]
$ns attach-agent $n0 $cbr0
set null3 [new Agent/Null]
$ns attach-agent $n3 $null3
$ns connect $cbr0 $null3
$ns at 1.0 "$cbr0 start"
#We have doubts about the next line!!!!!!
$ns at 2.5 "$ns cost $n0 $n3 100"
$ns at 5.0 "finish"
$ns run
Thanks in advance, bye, Lara.
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com