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

[ns] Packets forwarded to down DynaLinks





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