📄 test-suite-routed.tcl
字号:
## Copyright (c) 1995 The Regents of the University of California.# All rights reserved.## Redistribution and use in source and binary forms, with or without# modification, are permitted provided that the following conditions# are met:# 1. Redistributions of source code must retain the above copyright# notice, this list of conditions and the following disclaimer.# 2. Redistributions in binary form must reproduce the above copyright# notice, this list of conditions and the following disclaimer in the# documentation and/or other materials provided with the distribution.# 3. All advertising materials mentioning features or use of this software# must display the following acknowledgement:# This product includes software developed by the Computer Systems# Engineering Group at Lawrence Berkeley Laboratory.# 4. Neither the name of the University nor of the Laboratory may be used# to endorse or promote products derived from this software without# specific prior written permission.## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF# SUCH DAMAGE.## @(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/tcl/test/test-suite-routed.tcl,v 1.5 1998/08/14 20:14:23 tomh Exp $### This test suite reproduces most of the tests from the following note:# Floyd, S., Simulator Tests. July 1995. # URL ftp://ftp.ee.lbl.gov/papers/simtests.ps.Z.## To run individual tests:# ns test-suite.tcl tahoe1# ns test-suite.tcl tahoe2# ...#set dir [pwd]catch "cd tcl/test"source misc.tclsource topologies.tclcatch "cd $dir"Class 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/tahoe5 -superclass TestSuiteTest/tahoe5 instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net1 set test_ tahoe5 $self next}Test/tahoe5 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/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"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -