📄 test-suite-tcp.tcl
字号:
set defNet_ net2 set test_ timers4_(tcpTick_=0.001) $self next}Test/timers4 instproc run {} { global quiet $self instvar ns_ node_ testName_ set tick 0.001 if {$quiet == "false"} {puts "tcpTICK: $tick"} Agent/TCP set tcpTick_ $tick $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_ 10 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.0 "$ftp1 start" $ns_ at 0.1 "$self printtimersAll $tcp1 0.1 0.1" $self traceQueues $node_(r1) [$self openTrace 2.0 $testName_] $ns_ run}Class Test/timers5 -superclass TestSuiteTest/timers5 instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net2 set test_ timers5_(tcpTick_=0.001) $self next}Test/timers5 instproc run {} { global quiet $self instvar ns_ node_ testName_ set tick 0.001 if {$quiet == "false"} {puts "tcpTICK: $tick"} Agent/TCP set tcpTick_ $tick $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_ 2 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.0 "$ftp1 start" $ns_ at 0.1 "$self printtimersAll $tcp1 0.1 0.1" $self traceQueues $node_(r1) [$self openTrace 2.0 $testName_] $ns_ run}Class Test/stats1 -superclass TestSuiteTest/stats1 instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net0 set test_ stats1 $self next} Test/stats1 instproc printtcp { label tcp time } { puts "" puts "tcp: $label time: $time" puts "total_data_packets_sent: [$tcp set ndatapack_] data_bytes_sent: [$tcp set ndatabytes_]" puts "packets_resent: [$tcp set nrexmitpack_] bytes_resent: [$tcp set nrexmitbytes_]" puts "ack_packets_received: [$tcp set nackpack_]" puts "retransmit_timeouts: [$tcp set nrexmit_]" }Test/stats1 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) 10 $ns_ queue-limit $node_(k1) $node_(r1) 10 set stoptime 10.1 set tcp1 [$ns_ create-connection TCP/Reno $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_ 3 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 tcpDumpAll $tcp1 10.0 tcp1 $self tcpDumpAll $tcp2 10.0 tcp2 $ns_ at 10.0 "$self printtcp 1 $tcp1 10.0" $ns_ at 10.0 "$self printtcp 2 $tcp2 10.0" $ns_ at 10.0 "puts \"\"" # trace only the bottleneck link $self traceQueues $node_(r1) [$self openTrace $stoptime $testName_] $ns_ run}TestSuite instproc set_lossylink {} { $self instvar lossylink_ ns_ node_ set lossylink_ [$ns_ link $node_(r1) $node_(k1)] set em [new ErrorModule Fid] set errmodel [new ErrorModel/Periodic] $errmodel unit pkt $lossylink_ errormodule $em}TestSuite instproc emod {} { $self instvar lossylink_ set errmodule [$lossylink_ errormodule] return $errmodule}TestSuite instproc drop_pkts pkts { $self instvar ns_ set emod [$self emod] set errmodel1 [new ErrorModel/List] $errmodel1 droplist $pkts $emod insert $errmodel1 $emod bind $errmodel1 1} TestSuite instproc run1 { tcp0 {stoptime 30.1}} { $self instvar ns_ node_ testName_ set count 100 set count1 3 set ftp0 [$tcp0 attach-app FTP] $ns_ at 0.0 "$ftp0 produce $count" $ns_ at 2.4 "$ftp0 producemore $count" $ns_ at 2.5 "$ftp0 producemore $count" $self traceQueues $node_(r1) [$self openTrace $stoptime $testName_] $ns_ run}Class Test/quiescent_100ms -superclass TestSuiteTest/quiescent_100ms instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ quiescent_100ms Agent/TCP set QOption_ 0 $self next} Test/quiescent_100ms instproc run {} { $self instvar ns_ node_ Agent/TCP set packetSize_ 100 Agent/TCP set window_ 25 set tcp0 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(k1) 0] $self run1 $tcp0}Class Test/quiescentB -superclass TestSuiteTest/quiescentB instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ quiescentB Agent/TCP set QOption_ 0 $self next} Test/quiescentB instproc run {} { $self instvar ns_ node_ $self set_lossylink Agent/TCP set packetSize_ 100 Agent/TCP set window_ 25 set tcp0 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(k1) 1] $self drop_pkts {2} $self run1 $tcp0 3.0}Class Test/quiescentB_qoption -superclass TestSuiteTest/quiescentB_qoption instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ quiescentB_qoption Agent/TCP set QOption_ 1 $self next} Test/quiescentB_qoption instproc run {} { $self instvar ns_ node_ $self set_lossylink Agent/TCP set packetSize_ 100 Agent/TCP set window_ 25 set tcp0 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(k1) 1] $self drop_pkts {2} $self run1 $tcp0 3.0}TestSuite instproc run2 { tcp0 {stoptime 3.0}} { $self instvar ns_ node_ testName_ set count 25 set count1 10 set count2 3 set count3 100 set data0 [$tcp0 attach-app Telnet] $data0 set interval_ 0.0005 $ns_ at 0 "$data0 start" $ns_ at 0.045 "$data0 set interval_ 0.01" $ns_ at 2.2 "$data0 set interval_ 0.0005" $ns_ at 2.5 "$data0 stop" $self traceQueues $node_(r1) [$self openTrace $stoptime $testName_] $ns_ run}Class Test/underutilized_100ms -superclass TestSuiteTest/underutilized_100ms instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ underutilized_100ms Agent/TCP set QOption_ 0 $self next} Test/underutilized_100ms instproc run {{sender TCP} {receiver TCPSink}} { $self instvar ns_ node_ Agent/TCP set packetSize_ 100 Agent/TCP set window_ 100 set tcp0 [$ns_ create-connection $sender $node_(s1) $receiver $node_(k1) 0] $self run2 $tcp0}Class Test/underutilized_100ms_control -superclass TestSuiteTest/underutilized_100ms_control instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ underutilized_100ms_control Agent/TCP set QOption_ 0 Agent/TCP set control_increase_ 1 Test/underutilized_100ms_control instproc run {{sender TCP} {receiver TCPSink}} [Test/underutilized_100ms info instbody run ] $self next}Class Test/underutilized_100ms_control_Q -superclass TestSuiteTest/underutilized_100ms_control_Q instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ underutilized_100ms_control_Q Agent/TCP set QOption_ 1 Agent/TCP set control_increase_ 1 Test/underutilized_100ms_control_Q instproc run {{sender TCP} {receiver TCPSink}} [Test/underutilized_100ms info instbody run ] $self next}Class Test/underutilized_100ms_Q -superclass TestSuiteTest/underutilized_100ms_Q instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ underutilized_100ms_Q Agent/TCP set QOption_ 1 Agent/TCP set control_increase_ 0 Test/underutilized_100ms_Q instproc run {{sender TCP} {receiver TCPSink}} [Test/underutilized_100ms info instbody run ] $self next}Class Test/underutilized_100ms_control_Reno -superclass TestSuiteTest/underutilized_100ms_control_Reno instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ underutilized_100ms_control_Reno Agent/TCP set QOption_ 0 Agent/TCP set control_increase_ 1 Test/underutilized_100ms_control_Reno instproc run {{sender TCP/Reno} {receiver TCPSink}} [Test/underutilized_100ms info instbody run ] $self next}Class Test/underutilized_100ms_control_Newreno -superclass TestSuiteTest/underutilized_100ms_control_Newreno instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ underutilized_100ms_control_Newreno Agent/TCP set QOption_ 0 Agent/TCP set control_increase_ 1 Test/underutilized_100ms_control_Newreno instproc run {{sender TCP/Reno} {receiver TCPSink}} [Test/underutilized_100ms info instbody run ] $self next}Class Test/underutilized_100ms_control_Sack -superclass TestSuiteTest/underutilized_100ms_control_Sack instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ underutilized_100ms_control_Sack Agent/TCP set QOption_ 0 Agent/TCP set control_increase_ 1 Test/underutilized_100ms_control_Sack instproc run {{sender TCP/Sack1} {receiver TCPSink/Sack1}} [Test/underutilized_100ms info instbody run ] $self next}Class Test/quiescent_100ms_fine -superclass TestSuiteTest/quiescent_100ms_fine instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ quiescent_100ms_fine(EnblRTTCtr__0) Agent/TCP set QOption_ 1 Agent/TCP set control_increase_ 1 Agent/TCP set EnblRTTCtr_ 0 Test/quiescent_100ms_fine instproc run {} [Test/quiescent_100ms info instbody run ] $self next} Class Test/quiescent_100ms_coarse -superclass TestSuiteTest/quiescent_100ms_coarse instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ quiescent_100ms_coarse(EnblRTTCtr__1) Agent/TCP set QOption_ 1 Agent/TCP set control_increase_ 1 Agent/TCP set EnblRTTCtr_ 1 Test/quiescent_100ms_coarse instproc run {} [Test/quiescent_100ms info instbody run ] $self next} Class Test/quiescent_1ms_fine -superclass TestSuiteTest/quiescent_1ms_fine instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ quiescent_1ms_fine(EnblRTTCtr__0) Agent/TCP set QOption_ 1 Agent/TCP set tcpTick_ 0.001 Agent/TCP set control_increase_ 1 Agent/TCP set EnblRTTCtr_ 0 Test/quiescent_1ms_fine instproc run {} [Test/quiescent_100ms info instbody run ] $self next} Class Test/quiescent_1ms_coarse -superclass TestSuiteTest/quiescent_1ms_coarse instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ quiescent_1ms_coarse(EnblRTTCtr__1) Agent/TCP set QOption_ 1 Agent/TCP set tcpTick_ 0.001 Agent/TCP set control_increase_ 1 Agent/TCP set EnblRTTCtr_ 1 Test/quiescent_1ms_coarse instproc run {} [Test/quiescent_100ms info instbody run ] $self next} Class Test/quiescent_500ms_fine -superclass TestSuiteTest/quiescent_500ms_fine instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ quiescent_500ms_fine(EnblRTTCtr__0) Agent/TCP set QOption_ 1 Agent/TCP set tcpTick_ 0.500 Agent/TCP set control_increase_ 1 Agent/TCP set EnblRTTCtr_ 0 Test/quiescent_500ms_fine instproc run {} [Test/quiescent_100ms info instbody run ] $self next} Class Test/quiescent_500ms_coarse -superclass TestSuiteTest/quiescent_500ms_coarse instproc init topo { $self instvar net_ defNet_ test_ set net_ $topo set defNet_ net6 set test_ quiescent_500ms_coarse(EnblRTTCtr__1) Agent/TCP set QOption_ 1 Agent/TCP set tcpTick_ 0.500 Agent/TCP set control_increase_ 1 Agent/TCP set EnblRTTCtr_ 1 Test/quiescent_500ms_coarse instproc run {} [Test/quiescent_100ms info instbody run ] $self next} TestSuite runTest### Local Variables:### mode: tcl### tcl-indent-level: 8### tcl-default-application: ns### End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -