📄 test-suite-quickstart.tcl
字号:
#set qs OFF $self next pktTraceFile}Test/quickstart4full instproc run {} { global quiet wrap1 wrap $self instvar ns_ node_ testName_ guide_ sndr rcvr qs if {$quiet == "false"} {puts $guide_} $ns_ node-config -QS $qs $self setTopo set stopTime 6 set tcp1 [$ns_ create-connection TCP/Newreno $node_(s1) TCPSink $node_(s3) 0] $tcp1 set window_ 8 set ftp1 [new Application/FTP] $ftp1 attach-agent $tcp1 $ns_ at 0 "$ftp1 start" set wrap $wrap1 set fid 1 set tcp2 [new Agent/TCP/FullTcp/Sack] set sink [new Agent/TCP/FullTcp/Sack] $ns_ attach-agent $node_(s1) $tcp2 $ns_ attach-agent $node_(s3) $sink $tcp2 set fid_ $fid $sink set fid_ $fid $ns_ connect $tcp2 $sink # set up TCP-level connections $sink listen ; # will figure out who its peer is #set tcp2 [$ns_ create-connection $sndr $node_(s1) $rcvr $node_(s3) 1] $tcp2 set window_ 1000 $tcp2 set rate_request_ 20 set ftp2 [new Application/FTP] $ftp2 attach-agent $tcp2 $ns_ at 2 "$ftp2 produce 80" $ns_ at $stopTime "$self cleanupAll $testName_ $stopTime" $ns_ run}## Algorithm 1 gives a different result that it used to...Class Test/high_request -superclass TestSuiteTest/high_request instproc init {} { $self instvar net_ test_ guide_ sndr rcvr qs set net_ net2 set test_ high_request set guide_ \ "A high quickstart request." set sndr TCP/Sack1 set rcvr TCPSink/Sack1 Agent/QSAgent set alloc_rate_ 0.01 Agent/QSAgent set rate_function_ 1 Agent/QSAgent set algorithm_ 1 Agent/TCP set qs_request_mode_ 2 set qs ON $self next pktTraceFile}Test/high_request instproc run {} { global quiet $self instvar ns_ node_ testName_ guide_ sndr rcvr qs if {$quiet == "false"} {puts $guide_} $ns_ node-config -QS $qs $self setTopo set stopTime 6 set tcp1 [$ns_ create-connection TCP/Newreno $node_(s1) TCPSink $node_(s3) 0] $tcp1 set window_ 8 set ftp1 [new Application/FTP] $ftp1 attach-agent $tcp1 $ns_ at 0 "$ftp1 start" set tcp2 [$ns_ create-connection $sndr $node_(s1) $rcvr $node_(s3) 1] $tcp2 set window_ 1000 $tcp2 set rate_request_ 1000 set ftp2 [new Application/FTP] $ftp2 attach-agent $tcp2 $ns_ at 2 "$ftp2 produce 80" $ns_ at $stopTime "$self cleanupAll $testName_ $stopTime" $ns_ run}Class Test/bad_router -superclass TestSuiteTest/bad_router instproc init {} { $self instvar net_ test_ guide_ sndr rcvr qs set net_ net2 set test_ bad_router set guide_ \ "Not all routers support quickstart." set sndr TCP/Sack1 set rcvr TCPSink/Sack1 set qs ON $self next pktTraceFile}Test/bad_router instproc run {} { global quiet $self instvar ns_ node_ testName_ guide_ sndr rcvr qs if {$quiet == "false"} {puts $guide_} $ns_ node-config -QS $qs $self setTopo set router $node_(r2) [$router qs-agent] set qs_enabled_ 0 set stopTime 6 set tcp1 [$ns_ create-connection TCP/Newreno $node_(s1) TCPSink $node_(s3) 0] $tcp1 set window_ 8 set ftp1 [new Application/FTP] $ftp1 attach-agent $tcp1 $ns_ at 0 "$ftp1 start" set tcp2 [$ns_ create-connection $sndr $node_(s1) $rcvr $node_(s3) 1] $tcp2 set window_ 1000 $tcp2 set rate_request_ 20 set ftp2 [new Application/FTP] $ftp2 attach-agent $tcp2 $ns_ at 2 "$ftp2 produce 80" $ns_ at $stopTime "$self cleanupAll $testName_ $stopTime" $ns_ run}Class Test/changing_rtt -superclass TestSuiteTest/changing_rtt instproc init {} { $self instvar net_ test_ guide_ sndr rcvr qs set net_ net2 set test_ changing_rtt set guide_ \ "Changing round-trip times." set sndr TCP/Sack1 set rcvr TCPSink/Sack1 set qs ON $self next pktTraceFile}Test/changing_rtt instproc run {} { global quiet $self instvar ns_ node_ testName_ guide_ sndr rcvr qs if {$quiet == "false"} {puts $guide_} $ns_ node-config -QS $qs $self setTopo set stopTime 6 set tcp1 [$ns_ create-connection TCP/Newreno $node_(s1) TCPSink $node_(s3) 0] $tcp1 set window_ 8 set ftp1 [new Application/FTP] $ftp1 attach-agent $tcp1 $ns_ at 0 "$ftp1 start" set tcp2 [$ns_ create-connection $sndr $node_(s1) $rcvr $node_(s3) 1] $tcp2 set window_ 1000 $tcp2 set rate_request_ 20 set ftp2 [new Application/FTP] $ftp2 attach-agent $tcp2 $ns_ at 2 "$ftp2 produce 80" $ns_ at 3.1 "$ns_ delay $node_(r1) $node_(r2) 100ms duplex" $ns_ at $stopTime "$self cleanupAll $testName_ $stopTime" $ns_ run}Class Test/changing_rtt1 -superclass TestSuiteTest/changing_rtt1 instproc init {} { $self instvar net_ test_ guide_ sndr rcvr qs set net_ net2 set test_ changing_rtt1 set guide_ \ "Changing round-trip times." set sndr TCP/Newreno/QS set rcvr TCPSink/QS set qs ON Test/changing_rtt1 instproc run {} [Test/changing_rtt info instbody run ] $self next pktTraceFile}Class Test/no_acks_back -superclass TestSuiteTest/no_acks_back instproc init {} { $self instvar net_ test_ guide_ sndr rcvr qs set net_ net2 set test_ no_acks_back set guide_ \ "After the first exchange, sender receives no acks." set sndr TCP/Sack1 set rcvr TCPSink/Sack1 set qs ON $self next pktTraceFile}Test/no_acks_back instproc run {} { global quiet $self instvar ns_ node_ testName_ guide_ sndr rcvr qs if {$quiet == "false"} {puts $guide_} $ns_ node-config -QS $qs $self setTopo set stopTime 10 set tcp1 [$ns_ create-connection TCP/Newreno $node_(s1) TCPSink $node_(s3) 0] $tcp1 set window_ 8 set ftp1 [new Application/FTP] $ftp1 attach-agent $tcp1 $ns_ at 0 "$ftp1 start" set tcp2 [$ns_ create-connection $sndr $node_(s1) $rcvr $node_(s4) 1] $tcp2 set window_ 1000 $tcp2 set rate_request_ 20 set ftp2 [new Application/FTP] $ftp2 attach-agent $tcp2 $ns_ at 2 "$ftp2 produce 80" $ns_ at 3.0 "$ns_ delay $node_(r2) $node_(s4) 10000ms duplex" $ns_ at $stopTime "$self cleanupAll $testName_ $stopTime" $ns_ run}Class Test/pkt_drops -superclass TestSuiteTest/pkt_drops instproc init {} { $self instvar net_ test_ guide_ sndr rcvr qs set net_ net2 set test_ pkt_drops set guide_ \ "Packets are dropped in the initial window after quickstart." set sndr TCP/Sack1 set rcvr TCPSink/Sack1 set qs ON $self next pktTraceFile}Test/pkt_drops instproc run {} { global quiet $self instvar ns_ node_ testName_ guide_ sndr rcvr qs if {$quiet == "false"} {puts $guide_} $ns_ node-config -QS $qs $self setTopo set stopTime 20 set tcp1 [$ns_ create-connection TCP/Newreno $node_(s1) TCPSink $node_(s3) 0] $tcp1 set window_ 8 set ftp1 [new Application/FTP] $ftp1 attach-agent $tcp1 $ns_ at 0 "$ftp1 start" set tcp2 [$ns_ create-connection $sndr $node_(s1) $rcvr $node_(s4) 1] $tcp2 set window_ 1000 $tcp2 set rate_request_ 20 $tcp2 set tcp_qs_recovery_ true set ftp2 [new Application/FTP] $ftp2 attach-agent $tcp2 $ns_ at 2 "$ftp2 produce 80" $self drop_pkts {5 6} $ns_ at $stopTime "$self cleanupAll $testName_ $stopTime" $ns_ run}TestSuite runTest
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -