📄 test-suite-friendly.tcl
字号:
$ns_ at $stopTime "$self cleanupAll $testName_" if {$quiet == "false"} { $ns_ at $stopTime2 "close $tracefile" } $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0" # trace only the bottleneck link $ns_ run}TestSuite instproc printpkts { label tcp } { puts "tcp $label highest_seqment_acked [$tcp set ack_]"}TestSuite instproc printTFRCpkts { label src } { puts "tfrc $label [$src set ndatapack_] " }Class Test/goodTFRC superclass TestSuiteTest/goodTFRC instproc init {} { $self instvar net_ test_ guide_ period_ set net_ net2 set test_ goodTFRC set guide_ \ "One TFRC flow, no reordering and no extra drops." set period_ 10000.0 $self next pktTraceFile}Test/goodTFRC instproc run {} { global quiet $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ period_ if {$quiet == "false"} {puts $guide_} $self setTopo set interval_ 0.1 set stopTime 20.0 set stopTime0 [expr $stopTime - 0.001] set stopTime2 [expr $stopTime + 0.001] set dumpfile_ [open temp.s w] if {$quiet == "false"} { set tracefile [open all.tr w] $ns_ trace-all $tracefile } set tf1 [$ns_ create-connection TFRC $node_(s1) TFRCSink $node_(s3) 0] $ns_ at 0.0 "$tf1 start" $self dropPktsPeriodic [$ns_ link $node_(r2) $node_(s3)] 0 1000.0 $period_ $self tfccDump 1 $tf1 $interval_ $dumpfile_ $ns_ at $stopTime0 "close $dumpfile_; $self finish_1 $testName_" #$self traceQueues $node_(r1) [$self openTrace $stopTime $testName_] $ns_ at $stopTime "$self cleanupAll $testName_" if {$quiet == "false"} { $ns_ at $stopTime2 "close $tracefile" } $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0" # $ns_ at $stopTime0 "$self printTFRCpkts 0 $tf1" # trace only the bottleneck link $ns_ run}Class Test/droppedTFRC superclass TestSuiteTest/droppedTFRC instproc init {} { $self instvar net_ test_ guide_ list_ period_ set net_ net2 set test_ droppedTFRC set guide_ \ "One TFRC flow, with extra dropped packets." set period_ 40.0 Test/droppedTFRC instproc run {} [Test/goodTFRC info instbody run ] $self next pktTraceFile}Class Test/delayedTFRC superclass TestSuiteTest/delayedTFRC instproc init {} { $self instvar net_ test_ guide_ list_ period_ set net_ net2 set test_ delayedTFRC set guide_ \ "One TFRC flow, with some packets delayed 0.03 seconds, numPkts_ 1." set period_ 40.0 ErrorModel set delay_pkt_ true ErrorModel set drop_ false ErrorModel set delay_ 0.03 Agent/TFRCSink set numPkts_ 1 Test/delayedTFRC instproc run {} [Test/goodTFRC info instbody run ] $self next pktTraceFile}Class Test/delayedTFRC1 superclass TestSuiteTest/delayedTFRC1 instproc init {} { $self instvar net_ test_ guide_ list_ period_ set net_ net2 set test_ delayedTFRC1 set guide_ \ "One TFRC flow, with some packets delayed 0.03 seconds, numPkts_ 5." set period_ 40.0 ErrorModel set delay_pkt_ true ErrorModel set drop_ false ErrorModel set delay_ 0.03 Agent/TFRCSink set numPkts_ 5 Test/delayedTFRC1 instproc run {} [Test/goodTFRC info instbody run ] $self next pktTraceFile}Class Test/delayedTFRC2 superclass TestSuiteTest/delayedTFRC2 instproc init {} { $self instvar net_ test_ guide_ list_ period_ set net_ net2 set test_ delayedTFRC2 set guide_ \ "One TFRC flow, with some packets delayed 0.01 seconds, numPkts_ 3." set period_ 40.0 ErrorModel set delay_pkt_ true ErrorModel set drop_ false ErrorModel set delay_ 0.01 Agent/TFRCSink set numPkts_ 3 Test/delayedTFRC2 instproc run {} [Test/goodTFRC info instbody run ] $self next pktTraceFile}Class Test/goodTCP superclass TestSuiteTest/goodTCP instproc init {} { $self instvar net_ test_ guide_ list_ period_ set net_ net2 set test_ goodTCP set guide_ \ "One TCP flow, no reordering and no extra drops." set list_ {50000 50001} set period_ 1000.0 $self next pktTraceFile}Test/goodTCP instproc run {} { global quiet $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ list_ period_ if {$quiet == "false"} {puts $guide_} $self setTopo set interval_ 0.1 set stopTime 20.0 set stopTime0 [expr $stopTime - 0.001] set stopTime2 [expr $stopTime + 0.001] set dumpfile_ [open temp.s w] if {$quiet == "false"} { set tracefile [open all.tr w] $ns_ trace-all $tracefile } set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(s3) 0] set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.0 "$ftp1 start" $self pktsDump 1 $tcp1 $interval_ $dumpfile_ $self dropPktsPeriodic [$ns_ link $node_(r2) $node_(s3)] 0 200.0 $period_ $ns_ at $stopTime0 "close $dumpfile_; $self finish_1 $testName_" #$self traceQueues $node_(r1) [$self openTrace $stopTime $testName_] $ns_ at $stopTime "$self cleanupAll $testName_" if {$quiet == "false"} { $ns_ at $stopTime2 "close $tracefile" } $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0" $ns_ at $stopTime0 "$self printpkts 0 $tcp1" # trace only the bottleneck link $ns_ run}Class Test/droppedTCP superclass TestSuiteTest/droppedTCP instproc init {} { $self instvar net_ test_ guide_ list_ period_ set net_ net2 set test_ droppedTCP set guide_ \ "One TCP flow, with extra dropped packets." set period_ 40.0 Test/droppedTCP instproc run {} [Test/goodTCP info instbody run ] $self next pktTraceFile}Class Test/delayedTCP superclass TestSuiteTest/delayedTCP instproc init {} { $self instvar net_ test_ guide_ list_ period_ set net_ net2 set test_ delayedTCP set guide_ \ "One TCP flow, with some packets delayed 0.03 seconds." set period_ 40.0 ErrorModel set delay_pkt_ true ErrorModel set drop_ false ErrorModel set delay_ 0.03 Test/delayedTCP instproc run {} [Test/goodTCP info instbody run ] $self next pktTraceFile}Class Test/delayedTCP2 superclass TestSuiteTest/delayedTCP2 instproc init {} { $self instvar net_ test_ guide_ list_ period_ set net_ net2 set test_ delayedTCP2 set guide_ \ "One TCP flow, with some packets delayed 0.01 seconds." set period_ 40.0 ErrorModel set delay_pkt_ true ErrorModel set drop_ false ErrorModel set delay_ 0.01 Test/delayedTCP2 instproc run {} [Test/goodTCP info instbody run ] $self next pktTraceFile}Class Test/initRate superclass TestSuiteTest/initRate instproc init {} { $self instvar net_ test_ guide_ period_ set net_ net2 set test_ initRate set guide_ \ "One TFRC flow, initial rate of one packet per RTT." set period_ 10000.0 Agent/TFRC set rate_init_ 1 Agent/TFRC set rate_init_option_ 1 Agent/TFRC set ss_changes_ 1 $self next pktTraceFile}Test/initRate instproc run {} { global quiet $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ period_ if {$quiet == "false"} {puts $guide_} $self setTopo set interval_ 0.1 set stopTime 2.0 set stopTime0 [expr $stopTime - 0.001] set stopTime2 [expr $stopTime + 0.001] set dumpfile_ [open temp.s w] if {$quiet == "false"} { set tracefile [open all.tr w] $ns_ trace-all $tracefile } set tf1 [$ns_ create-connection TFRC $node_(s1) TFRCSink $node_(s3) 0] $ns_ at 0.0 "$tf1 start" $self dropPktsPeriodic [$ns_ link $node_(r2) $node_(s3)] 0 1000.0 $period_ $self tfccDump 1 $tf1 $interval_ $dumpfile_ $ns_ at $stopTime0 "close $dumpfile_; $self finish_1 $testName_" #$self traceQueues $node_(r1) [$self openTrace $stopTime $testName_] $ns_ at $stopTime "$self cleanupAll $testName_" if {$quiet == "false"} { $ns_ at $stopTime2 "close $tracefile" } $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0" # $ns_ at $stopTime0 "$self printTFRCpkts 0 $tf1" # trace only the bottleneck link $ns_ run}Class Test/initRateLarge superclass TestSuiteTest/initRateLarge instproc init {} { $self instvar net_ test_ guide_ period_ set net_ net2 set test_ initRateLarge set guide_ \ "One TFRC flow, initial rate of 4 packets per RTT." set period_ 10000.0 Agent/TFRC set rate_init_ 4.0 Agent/TFRC set rate_init_option_ 1 Agent/TFRC set ss_changes_ 1 Test/initRateLarge instproc run {} [Test/initRate info instbody run ] $self next pktTraceFile}Class Test/initRateNo_ss_changes superclass TestSuiteTest/initRateNo_ss_changes instproc init {} { $self instvar net_ test_ guide_ period_ set net_ net2 set test_ initRateNo_ss_changes set guide_ \ "One TFRC flow, initial rate of 4 packets per RTT, no ss_changes_." set period_ 10000.0 Agent/TFRC set rate_init_ 4.0 Agent/TFRC set rate_init_option_ 1 Agent/TFRC set ss_changes_ 0 Test/initRateNo_ss_changes instproc run {} [Test/initRate info instbody run ] $self next pktTraceFile}Class Test/initRateRFC3390 superclass TestSuiteTest/initRateRFC3390 instproc init {} { $self instvar net_ test_ guide_ period_ set net_ net2 set test_ initRateRFC3390 set guide_ \ "One TFRC flow, initial rate from RFC 3390." set period_ 10000.0 Agent/TFRC set rate_init_option_ 2 Agent/TFRC set ss_changes_ 1 Test/initRateRFC3390 instproc run {} [Test/initRate info instbody run ] $self next pktTraceFile}TestSuite instproc printdrops { fid fmon } { set fcl [$fmon classifier]; # flow classifier # set flow [$fcl lookup auto 0 0 $fid] puts "fid: $fid drops [$flow set pdrops_] marks [$flow set pmarks_]" puts "fid: $fid packets [$flow set pdepartures_] _bytes [$flow set bdepartures_]"}Class Test/tfrcOnly superclass TestSuiteTest/tfrcOnly instproc init {} { $self instvar net_ test_ guide_ voip set net_ net2b set test_ tfrcOnly set guide_ \ "One VoIP TFRC flow and one TCP flow, different packet sizes." set voip 1 $self next pktTraceFile}Test/tfrcOnly instproc run {} { global quiet $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ voip if {$quiet == "false"} {puts $guide_} $self setTopo set interval_ 0.1 set stopTime 20.0 set stopTime0 [expr $stopTime - 0.001] set stopTime2 [expr $stopTime + 0.001] set pktsize 120 set cbrInterval 0.01 set slink [$ns_ link $node_(r1) $node_(r2)]; # link to collect stats on set fmon [$ns_ makeflowmon Fid] $ns_ attach-fmon $slink $fmon set dumpfile_ [open temp.s w] if {$quiet == "false"} { set tracefile [open all.tr w] $ns_ trace-all $tracefile } $ns_ at 0.0 "$ns_ bandwidth $node_(r1) $node_(r2) 0.2Mbps duplex" $ns_ queue-limit $node_(r1) $node_(r2) 4 set tf1 [$ns_ create-connection TFRC $node_(s1) TFRCSink $node_(s3) 0] $tf1 set voip_ $voip $tf1 set packetSize_ $pktsize set cbr [new Application/Traffic/CBR] $cbr set packetSize_ $pktsize $cbr set interval_ $cbrInterval $cbr attach-agent $tf1 $ns_ at 2.0 "$cbr start" $ns_ at $stopTime0 "$cbr stop" $self tfccDump 1 $tf1 $interval_ $dumpfile_ $ns_ at $stopTime0 "close $dumpfile_; $self finish_1 $testName_" $ns_ at $stopTime0 "$self printdrops 0 $fmon" $ns_ at $stopTime "$self cleanupAll $testName_" if {$quiet == "false"} { $ns_ at $stopTime2 "close $tracefile" } $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0" # trace only the bottleneck link $ns_ run}Class Test/voip superclass TestSuiteTest/voip instproc init {} { $self instvar net_ test_ guide_ voip set net_ net2b set test_ voip set guide_ \ "One VoIP TFRC flow and one TCP flow, different packet sizes." set voip 1 $self next pktTraceFile}Test/voip instproc run {} { global quiet $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ voip if {$quiet == "false"} {puts $guide_} $self setTopo set interval_ 0.1 set stopTime 20.0 set stopTime0 [expr $stopTime - 0.001] set stopTime2 [expr $stopTime + 0.001] set pktsize 120 set cbrInterval 0.01 set slink [$ns_ link $node_(r1) $node_(r2)]; # link to collect stats on set fmon [$ns_ makeflowmon Fid] $ns_ attach-fmon $slink $fmon set dumpfile_ [open temp.s w] if {$quiet == "false"} { set tracefile [open all.tr w] $ns_ trace-all $tracefile } $ns_ at 0.0 "$ns_ bandwidth $node_(r1) $node_(r2) 0.2Mbps duplex" $ns_ queue-limit $node_(r1) $node_(r2) 4 set tf1 [$ns_ create-connection TFRC $node_(s1) TFRCSink $node_(s3) 0] $tf1 set voip_ $voip $tf1 set packetSize_ $pktsize set cbr [new Application/Traffic/CBR] $cbr set packetSize_ $pktsize $cbr set interval_ $cbrInterval $cbr attach-agent $tf1 $ns_ at 2.0 "$cbr start" $ns_ at $stopTime0 "$cbr stop" set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s2) TCPSink/Sack1 $node_(s4) 1] $tcp1 set window_ 10 $tcp1 set packetSize_ 1460 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.0 "$ftp1 start" $ns_ at $stopTime0 "$ftp1 stop" $self tfccDump 1 $tf1 $interval_ $dumpfile_ $self pktsDump 2 $tcp1 $interval_ $dumpfile_ $ns_ at $stopTime0 "close $dumpfile_; $self finish_1 $testName_" $ns_ at $stopTime0 "$self printdrops 0 $fmon; $self printdrops 1 $fmon" $ns_ at $stopTime "$self cleanupAll $testName_" if {$quiet == "false"} { $ns_ at $stopTime2 "close $tracefile" } $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0" # trace only the bottleneck link $ns_ run}Class Test/noVoip superclass TestSuiteTest/noVoip instproc init {} { $self instvar net_ test_ guide_ voip set net_ net2 set test_ noVoip set guide_ \ "One TFRC flow (not voip) and one TCP flow, different packet sizes." set voip 0 Test/noVoip instproc run {} [Test/voip info instbody run ] $self next pktTraceFile}TestSuite runTest
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -