test-suite-sctp.tcl
来自「一款用来进行网络模拟的软件」· TCL 代码 · 共 2,235 行 · 第 1/5 页
TCL
2,235 行
TestSuite instproc init {} { Trace set show_sctphdr_ 1 $self instvar ns numnodes_ set ns [new Simulator] set allchan [open temp.rands w] $ns trace-all $allchan}TestSuite instproc finish {} { $self instvar ns global quiet PERL $ns flush-trace if {$quiet == 0} { puts "Graphing..." set XGRAPH "../../../bin/xgraph" set RAW2XG_SCTP "../../bin/raw2xg-sctp" set WRAP 100 exec $PERL $RAW2XG_SCTP -A -f -q -s 0.01 -m $WRAP -n 0 temp.rands \ > temp.rands.points exec $XGRAPH -bb -tk -nl -m -x time -y packets temp.rands.points & } exit 0}Test/sctp-2packetsTimeout instproc init {} { $self instvar ns ftp0 global quiet set testName 2packetsTimeout $self next set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 .5Mb 200ms DropTail $ns duplex-link-op $n0 $n1 orient right set err [new ErrorModel/List] $err droplist {15 16 32 33} $ns lossmodel $err $n0 $n1 set sctp0 [new Agent/SCTP] $ns attach-agent $n0 $sctp0 $sctp0 set mtu_ 1500 $sctp0 set dataChunkSize_ 1468 $sctp0 set numOutStreams_ 1 if {$quiet == 0} { $sctp0 set debugMask_ -1 $sctp0 set debugFileIndex_ 0 } set sctp1 [new Agent/SCTP] $ns attach-agent $n1 $sctp1 $sctp1 set mtu_ 1500 $sctp1 set initialRwnd_ 131072 $sctp1 set useDelayedSacks_ 0 if {$quiet == 0} { $sctp1 set debugMask_ -1 $sctp1 set debugFileIndex_ 1 } $ns connect $sctp0 $sctp1 set ftp0 [new Application/FTP] $ftp0 attach-agent $sctp0}Test/sctp-2packetsTimeout instproc run {} { $self instvar ns ftp0 $ns at 0.5 "$ftp0 start" $ns at 10.0 "$self finish" $ns run}Test/sctp-AMR-Exceeded instproc init {} { $self instvar ns testName ftp0 global quiet set testName AMR-Exceeded $self next set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 .5Mb 200ms DropTail $ns duplex-link-op $n0 $n1 orient right set err [new ErrorModel/List] $err droplist {15 16 17 18 19 20 21 22 23 24 32 33 34 35 36 37 38 39 40 41 42 43 44} $ns lossmodel $err $n0 $n1 set sctp0 [new Agent/SCTP] $ns attach-agent $n0 $sctp0 $sctp0 set mtu_ 1500 $sctp0 set dataChunkSize_ 1468 $sctp0 set numOutStreams_ 1 $sctp0 set associationMaxRetrans_ 5 if {$quiet == 0} { $sctp0 set debugMask_ -1 $sctp0 set debugFileIndex_ 0 set trace_ch [open trace.sctp w] $sctp0 set trace_all_ 1 $sctp0 trace cwnd_ $sctp0 trace rto_ $sctp0 trace errorCount_ $sctp0 attach $trace_ch } set sctp1 [new Agent/SCTP] $ns attach-agent $n1 $sctp1 $sctp1 set mtu_ 1500 $sctp1 set initialRwnd_ 131072 $sctp1 set useDelayedSacks_ 0 if {$quiet == 0} { $sctp1 set debugMask_ -1 $sctp1 set debugFileIndex_ 1 } $ns connect $sctp0 $sctp1 set ftp0 [new Application/FTP] $ftp0 attach-agent $sctp0}Test/sctp-AMR-Exceeded instproc run {} { $self instvar ns ftp0 $ns at 0.5 "$ftp0 start" $ns at 90.0 "$self finish" $ns run}Test/sctp-Rel1-Loss2 instproc init {} { $self instvar ns testName ftp0 global quiet set testName Rel1-Loss2 $self next set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 .5Mb 200ms DropTail $ns duplex-link-op $n0 $n1 orient right set err [new ErrorModel/List] $err droplist {16 29} $ns lossmodel $err $n0 $n1 set sctp0 [new Agent/SCTP] $ns attach-agent $n0 $sctp0 $sctp0 set mtu_ 1500 $sctp0 set dataChunkSize_ 1468 $sctp0 set numOutStreams_ 1 $sctp0 set numUnrelStreams_ 1 $sctp0 set reliability_ 1 if {$quiet == 0} { $sctp0 set debugMask_ -1 $sctp0 set debugFileIndex_ 0 set trace_ch [open trace.sctp w] $sctp0 set trace_all_ 1 $sctp0 trace cwnd_ $sctp0 trace rto_ $sctp0 trace errorCount_ $sctp0 attach $trace_ch } set sctp1 [new Agent/SCTP] $ns attach-agent $n1 $sctp1 $sctp1 set mtu_ 1500 $sctp1 set initialRwnd_ 131072 $sctp1 set useDelayedSacks_ 1 if {$quiet == 0} { $sctp1 set debugMask_ -1 $sctp1 set debugFileIndex_ 1 } $ns connect $sctp0 $sctp1 set ftp0 [new Application/FTP] $ftp0 attach-agent $sctp0 }Test/sctp-Rel1-Loss2 instproc run {} { $self instvar ns ftp0 $ns at 0.5 "$ftp0 start" $ns at 10.0 "$self finish" $ns run}Test/sctp-burstAfterFastRtxRecovery instproc init {} { $self instvar ns testName ftp0 global quiet set testName burstAfterFastRtxRecovery $self next set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 5Mb 50ms DropTail $ns duplex-link-op $n0 $n1 orient right set err [new ErrorModel/List] $err droplist {113} $ns lossmodel $err $n0 $n1 set sctp0 [new Agent/SCTP] $ns attach-agent $n0 $sctp0 $sctp0 set mtu_ 1500 $sctp0 set dataChunkSize_ 1468 $sctp0 set numOutStreams_ 1 $sctp0 set useMaxBurst_ 1 if {$quiet == 0} { $sctp0 set debugMask_ -1 $sctp0 set debugFileIndex_ 0 set trace_ch [open trace.sctp w] $sctp0 set trace_all_ 1 $sctp0 trace cwnd_ $sctp0 trace rto_ $sctp0 trace errorCount_ $sctp0 attach $trace_ch } set sctp1 [new Agent/SCTP] $ns attach-agent $n1 $sctp1 $sctp1 set mtu_ 1500 $sctp1 set initialRwnd_ 23488 $sctp1 set useDelayedSacks_ 1 if {$quiet == 0} { $sctp1 set debugMask_ -1 $sctp1 set debugFileIndex_ 1 } $ns connect $sctp0 $sctp1 set ftp0 [new Application/FTP] $ftp0 attach-agent $sctp0}Test/sctp-burstAfterFastRtxRecovery instproc run {} { $self instvar ns ftp0 $ns at 0.5 "$ftp0 start" $ns at 5.0 "$self finish" $ns run}Test/sctp-burstAfterFastRtxRecovery-2 instproc init {} { $self instvar ns testName ftp0 global quiet set testName burstAfterFastRtxRecovery-2 $self next set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 .5Mb 200ms DropTail $ns duplex-link-op $n0 $n1 orient right set err [new ErrorModel/List] $err droplist {32} $ns lossmodel $err $n0 $n1 set sctp0 [new Agent/SCTP] $ns attach-agent $n0 $sctp0 $sctp0 set mtu_ 1500 $sctp0 set dataChunkSize_ 1468 $sctp0 set numOutStreams_ 1 $sctp0 set useMaxBurst_ 1 if {$quiet == 0} { $sctp0 set debugMask_ -1 $sctp0 set debugFileIndex_ 0 set trace_ch [open trace.sctp w] $sctp0 set trace_all_ 1 $sctp0 trace cwnd_ $sctp0 trace rto_ $sctp0 trace errorCount_ $sctp0 attach $trace_ch } set sctp1 [new Agent/SCTP] $ns attach-agent $n1 $sctp1 $sctp1 set mtu_ 1500 $sctp1 set initialRwnd_ 23488 $sctp1 set useDelayedSacks_ 1 if {$quiet == 0} { $sctp1 set debugMask_ -1 $sctp1 set debugFileIndex_ 1 } $ns connect $sctp0 $sctp1 set ftp0 [new Application/FTP] $ftp0 attach-agent $sctp0}Test/sctp-burstAfterFastRtxRecovery-2 instproc run {} { $self instvar ns ftp0 $ns at 0.5 "$ftp0 start" $ns at 6.0 "$self finish" $ns run}Test/sctp-cwndFreeze instproc init {} { $self instvar ns testName ftp0 global quiet set testName cwndFreeze $self next set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 .5Mb 200ms DropTail $ns duplex-link-op $n0 $n1 orient right set err [new ErrorModel/List] $err droplist {16} $ns lossmodel $err $n0 $n1 set sctp0 [new Agent/SCTP] $ns attach-agent $n0 $sctp0 $sctp0 set mtu_ 1500 $sctp0 set dataChunkSize_ 1468 $sctp0 set numOutStreams_ 1 if {$quiet == 0} { $sctp0 set debugMask_ -1 $sctp0 set debugFileIndex_ 0 set trace_ch [open trace.sctp w] $sctp0 set trace_all_ 1 $sctp0 trace cwnd_ $sctp0 trace rto_ $sctp0 trace errorCount_ $sctp0 attach $trace_ch } set sctp1 [new Agent/SCTP] $ns attach-agent $n1 $sctp1 $sctp1 set mtu_ 1500 $sctp1 set initialRwnd_ 131072 $sctp1 set useDelayedSacks_ 0 if {$quiet == 0} { $sctp1 set debugMask_ -1 $sctp1 set debugFileIndex_ 1 } $ns connect $sctp0 $sctp1 set ftp0 [new Application/FTP] $ftp0 attach-agent $sctp0}Test/sctp-cwndFreeze instproc run {} { $self instvar ns ftp0 $ns at 0.5 "$ftp0 start" $ns at 5.0 "$self finish" $ns run}Test/sctp-cwndFreeze-multistream instproc init {} { $self instvar ns testName ftp0 global quiet set testName cwndFreeze-multistream $self next set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 .5Mb 200ms DropTail $ns duplex-link-op $n0 $n1 orient right set err [new ErrorModel/List] $err droplist {16} $ns lossmodel $err $n0 $n1 set sctp0 [new Agent/SCTP] $ns attach-agent $n0 $sctp0 $sctp0 set mtu_ 1500 $sctp0 set dataChunkSize_ 1468 $sctp0 set numOutStreams_ 5 if {$quiet == 0} { $sctp0 set debugMask_ -1 $sctp0 set debugFileIndex_ 0 set trace_ch [open trace.sctp w] $sctp0 set trace_all_ 1 $sctp0 trace cwnd_ $sctp0 trace rto_ $sctp0 trace errorCount_ $sctp0 attach $trace_ch } set sctp1 [new Agent/SCTP] $ns attach-agent $n1 $sctp1 $sctp1 set mtu_ 1500 $sctp1 set initialRwnd_ 131072 $sctp1 set useDelayedSacks_ 1 if {$quiet == 0} { $sctp1 set debugMask_ -1 $sctp1 set debugFileIndex_ 1 } $ns connect $sctp0 $sctp1 set ftp0 [new Application/FTP] $ftp0 attach-agent $sctp0 }Test/sctp-cwndFreeze-multistream instproc run {} { $self instvar ns ftp0 $ns at 0.5 "$ftp0 start" $ns at 10.0 "$self finish" $ns run}Test/sctp-hugeRwnd instproc init {} { $self instvar ns testName ftp0 global quiet set testName hugeRwnd $self next set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 1500Mb 300ms DropTail $ns duplex-link-op $n0 $n1 orient right $ns queue-limit $n0 $n1 10000 set err [new ErrorModel/List] set sctp0 [new Agent/SCTP] $ns attach-agent $n0 $sctp0 $sctp0 set mtu_ 1500
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?