File: test-1000.tcl

package info (click to toggle)
ns2 2.35%2Bdfsg-3.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 78,808 kB
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 816; awk: 525; csh: 355
file content (68 lines) | stat: -rw-r--r-- 1,284 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#test-1000.tcl
# Test for comparing flat rtg with hier routing using topology generated by 
# GaTech topology generator (1000 node transit-stub graph converted to 
# flat topology


set ns [new Simulator]
source ./ts1000.tcl
set linkBW 5Mb
global n ns

# $ns namtrace-all [open out-1000.nam w]
# $ns trace-all [open out-1000.tr w]

create-topology $linkBW

set udp0 [new Agent/UDP]
$ns attach-agent $n(0) $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0

set udp1 [new Agent/UDP]
$ns attach-agent $n(500) $udp1
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$udp1 set class_ 1

set null0 [new Agent/Null]
$ns attach-agent $n(10) $null0

set null1 [new Agent/Null]
$ns attach-agent $n(600) $null1

$ns connect $udp0 $null0
$ns connect $udp1 $null1

$ns at 1.0 "$cbr0 start"
$ns at 1.1 "$cbr1 start"

set tcp [new Agent/TCP]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n(0) $tcp
$ns attach-agent $n(5) $sink
$ns connect $tcp $sink
set ftp [new Source/FTP]
$ftp set agent_ $tcp
$ns at 1.2 "$ftp start"
$ns at 3.0 "finish"

puts [$cbr0 set packetSize_]
puts [$cbr0 set interval_]

$ns at 3.0 "finish"

proc finish {} {
    global ns 
    $ns flush-trace
    puts "running nam..."
    exec nam out.nam &
    exit 0
}

$ns run