📄 test-suite-friendly.tcl
字号:
set tracefile [open all.tr w] $ns_ trace-all $tracefile } $self runFriendly $self runTcps $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" # trace only the bottleneck link $ns_ run}# Only TCPClass Test/OnlyTcp -superclass TestSuiteTest/OnlyTcp instproc init {} { $self instvar net_ test_ guide_ set net_ net2 set test_ OnlyTcp set guide_ \ "Five TCP connections." Agent/TCP set timerfix_ false # The default is being changed to true. $self next pktTraceFile}Test/OnlyTcp instproc run {} { global quiet $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ if {$quiet == "false"} {puts $guide_} $self setTopo set interval_ 0.1 set stopTime 30.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 } $self runTcp $self runTcps $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" # trace only the bottleneck link $ns_ run}## Random factor added to sending timesClass Test/randomized -superclass TestSuiteTest/randomized instproc init {} { $self instvar net_ test_ guide_ set net_ net2 set test_ randomized set guide_ \ "Random delay added to sending times, ca_ false." Agent/TFRC set overhead_ 0.5 Agent/TFRC set df_ 0.25 Agent/TFRC set ca_ 0 Test/randomized instproc run {} [Test/slowStart info instbody run] $self next pktTraceFile}## Random factor added to sending timesClass Test/randomizedCA -superclass TestSuiteTest/randomizedCA instproc init {} { $self instvar net_ test_ guide_ set net_ net2 set test_ randomizedCA set guide_ \ "Random delay added to sending times, with ca_." Agent/TFRC set overhead_ 0.5 Agent/TFRC set df_ 0.95 Agent/TFRC set ca_ 1 Test/randomizedCA instproc run {} [Test/slowStart info instbody run] $self next pktTraceFile}## Smaller random factor added to sending timesClass Test/randomized1 -superclass TestSuiteTest/randomized1 instproc init {} { $self instvar net_ test_ guide_ set net_ net2 set test_ randomized1 set guide_ \ "Smaller random delay added to sending times, ca_ false." Agent/TFRC set overhead_ 0.1 Agent/TFRC set df_ 0.25 Agent/TFRC set ca_ 0 Test/randomized1 instproc run {} [Test/slowStart info instbody run] $self next pktTraceFile}## Smaller random factor added to sending timesClass Test/randomized1CA -superclass TestSuiteTest/randomized1CA instproc init {} { $self instvar net_ test_ guide_ set net_ net2 set test_ randomized1CA set guide_ \ "Smaller random delay added to sending times, with ca_." Agent/TFRC set overhead_ 0.1 Agent/TFRC set df_ 0.95 Agent/TFRC set ca_ 1 Test/randomized1CA instproc run {} [Test/slowStart info instbody run] $self next pktTraceFile}Class Test/slow -superclass TestSuiteTest/slow instproc init {} { $self instvar net_ test_ guide_ set net_ net2a set test_ slow set guide_ \ "Very slow path." Agent/TFRCSink set discount_ 1 Agent/TFRCSink set smooth_ 1 Agent/TFRC set df_ 0.95 Agent/TFRC set ca_ 1 $self next pktTraceFile}Test/slow instproc run {} { global quiet $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ if {$quiet == "false"} {puts $guide_} $self setTopo# [$ns_ link $node_(r1) $node_(r2)] set bandwidth 0.001Mb# [$ns_ link $node_(r1) $node_(r2)] set queue-limit 5 set interval_ 100 set stopTime 4000.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 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" # trace only the bottleneck link $ns_ run}Class Test/twoDrops -superclass TestSuiteTest/twoDrops instproc init {} { $self instvar net_ test_ guide_ drops_ stopTime1_ set net_ net2 set test_ twoDrops set guide_ \ "TFRC, with two packets dropped near the beginning." Agent/TFRCSink set discount_ 1 Agent/TFRCSink set smooth_ 1 Agent/TFRC set df_ 0.95 Agent/TFRC set ca_ 1 set drops_ " 2 3 " set stopTime1_ 5.0 $self next pktTraceFile}Class Test/manyDrops -superclass TestSuite Test/manyDrops instproc init {} { $self instvar net_ test_ guide_ drops_ stopTime1_ set net_ net2 set test_ manyDrops set guide_ \ "TFRC, with many packets dropped in the beginning." Agent/TFRCSink set discount_ 1 Agent/TFRCSink set smooth_ 1 Agent/TFRC set df_ 0.95 Agent/TFRC set ca_ 1## set stopTime1_ 100.0 set stopTime1_ 100.0# set drops_ " 0 1 " set drops_ " 0 1 2 3 4 5 6 " Test/manyDrops instproc run {} [Test/twoDrops info instbody run ] $self next pktTraceFile}Test/twoDrops instproc run {} { global quiet $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ drops_ stopTime1_ if {$quiet == "false"} {puts $guide_} $self setTopo set interval_ 1 set stopTime $stopTime1_ 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 em [new ErrorModule Fid] set lossylink_ [$ns_ link $node_(r1) $node_(r2)] $lossylink_ errormodule $em $em default pass set emod [$lossylink_ errormodule] set errmodel [new ErrorModel/List] $errmodel unit pkt $errmodel droplist $drops_ $emod insert $errmodel $emod bind $errmodel 0 set tf1 [$ns_ create-connection TFRC $node_(s1) TFRCSink $node_(s3) 0] $ns_ at 0.0 "$tf1 start" $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" # trace only the bottleneck link $ns_ run}Class Test/HighLoss -superclass TestSuiteTest/HighLoss instproc init {} { $self instvar net_ test_ guide_ stopTime1_ set net_ net2 set test_ HighLoss set guide_ \ "TFRC competing against a CBR flow, with high loss." Agent/TFRCSink set discount_ 1 Agent/TFRCSink set smooth_ 1 Agent/TFRC set df_ 0.95 Agent/TFRC set ca_ 1 set stopTime1_ 60 $self next pktTraceFile}Test/HighLoss instproc run {} { global quiet $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ stopTime1_ if {$quiet == "false"} {puts $guide_} $self setTopo set interval_ 1 set stopTime $stopTime1_ 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" set udp1 [$ns_ create-connection UDP $node_(s2) UDP $node_(s4) 1] set cbr1 [$udp1 attach-app Traffic/CBR] $cbr1 set rate_ 3Mb $ns_ at [expr $stopTime1_/3.0] "$cbr1 start" $ns_ at [expr 2.0*$stopTime1_/3.0] "$cbr1 stop" $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" # trace only the bottleneck link $ns_ run} # PreciseLoss_ is turned offClass Test/HighLossImprecise -superclass TestSuiteTest/HighLossImprecise instproc init {} { $self instvar net_ test_ guide_ stopTime1_ set net_ net2 set test_ HighLossImprecise set guide_ \ "TFRC competing against a CBR flow, with PreciseLoss_ off." Agent/TFRCSink set discount_ 1 Agent/TFRCSink set smooth_ 1 Agent/TFRC set df_ 0.95 Agent/TFRC set ca_ 1 Agent/TFRCSink set PreciseLoss_ 0 set stopTime1_ 80 $self next pktTraceFile}Test/HighLossImprecise instproc run {} { global quiet $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ stopTime1_ if {$quiet == "false"} {puts $guide_} $self setTopo set interval_ 1 set stopTime $stopTime1_ 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" set udp1 [$ns_ create-connection UDP $node_(s2) UDP $node_(s4) 1] set cbr1 [$udp1 attach-app Traffic/CBR] $cbr1 set rate_ 3Mb $ns_ at [expr $stopTime1_/4.0] "$cbr1 start" $ns_ at [expr 2.0*$stopTime1_/4.0] "$cbr1 stop" $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" # trace only the bottleneck link $ns_ run} Class Test/HighLossConservative -superclass TestSuiteTest/HighLossConservative instproc init {} { $self instvar net_ test_ guide_ stopTime1_ set net_ net2 set test_ HighLossConservative set guide_ \ "TFRC and CBR, with a conservative_ response to heavy congestion." Agent/TFRCSink set discount_ 1 Agent/TFRCSink set smooth_ 1 Agent/TFRC set df_ 0.95 Agent/TFRC set ca_ 1 Agent/TFRC set conservative_ true set stopTime1_ 60 # Test/HighLossConservative instproc run {} [Test/HighLoss info instbody run ] $self next pktTraceFile}Test/HighLossConservative instproc run {} { global quiet $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ stopTime1_ if {$quiet == "false"} {puts $guide_} $self setTopo set interval_ 1 set stopTime $stopTime1_ set stopTime0 [expr $stopTime - 0.001] set stopTime2 [expr $stopTime + 0.001]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -