[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] Packets forwarded to down DynaLinks




Just for the record,


What to do if one wants to trace the  packets sent to a dynamic link
and log them as dropped when the link is down (instead of just
automagically disappearing):

- _Specifically_ make that link dynamic by invoking that link'
dynamic{} procedure in the script. E.g:

[$ns link $n1 $n2] dynamic

-Only _after_ that enable tracing on that link:

$ns trace-queue $n1 $n2 $<of_your_previously opened file that gets the "trace-all" log>


Explanation:

When the network dynamics code makes the link dynamic at the beginning
of the simulation it inserts a DynamicLink object in front of that
link but does NOT set properly the targets: E.g.  when the
packet is to be dropped by Connector::drop() the packet is only
silently discarded beacause "drop_" is 0 (NULL). That is why there is
no record of the packet existance (not even enquing does not appear in
the logs)

The above method works as calling the dynamic procedure explictely
introduces the right object in front of that link. And that is
populated accordingly by the subsequent trace-queue{}

Is it just me or this really is a _serious_ breakage in the network
dynamics code ?


Florian
(After 3 days of frustrating debugging)


> Hello all,

> Problems: 1) When a link is down I would like to trace/monitor the packets
> forwarded to that link.
> 	  2) Same but network-wide, in a "sensible" way (large networks)


> Digging through the code it seems that when a link becomes down (due
> to a "rtmodel-at" action) the DynamicLink::recv() function is handled
> the packet. It  tests status_ and, if down, the "drop" method is
> called. Which, if I understand correctly, _should_ log the packet as such


> But there is no such thing appearing in traces: The packet doesn't
> appear to be enqueued on the link (naturally, after a second
> thought:). The only packets that are logged as  "dropped" by the
> traces are the ones that were in transit when the failure occured.


> Could anyone shed some light into this ? Any ideas how can I solve
> my problem ?

> TIA,

> Florian


> P.S. Below is a (very) trimmed down version of the script I used

> ----------------------------------------------------------------------------

> set ns [new Simulator]
> set nstrf  [open STout.tr w]
> set namtrf [open out.nam w]
> set ltrf [open STout.ltr w]
> $ns trace-all $nstrf
> $ns namtrace-all $namtrf

> ###############################################################################

> set n0 [$ns node]
> set n1 [$ns node]
> set n2 [$ns node]
> set n3 [$ns node]


> # Topology:  n0-----n1---n2-----n3
> # The link between n1 and n2 is down between 1.0 and 2.0

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

> # Monitor the  link between n1 and n2 

>   $ns trace-queue $n1 $n2 $ltrf

>   set cbr0 [new Agent/CBR]
>   $ns attach-agent $n0 $cbr0
>   $cbr0 set packetSize_ 500
>   $cbr0 set interval_ 0.005

>   set null0 [new Agent/Null]
>   $ns attach-agent $n3 $null0

>   $ns connect $cbr0 $null0

>   $ns at 0.5 "$cbr0 start"
>   $ns at 0.999 "puts \"Link is going down at 1.0 \""
>   $ns rtmodel-at 1.0 down $n1 $n2
>   $ns at 1.999 "puts \"Link is going up at 2.0\""
>   $ns rtmodel-at 2.0 up $n1 $n2
>   $ns at 4.5 "$cbr0 stop"

> proc finish {} {
>         global ns namtrf nstrf
>         # Flush all trace files
>         $ns flush-trace
> 	#Close trace files
>         close $nstrf
>         close $namtrf
> 	#Execute nam on the trace file
> #        exec nam out.nam &
>         exit 0
> }


> #Call the finish procedure after 5 seconds simulation time
> $ns at 5.0 "finish"

> #Run the simulation
> $ns run