/usr/share/doc/nam/examples/tcl/test/tcl-scripts/test-lan-1.tcl is in nam-examples 1.15-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | set opt(tr) out
set opt(namtr) "test-lan-1.nam"
set opt(seed) 0
set opt(stop) 3
set opt(node) 8
set opt(qsize) 10
set opt(bw) 1Mb
set opt(delay) 100ms
set opt(ll) LL
set opt(ifq) Queue/DropTail
set opt(mac) Mac/802_3
set opt(chan) Channel
set opt(tcp) TCP/Reno
set opt(sink) TCPSink
set opt(app) FTP
proc finish {} {
global env nshome pwd
global ns opt
$ns flush-trace
exit 0
}
proc create-trace {} {
global ns opt
if [file exists $opt(tr)] {
catch "exec rm -f $opt(tr) $opt(tr)-bw [glob $opt(tr).*]"
}
set trfd [open $opt(tr) w]
$ns trace-all $trfd
if {$opt(namtr) != ""} {
$ns namtrace-all [open $opt(namtr) w]
}
return $trfd
}
proc create-topology {} {
global ns opt
global lan node source node0
set num $opt(node)
for {set i 0} {$i < $num} {incr i} {
set node($i) [$ns node]
lappend nodelist $node($i)
}
set lan [$ns newLan $nodelist $opt(bw) $opt(delay) \
-llType $opt(ll) -ifqType $opt(ifq) \
-macType $opt(mac) -chanType $opt(chan)]
set node0 [$ns node]
$ns duplex-link $node0 $node(0) 1Mb 100ms DropTail
$ns duplex-link-op $node0 $node(0) orient right
}
## MAIN ##
set ns [new Simulator]
set trfd [create-trace]
create-topology
set tcp0 [$ns create-connection TCP/Reno $node0 TCPSink $node(7) 0]
$tcp0 set window_ 15
set ftp0 [$tcp0 attach-app FTP]
### set operations
$ns at 0.0 "$ftp0 start"
$ns at $opt(stop) "finish"
### take snapshots
foreach i "0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 \
1.2 1.5 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8" {
$ns at $i "$ns snapshot"
}
### take snapshot operations
$ns at 2.9 "$ns terminate-nam"
$ns run
|