📄 test-suite-adaptive-red.tcl
字号:
Class Test/fastlinkAutowq -superclass TestSuiteTest/fastlinkAutowq instproc init {} { $self instvar net_ test_ ns_ set net_ netfast set test_ fastlinkAutowq Queue/RED set q_weight_ 0 Test/fastlinkAutowq instproc run {} [Test/fastlink info instbody run ] $self next pktTraceFile}Class Test/fastlinkAutothresh -superclass TestSuiteTest/fastlinkAutothresh instproc init {} { $self instvar net_ test_ ns_ set net_ netfast set test_ fastlinkAutothresh Queue/RED set thresh_ 0 Queue/RED set maxthresh_ 0 Test/fastlinkAutothresh instproc run {} [Test/fastlink info instbody run ] $self next pktTraceFile}Class Test/fastlinkAdapt -superclass TestSuiteTest/fastlinkAdapt instproc init {} { $self instvar net_ test_ ns_ set net_ netfast set test_ fastlinkAdapt Queue/RED set adaptive_ 1 Test/fastlinkAdapt instproc run {} [Test/fastlink info instbody run ] $self next pktTraceFile}Class Test/fastlinkAllAdapt -superclass TestSuiteTest/fastlinkAllAdapt instproc init {} { $self instvar net_ test_ ns_ set net_ netfast set test_ fastlinkAllAdapt Queue/RED set adaptive_ 1 Queue/RED set q_weight_ 0 Queue/RED set thresh_ 0 Queue/RED set maxthresh_ 0 Test/fastlinkAllAdapt instproc run {} [Test/fastlink info instbody run ] $self next pktTraceFile}Class Test/fastlinkAllAdaptECN -superclass TestSuiteTest/fastlinkAllAdaptECN instproc init {} { $self instvar net_ test_ ns_ set net_ netfast set test_ fastlinkAllAdaptECN Queue/RED set adaptive_ 1 Queue/RED set q_weight_ 0 Queue/RED set thresh_ 0 Queue/RED set maxthresh_ 0 Queue/RED set setbit_ true Agent/TCP set ecn_ 1 Test/fastlinkAllAdaptECN instproc run {} [Test/fastlink info instbody run ] $self next pktTraceFile}# Changing upper bound for max_p Class Test/fastlinkAllAdapt1 -superclass TestSuiteTest/fastlinkAllAdapt1 instproc init {} { $self instvar net_ test_ ns_ set net_ netfast set test_ fastlinkAllAdapt1 Queue/RED set adaptive_ 1 Queue/RED set q_weight_ 0 Queue/RED set thresh_ 0 Queue/RED set maxthresh_ 0 Queue/RED set top_ 0.2 Queue/RED set bottom_ 0.1 Test/fastlinkAllAdapt1 instproc run {} [Test/fastlink info instbody run ] $self next pktTraceFile}#####################################################################Class Test/longlink -superclass TestSuiteTest/longlink instproc init {} { $self instvar net_ test_ set net_ netlong set test_ longlink $self next pktTraceFile}Test/longlink instproc run {} { $self instvar ns_ node_ testName_ net_ $self setTopo $self maketraffic 50.0 100 1.5 $self maketraffic1 100 0.5 $ns_ run}Class Test/longlinkAdapt -superclass TestSuiteTest/longlinkAdapt instproc init {} { $self instvar net_ test_ set net_ netlong Queue/RED set adaptive_ 1 Queue/RED set thresh_ 0 Queue/RED set maxthresh_ 0 Queue/RED set q_weight_ 0 set test_ longlinkAdapt Test/longlinkAdapt instproc run {} [Test/longlink info instbody run ] $self next pktTraceFile}Class Test/longlinkAdapt1 -superclass TestSuiteTest/longlinkAdapt1 instproc init {} { $self instvar net_ test_ set net_ netlong Queue/RED set adaptive_ 1 Queue/RED set thresh_ 0 Queue/RED set maxthresh_ 0 Queue/RED set q_weight_ -1.0 set test_ longlinkAdapt1 Test/longlinkAdapt1 instproc run {} [Test/longlink info instbody run ] $self next pktTraceFile}###################################################################### This reuses connection state, with $nums effective TCP connections,# reusing state from $conns underlying TCP connections.TestSuite instproc newtraffic { num window packets start interval conns} { $self instvar ns_ node_ testName_ net_ for {set i 0} {$i < $conns } {incr i} { set tcp($i) [$ns_ create-connection-list TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(s3) 2] set source($i) [lindex $tcp($i) 0] set sink($i) [lindex $tcp($i) 1] $source($i) set window_ $window set ftp($i) [$source($i) attach-app FTP] $ns_ at 0.0 "$ftp($i) produce 0" } for {set i 0} {$i < $num } {incr i} { set tcpnum [ expr $i % $conns ] set time [expr $start + $i * $interval] $ns_ at $time "$source($tcpnum) reset" $ns_ at $time "$sink($tcpnum) reset" $ns_ at $time "$ftp($tcpnum) producemore $packets" }}Class Test/red2 -superclass TestSuiteTest/red2 instproc init {} { $self instvar net_ test_ set net_ net2 set test_ red2 $self next pktTraceFile}Test/red2 instproc run {} { $self instvar ns_ node_ testName_ net_ $self setTopo $self maketraffic $self newtraffic 20 20 1000 25 0.1 20 $ns_ run}Class Test/red2Adapt -superclass TestSuiteTest/red2Adapt instproc init {} { $self instvar net_ test_ ns_ set net_ net2 set test_ red2Adapt $self next pktTraceFile}Test/red2Adapt instproc run {} { $self instvar ns_ node_ testName_ net_ $self setTopo set forwq [[$ns_ link $node_(r1) $node_(r2)] queue] $forwq set adaptive_ 1 $self automatic $forwq $self maketraffic $self newtraffic 20 20 1000 25 0.1 20 $ns_ run }Class Test/red2A-Adapt -superclass TestSuiteTest/red2A-Adapt instproc init {} { $self instvar net_ test_ ns_ set net_ net2 set test_ red2A-Adapt Queue/RED set alpha_ 0.02 Queue/RED set beta_ 0.8 Test/red2A-Adapt instproc run {} [Test/red2Adapt info instbody run ] $self next pktTraceFile}Class Test/red2-AdaptFeng -superclass TestSuiteTest/red2-AdaptFeng instproc init {} { $self instvar net_ test_ ns_ set net_ net2 set test_ red2-AdaptFeng Queue/RED set alpha_ 3 Queue/RED set beta_ 2 Queue/RED set feng_adaptive_ 1 Test/red2-AdaptFeng instproc run {} [Test/red2Adapt info instbody run ] $self next pktTraceFile}#####################################################################Class Test/red3 -superclass TestSuiteTest/red3 instproc init {} { $self instvar net_ test_ set net_ net2 set test_ red3 $self next pktTraceFile}Test/red3 instproc run {} { $self instvar ns_ node_ testName_ net_ $self setTopo $self maketraffic $self newtraffic 15 20 300 0 0.1 15 $ns_ run}Class Test/red3Adapt -superclass TestSuiteTest/red3Adapt instproc init {} { $self instvar net_ test_ ns_ set net_ net2 set test_ red3Adapt $self next pktTraceFile}Test/red3Adapt instproc run {} { $self instvar ns_ node_ testName_ net_ $self setTopo set forwq [[$ns_ link $node_(r1) $node_(r2)] queue] $forwq set adaptive_ 1 $self automatic $forwq $self maketraffic $self newtraffic 15 20 300 0 0.1 15 $ns_ run }Class Test/red4Adapt -superclass TestSuiteTest/red4Adapt instproc init {} { $self instvar net_ test_ ns_ set net_ net2 set test_ red4Adapt Queue/RED set alpha_ 0.02 Queue/RED set beta_ 0.8 Test/red4Adapt instproc run {} [Test/red3Adapt info instbody run ] $self next pktTraceFile}TestSuite instproc printall { fmon } { puts "aggregate per-link total_drops [$fmon set pdrops_]" puts "aggregate per-link total_packets [$fmon set pdepartures_]"}# Class Test/red5 -superclass TestSuite# Test/red5 instproc init {} {# $self instvar net_ test_ ns_# set net_ net2 # set test_ red5# Queue/RED set alpha_ 0.02# Queue/RED set beta_ 0.8# $self next pktTraceFile# }# Test/red5 instproc run {} {# $self instvar ns_ node_ testName_ net_# $self setTopo# set slink [$ns_ link $node_(r1) $node_(r2)]; # link to collect stats on# set fmon [$ns_ makeflowmon Fid]# $ns_ attach-fmon $slink $fmon# $self maketraffic# $self newtraffic 20 20 300 0 0.001 10# # To run many flows:# # $self newtraffic 4000 20 300 0 0.005 500# # $self newtraffic 40000 20 300 0 0.001 500# $ns_ at 49.99 "$self printall $fmon" # $ns_ run# }#####################################################################Class Test/transient -superclass TestSuiteTest/transient instproc init {} { $self instvar net_ test_ set net_ netfast set test_ transient $self next pktTraceFile}Test/transient instproc run {} { $self instvar ns_ node_ testName_ net_ $self setTopo set stoptime 5.0 set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(s3) 0] $tcp1 set window_ 100 set tcp2 [$ns_ create-connection TCP/Sack1 $node_(s2) TCPSink/Sack1 $node_(s3) 1] $tcp2 set window_ 1000 set ftp1 [$tcp1 attach-app FTP] set ftp2 [$tcp2 attach-app FTP] $self enable_tracequeue $ns_ $ns_ at 0.0 "$ftp1 start" $ns_ at 2.5 "$ftp2 start" $self tcpDump $tcp1 5.0 # trace only the bottleneck link #$self traceQueues $node_(r1) [$self openTrace $stoptime $testName_] $ns_ at $stoptime "$self cleanupAll $testName_" $ns_ run}Class Test/transient1 -superclass TestSuiteTest/transient1 instproc init {} { $self instvar net_ test_ set net_ netfast set test_ transient1 Queue/RED set q_weight_ 0 Test/transient1 instproc run {} [Test/transient info instbody run ] $self next pktTraceFile}Class Test/transient2 -superclass TestSuiteTest/transient2 instproc init {} { $self instvar net_ test_ set net_ netfast set test_ transient2 Queue/RED set q_weight_ 0.0001 Test/transient2 instproc run {} [Test/transient info instbody run ] $self next pktTraceFile}Class Test/notcautious -superclass TestSuiteTest/notcautious instproc init {} { $self instvar net_ test_ set net_ net4 set test_ notcautious Queue/RED set cautious_ 0 $self next pktTraceFile}Test/notcautious instproc run {} { $self instvar ns_ node_ testName_ net_ Queue/RED set q_weight_ -1 Queue/RED set adaptive_ 1 Queue/RED set thresh 0 Queue/RED set maxthresh 0 $self setTopo set stoptime 5.0 set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(s3) 0] $tcp1 set window_ 600 set tcp2 [$ns_ create-connection TCP/Sack1 $node_(s2) TCPSink/Sack1 $node_(s3) 1] $tcp2 set window_ 600 set ftp1 [$tcp1 attach-app FTP] set ftp2 [$tcp2 attach-app FTP] $self enable_tracequeue $ns_ $ns_ at 0.0 "$ftp1 start" $ns_ at 1.0 "$ftp2 start" $self tcpDump $tcp1 5.0 $ns_ at $stoptime "$self cleanupAll $testName_" $ns_ run} Class Test/cautious -superclass TestSuiteTest/cautious instproc init {} { $self instvar net_ test_ set net_ net4 set test_ cautious Queue/RED set cautious_ 1 Test/cautious instproc run {} [Test/notcautious info instbody run ] $self next pktTraceFile}Class Test/cautious2 -superclass TestSuiteTest/cautious2 instproc init {} { $self instvar net_ test_ set net_ net4 set test_ cautious2 Queue/RED set cautious_ 2 Test/cautious2 instproc run {} [Test/notcautious info instbody run ] $self next pktTraceFile}Class Test/cautious3 -superclass TestSuiteTest/cautious3 instproc init {} { $self instvar net_ test_ set net_ net4 set test_ cautious3 Queue/RED set cautious_ 3 Queue/RED set idle_pktsize_ 100 Test/cautious3 instproc run {} [Test/notcautious info instbody run ] $self next pktTraceFile}TestSuite runTest
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -