test-suite-simple-full.tcl

来自「一款用来进行网络模拟的软件」· TCL 代码 · 共 1,326 行 · 第 1/3 页

TCL
1,326
字号
    set node_(s4) [$ns node]}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-listen TCP/FullTcp/Tahoe $node_(s1) TCP/FullTcp/Tahoe $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}# NOT ADDED:# tahoe1Bytes - "DropTail queue in bytes instead of packets."# tahoe1RED -  "RED queue, configured for 5 packets instead of DropTail's #  6 packets."# tahoe1REDbytes: "RED queue in bytes."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-listen TCP/FullTcp/Tahoe $node_(s1) TCP/FullTcp/Tahoe $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-listen TCP/FullTcp/Tahoe $node_(s1) TCP/FullTcp/Tahoe $node_(k1) 0]	$tcp1 set window_ 100	set tcp2 [$ns_ create-connection-listen TCP/FullTcp/Tahoe $node_(s2) TCP/FullTcp/Tahoe $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}#NOT ADDED:#tahoe3RED: "Tahoe TCP, two packets dropped, RED queue configured for #  5 packets."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-listen TCP/FullTcp/Tahoe $node_(s1) TCP/FullTcp/Tahoe $node_(k1) 0]	$tcp1 set window_ 30	set tcp2 [$ns_ create-connection-listen TCP/FullTcp/Tahoe $node_(s2) TCP/FullTcp/Tahoe $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_ guide_        set net_        $topo        set defNet_     net1        set test_       no_bug        # set guide_      "Tahoe TCP with TCP/bugFix_ set to true."        $self next}Test/no_bug instproc run {} {        global quiet        $self instvar ns_ node_ testName_ guide_        # puts "Guide: $guide_"        $ns_ delay $node_(s1) $node_(r1) 3ms        $ns_ delay $node_(r1) $node_(s1) 3ms 	set tcp1 [$ns_ create-connection-listen TCP/FullTcp/Tahoe $node_(s1) TCP/FullTcp/Tahoe $node_(k1) 0]        $tcp1 set window_ 50	set tcp2 [$ns_ create-connection-listen TCP/FullTcp/Tahoe $node_(s2) TCP/FullTcp/Tahoe $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 99"        $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_ guide_        set net_        $topo        set defNet_     net1        set test_       bug        # set guide_      "Tahoe TCP with TCP/bugFix_ set to false."        $self next}Test/bug instproc run {} {        global quiet        $self instvar ns_ node_ testName_ guide_        # puts "Guide: $guide_"        $ns_ delay $node_(s1) $node_(r1) 3ms        $ns_ delay $node_(r1) $node_(s1) 3ms	set tcp1 [$ns_ create-connection-listen TCP/FullTcp/Tahoe $node_(s1) TCP/FullTcp/Tahoe $node_(k1) 0]        $tcp1 set window_ 50        $tcp1 set bugFix_ false	set tcp2 [$ns_ create-connection-listen TCP/FullTcp/Tahoe $node_(s2) TCP/FullTcp/Tahoe $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-listen TCP/FullTcp $node_(s1) TCP/FullTcp $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-listen TCP/FullTcp $node_(s1) TCP/FullTcp $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-listen TCP/FullTcp $node_(s1) TCP/FullTcp $node_(k1) 0]	$tcp1 set window_ 28	set tcp2 [$ns_ create-connection-listen TCP/FullTcp $node_(s1) TCP/FullTcp $node_(k1) 1]	$tcp2 set window_ 4	set tcp3 [$ns_ create-connection-listen TCP/FullTcp $node_(s1) TCP/FullTcp $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-listen TCP/FullTcp $node_(s1) TCP/FullTcp $node_(k1) 0]	$tcp1 set window_ 50	set tcp2 [$ns_ create-connection-listen TCP/FullTcp $node_(s2) TCP/FullTcp $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-listen TCP/FullTcp $node_(s1) TCP/FullTcp $node_(k1) 0]	$tcp1 set window_ 100	set tcp2 [$ns_ create-connection-listen TCP/FullTcp $node_(s2) TCP/FullTcp $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        Agent/TCP/FullTcp set segsperack_ 2	# Agent/TCP/FullTcp set interval_ 0.1 	$self next}Test/reno4 instproc run {} {	$self instvar ns_ node_ testName_	$ns_ queue-limit $node_(r1) $node_(r2) 29	set tcp1 [$ns_ create-connection-listen TCP/FullTcp $node_(s1) TCP/FullTcp $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 1.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        Agent/TCP/FullTcp set segsperack_ 2	$self next}Test/reno4a instproc run {} {	$self instvar ns_ node_ testName_	$ns_ queue-limit $node_(r1) $node_(r2) 29	set tcp1 [$ns_ create-connection-listen TCP/FullTcp $node_(s1) TCP/FullTcp $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 4.0 $testName_]	$ns_ run}Class Test/reno5 -superclass TestSuiteTest/reno5 instproc init topo {	$self instvar net_ defNet_ test_	set net_	$topo	set defNet_	net0	set test_	reno5	$self next

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?