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

Multicast Packet Counter/code



The code attachment didn't show up correctly in the archives, so here is
the short multicast code, with the original questions below it:

#m2.tcl by Lori Flynn   
#A simple CBR multicast

 # 
 #
## Using Multicast in ns
##
## joining & pruning test(s) 
#           |0|
#           /
#          |1|
#         /   \ 
#        |2|  |3|
#        /     /
#       |4|---|5|

set ns [new Simulator -multicast on]
Simulator set NumberInterfaces_ 1

set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
set group [Node allocaddr]

set f [open out-m2.tr w]
$ns trace-all $f
set nf [open out-m2.nam w]
$ns namtrace-all $nf

$ns color 2 black
$ns color 1 blue
$ns color 0 yellow
$ns color 30 purple
$ns color 31 green

$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail
$ns duplex-link $n1 $n2 1.5Mb 10ms DropTail
$ns duplex-link $n1 $n3 1.5Mb 10ms DropTail
$ns duplex-link $n2 $n4 1.5Mb 10ms DropTail
$ns duplex-link $n3 $n5 1.5Mb 10ms DropTail
$ns duplex-link $n4 $n5 1.5Mb 10ms DropTail

$ns duplex-link-op $n0 $n1 orient left-down
$ns duplex-link-op $n1 $n2 orient left-down
$ns duplex-link-op $n1 $n3 orient right-down
$ns duplex-link-op $n2 $n4 orient right-down
$ns duplex-link-op $n3 $n5 orient left-down
$ns duplex-link-op $n4 $n5 orient right

$ns duplex-link-op $n0 $n1 queuePos 0.5
$ns duplex-link-op $n1 $n2 queuePos 0.5
$ns duplex-link-op $n1 $n3 queuePos 0.5
$ns duplex-link-op $n2 $n4 queuePos 0.5
$ns duplex-link-op $n3 $n5 queuePos 0.5
$ns duplex-link-op $n4 $n5 queuePos 0.5

### pimDM      : PIM dense mode
set mproto pimDM
set mrthandle [$ns mrtproto $mproto  {}]
if {$mrthandle != ""} {
    $mrthandle set_c_rp [list $n0]
}
### End of multicast configuration

set cbr1 [new Agent/CBR]
$ns attach-agent $n0 $cbr1
$cbr1 set dst_ $group

set mcastmonitor [$ns McastMonitor]
$mcastmonitor set period_ 0.01
$mcastmonitor trace-tree $n0 $group

set rcvr0 [new Agent/Null]
$ns attach-agent $n0 $rcvr0
set rcvr1 [new Agent/Null]
$ns attach-agent $n1 $rcvr1
set rcvr2  [new Agent/Null]
$ns attach-agent $n2 $rcvr2
set rcvr3 [new Agent/Null]
$ns attach-agent $n3 $rcvr3
set rcvr4 [new Agent/Null]
$ns attach-agent $n4 $rcvr4
set rcvr5 [new Agent/Null]
$ns attach-agent $n5 $rcvr5

$ns at 0.2 "$cbr1 start"
$ns at 0.4 "$n1 join-group  $rcvr1 $group"
$ns at 0.7 "$n1 leave-group $rcvr1 $group"
$ns at 0.9 "$n4 join-group $rcvr4 $group"
$ns at 1.5 "finish"


proc finish {} {
        global ns
        $ns flush-trace

        puts "running nam..."
        exec nam out-m2 &
        exit 0
}

$ns run







---------- Forwarded message ----------
Date: Thu, 20 May 1999 16:25:26 -0700 (PDT)
From: Lori Flynn <[email protected]>
To: [email protected]
Subject: Multicast Packet Counter

Hi,

I'm trying to use McastMonitor and having trouble. I set it up like this:
set mcastmonitor [$ns McastMonitor]
$mcastmonitor set period_ 0.01
$mcastmonitor trace-tree $n0 $group

but it doesn't print out counts of packets for the fields (data, prune,
join, etc.).  Instead, everything is 0, incorrectly.  (even the nam
simulator shows packets flying, plus the trace-all shows packets as well.)

Abdelhamid wrote to the ns2 newsgroup about the McastMonitor.  I have
tried to use it, using 'trace-tree' mode, and it does indeed print out a
trace for every time period as the simulation runs... however, the counts
of packets are 0 for each and every field (data, prune, etc.).  Even
though true counts are above 0.

Here's part of what I get:
1.2200000000000009 0 0 0 0 _o10 0x8000
1.2300000000000009 0 0 0 0 _o10 0x8000
1.2400000000000009 0 0 0 0 _o10 0x8000

The _o10 is not what I would expect the source to be (I have defined the
source as $n0, which is a UDP CBR sender, if that makes a difference).
I have attached my code (which is *very* short) in case you have any
questions about it.


Thanks for any advice!
Lori