📄 test-suite-tcp.tcl
字号:
Class Test/timersA2 -superclass TestSuiteTest/timersA2 instproc init topo { $self instvar net_ defNet_ test_ guide_ set net_ $topo set defNet_ net4 set test_ timersA2_(timestamps,_fine-grained_clock) set guide_ "Agent/TCP, tcpTick_ set to 0.001" Agent/TCP set timestamps_ true Agent/TCP set tcpTick_ 0.001 Agent/TCP set timerfix_ false # The default is being changed to true. Test/timersA2 instproc run {} [Test/timersA info instbody run ] $self next}# Update the smoothed round-trip with weight 1/16 instead of 1/8.#Class Test/timersA3 -superclass TestSuiteTest/timersA3 instproc init topo { $self instvar net_ defNet_ test_ guide_ set net_ $topo set defNet_ net4 set test_ timersA3_(weight_1/32_instead_of_1/8) set guide_ "Agent/TCP, T_SRTT_BITS set to 5 instead of 3" Agent/TCP set timestamps_ true Agent/TCP set tcpTick_ 0.001 Agent/TCP set T_SRTT_BITS 5 Agent/TCP set T_RTTVAR_BITS 4 Agent/TCP set timerfix_ false # The default is being changed to true. Test/timersA3 instproc run {} [Test/timersA info instbody run ] $self next}Class Test/timers1 -superclass TestSuiteTest/timers1 instproc init topo { $self instvar net_ defNet_ test_ guide_ set net_ $topo set defNet_ net2 set test_ timers1_(tcpTick_=default,0.1) set guide_ "tcpTick_ set to default of 0.1" $self next}Test/timers1 instproc run {} { global quiet $self instvar ns_ node_ testName_ guide_ if {$quiet == "false"} {puts $guide_} if {$quiet == "false"} {puts "tcpTICK: [Agent/TCP set tcpTick_]"} $ns_ queue-limit $node_(r1) $node_(r2) 29 set tcp1 [$ns_ create-connection TCP/Reno $node_(s1) TCPSink/DelAck $node_(r2) 0]# set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink/DelAck $node_(r2) 1] $tcp1 set window_ 40 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.0 "$ftp1 produce 180" $ns_ at 1.0 "$self printtimersAll $tcp1 1.0 1.0" $self traceQueues $node_(r1) [$self openTrace 4.0 $testName_] $ns_ run}Class Test/timers2 -superclass TestSuiteTest/timers2 instproc init topo { $self instvar net_ defNet_ test_ guide_ set net_ $topo set defNet_ net2 set test_ timers2_(tcpTick_=0.5) set guide_ "tcpTick_ set to 0.5" $self next}Test/timers2 instproc run {} { global quiet $self instvar ns_ node_ testName_ guide_ if {$quiet == "false"} {puts $guide_} set tick 0.5 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_ 40 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.0 "$ftp1 produce 180" $ns_ at 1.0 "$self printtimersAll $tcp1 1.0 1.0" $self traceQueues $node_(r1) [$self openTrace 4.0 $testName_] $ns_ run}Class Test/timers3 -superclass TestSuiteTest/timers3 instproc init topo { $self instvar net_ defNet_ test_ guide_ set net_ $topo set defNet_ net2 set test_ timers3_(tcpTick_=0.001) set guide_ "tcpTick_ set to 0.001" $self next}Test/timers3 instproc run {} { global quiet $self instvar ns_ node_ testName_ guide_ if {$quiet == "false"} {puts $guide_} 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_ 40 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.0 "$ftp1 produce 180" $ns_ at 1.0 "$self printtimersAll $tcp1 1.0 1.0" $self traceQueues $node_(r1) [$self openTrace 4.0 $testName_] $ns_ run}Class Test/timers4 -superclass TestSuiteTest/timers4 instproc init topo { $self instvar net_ defNet_ test_ guide_ set net_ $topo set defNet_ net2 set test_ timers4_(tcpTick_=0.001) set guide_ \ "With timers5, shows that estimated RTT updated only once per RTT." $self next}Test/timers4 instproc run {} { global quiet $self instvar ns_ node_ testName_ guide_ if {$quiet == "false"} {puts $guide_} 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_ guide_ set net_ $topo set defNet_ net2 set test_ timers5_(tcpTick_=0.001) set guide_ \ "With timers4, shows that estimated RTT updated only once per RTT." $self next}Test/timers5 instproc run {} { global quiet $self instvar ns_ node_ testName_ guide_ if {$quiet == "false"} {puts $guide_} 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}TestSuite 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_]" }Class Test/stats1 -superclass TestSuiteTest/stats1 instproc init topo { $self instvar net_ defNet_ test_ guide_ set net_ $topo set defNet_ net0 set test_ stats1 set guide_ "TCP statistics on the number of retransmit timeouts." $self next} Test/stats1 instproc run {} { global quiet $self instvar ns_ node_ testName_ guide_ if {$quiet == "false"} {puts $guide_} $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_ guide_ 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_ guide_ 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_ guide_ set net_ $topo set defNet_ net6 set test_ quiescent_100ms set guide_ "Tahoe TCP after a quiescent period." Agent/TCP set QOption_ 0 $self next} Test/quiescent_100ms instproc run {} { global quiet $self instvar ns_ node_ guide_ if {$quiet == "false"} {puts $guide_} 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_ guide_ set net_ $topo set defNet_ net6 set test_ quiescentB set guide_ \ "Tahoe TCP entering a quiescent period with a smaller cwnd." Agent/TCP set QOption_ 0 $self next} Test/quiescentB instproc run {} { global quiet $self instvar ns_ node_ guide_ if {$quiet == "false"} {puts $guide_} $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}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -