[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GT-ITM questions
Shuqian,
You need to source the topology file. Then call the create-topology
function.Once the topology is created you can now setup your PIM or
other agents.
Take a look at the tcl/ex/hier-rtg-100.tcl where it uses the hierarchical
topology and calls create-hier-topology {} instead but you'll get the
idea.
Hope this helps,
--padma.
On Tue, 25 Aug 1998, Shuqian Yan wrote:
> Hi, Padma
>
> I sent out a similar mail to the user group just now, if you happen to reply
> that already, then pls ignore this one, else pls help me. Here is my problem,
>
> I use gt-itm to generated a 10 node flat random topology, and then converted to
> ns2 format. I want to use the topology generated in my simalation script,
> however it doesn't work out that easily. The topology file generated in ns2
> format is r10-0.2-0.tcl. In my simulation script, I call the proc
> create-topology at simation 0.0 and I start the mcast simulation at 1.0, I
> suppose the calling function need some time to generated the graph. For clarity,
> I attached my script as the following,
>
> set ns [new Simulator]
> Simulator set EnableMcast_ 1
>
> for {set i 0} {$i < 10} {incr i} {
> set n($i) [$ns node]
> }
>
> set rng [new RNG]
> $rng seed 0
>
> set fg [open ~/gt-itm/sample-graphs/rand/test1/r10-0.2-0.tcl r]
> $ns at 0.0 "create-topology {ns n 1.5Mb}"
>
> set f [open out-pim2.tr w]
> $ns trace-all $f
>
> Simulator set NumberInterfaces_ 1
>
> set pim0 [new PIM $ns $n(0) [list [$rng integer 2] 1 0]]
> set pim1 [new PIM $ns $n(1) [list [$rng integer 2] 1 0]]
> set pim2 [new PIM $ns $n(2) [list [$rng integer 2]]]
> set pim3 [new PIM $ns $n(3) [list [$rng integer 2] 1 0]]
> set pim4 [new PIM $ns $n(4) [list [$rng integer 2]]]
> set pim5 [new PIM $ns $n(5) [list [$rng integer 2]]]
> set pim6 [new PIM $ns $n(6) [list [$rng integer 2]]]
> set pim7 [new PIM $ns $n(7) [list [$rng integer 2]]]
> set pim8 [new PIM $ns $n(8) [list [$rng integer 2]]]
> set pim9 [new PIM $ns $n(9) [list [$rng integer 2]]]
>
>
> PIM config $ns
>
> $ns at 1.0 "$ns run-mcast"
>
> set rcvr0 [new Agent/LossMonitor]
> $ns attach-agent $n(0) $rcvr0
> set rcvr1 [new Agent/LossMonitor]
> $ns attach-agent $n(1) $rcvr1
> set rcvr2 [new Agent/LossMonitor]
> $ns attach-agent $n(2) $rcvr2
> set rcvr3 [new Agent/LossMonitor]
> $ns attach-agent $n(3) $rcvr3
> set rcvr4 [new Agent/LossMonitor]
> $ns attach-agent $n(4) $rcvr4
> set rcvr5 [new Agent/LossMonitor]
> $ns attach-agent $n(5) $rcvr5
> set rcvr6 [new Agent/LossMonitor]
> $ns attach-agent $n(6) $rcvr6
> set rcvr7 [new Agent/LossMonitor]
> $ns attach-agent $n(7) $rcvr7
> set rcvr8 [new Agent/LossMonitor]
> $ns attach-agent $n(8) $rcvr8
> set rcvr9 [new Agent/LossMonitor]
> $ns attach-agent $n(9) $rcvr9
>
> set sender0 [new Agent/Message]
> #set sender0 [new Agent/CBR]
> $sender0 set dst_ 0x8003
> $sender0 set class_ 2
> $ns attach-agent $n(0) $sender0
>
> $ns at 1.95 "$n(0) join-group $rcvr0 0x8003"
> #$ns at 1.96 "$n1 join-group $rcvr1 0x8003"
> $ns at 2.05 "$n(1) join-group $rcvr1 0x8003"
> $ns at 1.97 "$n(2) join-group $rcvr2 0x8003"
> $ns at 2.0 "$n(3) join-group $rcvr3 0x8003"
> $ns at 2.05 "$n(9) join-group $rcvr9 0x8003"
>
> #$ns at 3.0 "$sender0 start"
>
> for {set i 1.0} {$i<30} {set i [expr $i+0.1]} {
> $ns at $i "$sender0 send \"pkt$i\""
> }
>
> $ns at 60.0 "finish"
>
> proc finish {} {
> global ns
> $ns flush-trace
> exec awk -f ../../nam-demo/nstonam.awk out-pim2.tr > pim2-nam.tr
> # exec rm -f out
> #XXX
> puts "running nam..."
> # exec nam pim2-nam &
> close $fg
> exit 0
> }
>
> $ns run
>
> I have the following the error message when the script is executed,
>
> ../../../ns pim2-0.2.tcl
> node out of range
> (_o102 cmd line 1)
> invoked from within
> "$self cmd lookup $nodeid $destid"
> (procedure "_o102" line 18)
> (RouteLogic lookup line 18)
> invoked from within
> "$r lookup $i $j"
> (procedure "_o3" line 28)
> (Simulator compute-flat-routes line 28)
> invoked from within
> "$self compute-flat-routes"
> (procedure "_o3" line 6)
> (Simulator compute-routes line 6)
> invoked from within
> "[Simulator instance] compute-routes"
> (procedure "Agent/rtProto/Static" line 6)
> (Agent/rtProto/Static init-all line 6)
> invoked from within
> "Agent/rtProto/Static init-all"
> (procedure "_o102" line 8)
> (RouteLogic configure line 8)
> invoked from within
> "[$self get-routelogic] configure"
> (procedure "_o3" line 5)
> (Simulator run line 5)
> invoked from within
> "$ns run"
> (file "pim2-0.2.tcl" line 289)
>
> Any ideas why???
>
>
> Tks,
>
> shuqian YAN
>
>
>
------------------------------------------------
Be true to your work, your word, and your friend.
--Thoreau
Padmaparna Haldar
ISI/USC.
310.822.1511 #352