📄 test-suite-simple.tcl
字号:
}Class Topology/net2 -superclass NodeTopology/6nodesTopology/net2 instproc init ns { $self next $ns $self instvar node_ Queue/RED set drop_rand_ true $ns duplex-link $node_(s1) $node_(r1) 10Mb 2ms DropTail $ns duplex-link $node_(s2) $node_(r1) 10Mb 3ms DropTail $ns duplex-link $node_(r1) $node_(r2) 1.5Mb 20ms RED $ns queue-limit $node_(r1) $node_(r2) 25 $ns queue-limit $node_(r2) $node_(r1) 25 $ns duplex-link $node_(s3) $node_(r2) 10Mb 4ms DropTail $ns duplex-link $node_(s4) $node_(r2) 10Mb 5ms DropTail if {[$class info instprocs config] != ""} { $self config $ns }}# Definition of test-suite testsClass Test/tahoe1 -superclass TestSuiteTest/tahoe1 instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net0 set test_ tahoe $self next}Test/tahoe1 instproc run {} { $self instvar ns_ node_ testName_ # Set up TCP connection set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 50 # Set up FTP source set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.0 "$ftp1 start" $self tcpDump $tcp1 1.0 # Trace only the bottleneck link # # Actually, we now trace all activity at the node around the # bottleneck link. This allows us to track acks, as well # packets taking any alternate paths around the bottleneck # link. # $self traceQueues $node_(r1) [$self openTrace 5.0 $testName_] $ns_ run}Class Test/tahoe2 -superclass TestSuiteTest/tahoe2 instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net0 set test_ tahoe2 $self next}Test/tahoe2 instproc run {} { $self instvar ns_ node_ testName_ set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 14 set ftp1 [$tcp1 attach-app FTP] $ns_ at 1.0 "$ftp1 start" $self tcpDump $tcp1 1.0 # Trace only the bottleneck link $self traceQueues $node_(r1) [$self openTrace 5.0 $testName_] $ns_ run}Class Test/tahoe3 -superclass TestSuiteTest/tahoe3 instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net0 set test_ tahoe3 $self next}Test/tahoe3 instproc run {} { $self instvar ns_ node_ testName_ $ns_ queue-limit $node_(r1) $node_(k1) 8 $ns_ queue-limit $node_(k1) $node_(r1) 8 set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 100 set tcp2 [$ns_ create-connection TCP $node_(s2) TCPSink $node_(k1) 1] $tcp2 set window_ 16 set ftp1 [$tcp1 attach-app FTP] set ftp2 [$tcp2 attach-app FTP] $ns_ at 1.0 "$ftp1 start" $ns_ at 0.5 "$ftp2 start" $self tcpDump $tcp1 1.0 # Trace only the bottleneck link $self traceQueues $node_(r1) [$self openTrace 8.0 $testName_] $ns_ run}Class Test/tahoe4 -superclass TestSuiteTest/tahoe4 instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net0 set test_ tahoe4 $self next}Test/tahoe4 instproc run {} { $self instvar ns_ node_ testName_ $ns_ delay $node_(s2) $node_(r1) 200ms $ns_ delay $node_(r1) $node_(s2) 200ms $ns_ queue-limit $node_(r1) $node_(k1) 11 $ns_ queue-limit $node_(k1) $node_(r1) 11 set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 30 set tcp2 [$ns_ create-connection TCP $node_(s2) TCPSink $node_(k1) 1] $tcp2 set window_ 30 set ftp1 [$tcp1 attach-app FTP] set ftp2 [$tcp2 attach-app FTP] $ns_ at 0.0 "$ftp1 start" $ns_ at 0.0 "$ftp2 start" $self tcpDump $tcp1 5.0 # Trace only the bottleneck link $self traceQueues $node_(r1) [$self openTrace 25.0 $testName_] $ns_ run}Class Test/no_bug -superclass TestSuiteTest/no_bug instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net1 set test_ no_bug $self next}Test/no_bug instproc run {} { $self instvar ns_ node_ testName_ $ns_ delay $node_(s1) $node_(r1) 3ms $ns_ delay $node_(r1) $node_(s1) 3ms set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 50 set tcp2 [$ns_ create-connection TCP $node_(s2) TCPSink $node_(k1) 1] $tcp2 set window_ 50 set ftp1 [$tcp1 attach-app FTP] set ftp2 [$tcp2 attach-app FTP] $ns_ at 1.0 "$ftp1 start" $ns_ at 1.75 "$ftp2 produce 100" $self tcpDump $tcp1 1.0 # Trace only the bottleneck link $self traceQueues $node_(r1) [$self openTrace 6.0 $testName_] $ns_ run}Class Test/bug -superclass TestSuiteTest/bug instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net1 set test_ bug $self next}Test/bug instproc run {} { $self instvar ns_ node_ testName_ $ns_ delay $node_(s1) $node_(r1) 3ms $ns_ delay $node_(r1) $node_(s1) 3ms set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 50 $tcp1 set bugFix_ false set tcp2 [$ns_ create-connection TCP $node_(s2) TCPSink $node_(k1) 1] $tcp2 set window_ 50 $tcp2 set bugFix_ false set ftp1 [$tcp1 attach-app FTP] set ftp2 [$tcp2 attach-app FTP] $ns_ at 1.0 "$ftp1 start" $ns_ at 1.75 "$ftp2 produce 100" $self tcpDump $tcp1 1.0 # Trace only the bottleneck link $self traceQueues $node_(r1) [$self openTrace 6.0 $testName_] $ns_ run}Class Test/reno1 -superclass TestSuiteTest/reno1 instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net0 set test_ reno1 $self next}Test/reno1 instproc run {} { $self instvar ns_ node_ testName_ set tcp1 [$ns_ create-connection TCP/Reno $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 14 set ftp1 [$tcp1 attach-app FTP] $ns_ at 1.0 "$ftp1 start" $self tcpDump $tcp1 1.0 # trace only the bottleneck link $self traceQueues $node_(r1) [$self openTrace 5.0 $testName_] $ns_ run}Class Test/reno -superclass TestSuiteTest/reno instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net0 set test_ reno $self next}Test/reno instproc run {} { $self instvar ns_ node_ testName_ set tcp1 [$ns_ create-connection TCP/Reno $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 28 $tcp1 set maxcwnd_ 14 set ftp1 [$tcp1 attach-app FTP] $ns_ at 1.0 "$ftp1 start" $self tcpDump $tcp1 1.0 # trace only the bottleneck link $self traceQueues $node_(r1) [$self openTrace 5.0 $testName_] $ns_ run}Class Test/renoA -superclass TestSuiteTest/renoA instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net0 set test_ renoA $self next}Test/renoA instproc run {} { $self instvar ns_ node_ testName_ $ns_ queue-limit $node_(r1) $node_(k1) 8 set tcp1 [$ns_ create-connection TCP/Reno $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 28 set tcp2 [$ns_ create-connection TCP/Reno $node_(s1) TCPSink $node_(k1) 1] $tcp2 set window_ 4 set tcp3 [$ns_ create-connection TCP/Reno $node_(s1) TCPSink $node_(k1) 2] $tcp3 set window_ 4 set ftp1 [$tcp1 attach-app FTP] $ns_ at 1.0 "$ftp1 start" set ftp2 [$tcp2 attach-app FTP] $ns_ at 1.2 "$ftp2 produce 7" set ftp3 [$tcp3 attach-app FTP] $ns_ at 1.2 "$ftp3 produce 7" $self tcpDump $tcp1 1.0 $self tcpDump $tcp2 1.0 $self tcpDump $tcp3 1.0 # Trace only the bottleneck link $self traceQueues $node_(r1) [$self openTrace 5.0 $testName_] $ns_ run}Class Test/reno2 -superclass TestSuiteTest/reno2 instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net0 set test_ reno2 $self next}Test/reno2 instproc run {} { $self instvar ns_ node_ testName_ $ns_ queue-limit $node_(r1) $node_(k1) 9 set tcp1 [$ns_ create-connection TCP/Reno $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 50 set tcp2 [$ns_ create-connection TCP/Reno $node_(s2) TCPSink $node_(k1) 1] $tcp2 set window_ 20 set ftp1 [$tcp1 attach-app FTP] set ftp2 [$tcp2 attach-app FTP] $ns_ at 1.0 "$ftp1 start" $ns_ at 1.0 "$ftp2 start" $self tcpDump $tcp1 1.0 # Trace only the bottleneck link $self traceQueues $node_(r1) [$self openTrace 10.0 $testName_] $ns_ run}Class Test/reno3 -superclass TestSuiteTest/reno3 instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net0 set test_ reno3 $self next}Test/reno3 instproc run {} { $self instvar ns_ node_ testName_ $ns_ queue-limit $node_(r1) $node_(k1) 8 $ns_ queue-limit $node_(k1) $node_(r1) 8 set tcp1 [$ns_ create-connection TCP/Reno $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 100 set tcp2 [$ns_ create-connection TCP/Reno $node_(s2) TCPSink $node_(k1) 1] $tcp2 set window_ 16 set ftp1 [$tcp1 attach-app FTP] set ftp2 [$tcp2 attach-app FTP] $ns_ at 1.0 "$ftp1 start" $ns_ at 0.5 "$ftp2 start" $self tcpDump $tcp1 1.0 # Trace only the bottleneck link $self traceQueues $node_(r1) [$self openTrace 8.0 $testName_] $ns_ run}Class Test/reno4 -superclass TestSuiteTest/reno4 instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net2 set test_ reno4 $self next}Test/reno4 instproc run {} { $self instvar ns_ node_ testName_ $ns_ queue-limit $node_(r1) $node_(r2) 29 set tcp1 [$ns_ create-connection TCP/Reno $node_(s1) TCPSink/DelAck $node_(r2) 0] $tcp1 set window_ 80 $tcp1 set maxcwnd_ 40 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.0 "$ftp1 start" $self tcpDump $tcp1 1.0 # Trace only the bottleneck link $self traceQueues $node_(s1) [$self openTrace 2.0 $testName_] $ns_ run}Class Test/reno4a -superclass TestSuiteTest/reno4a instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net2 set test_ reno4a $self next}Test/reno4a instproc run {} { $self instvar ns_ node_ testName_ $ns_ queue-limit $node_(r1) $node_(r2) 29 set tcp1 [$ns_ create-connection TCP/Reno $node_(s1) TCPSink/DelAck $node_(r2) 0] $tcp1 set window_ 40 $tcp1 set maxcwnd_ 40 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.0 "$ftp1 start" $self tcpDump $tcp1 1.0 # Trace only the bottleneck link $self traceQueues $node_(s1) [$self openTrace 2.0 $testName_] $ns_ run}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -