📄 test-suite-rfc793edu.tcl
字号:
} ################################## seqno-{fastrtx, nofastrtx} if {$tcptype == "seqno-fastrtx" || $tcptype == "seqno-nofastrtx" } { if {$quiet == "false"} { puts "" puts " Fast Retransmit" puts "------------------------------------------------------------------------" puts " 10Mb - r1: Tahoe with/without fastrtx" puts " s1----r1----k1 - r1 tx to k1" puts " 10ms - pkt 60 is dropped" puts "" puts "Without fast rtx., the source runs out of window and has to wait for a" puts "timeout to force the retransmission of the lost packet and the associated" puts "acknowledgement to open the window again." } $self instvar trace_ set trace_(seqn) [open "seqn.tr" w] set tcp1 [$ns_ create-connection TCP/RFC793edu $node_(r1) \ TCPSink $node_(k1) 1] set ftp1 [$tcp1 attach-app FTP] #$tcp1 set window_ 40 if {$tcptype == "seqno-fastrtx"} {$tcp1 set add793fastrtx_ true} $tcp1 set add793expbackoff_ true $tcp1 set add793karnrtt_ true $tcp1 set add793jacobsonrtt_ true $tcp1 set add793slowstart_ true $ns_ at 0.5 "$ftp1 produce 100000" #$self traceQueues $node_(r1) [$self openTrace 1.25 $testName_] $ns_ at 1.25 "$self cleanupAll $testName_" }################################## rto-{karn, nokarn} if {$tcptype == "rto-karn" || $tcptype == "rto-nokarn" } { $self instvar trace_ set trace_(srtt) [open "srtt.tr" w] if {$quiet == "false"} { puts "" puts "Karn Algorithm --- (Karn's RTT sampling + RTO Exponential Binary Backoff)" puts "------------------------------------------------------------------------" puts " 1Mb 0.9Mb - s1 is a Tahoe source, (nokarn: without Karn's A.)" puts " s1----r1----k1 - s1 tx; ack does not arrive, so s1 rtx;" puts " ^^ if using karn, it will space exponentially" puts " delay 10s!! the retx" puts " - a packet will be rtx around t=18s; ack for the" puts " first pkt sent arrives at t=20s; if Karn's" puts " is not used, then we the RTT estimation is 2s!!" } set tcp1 [$ns_ create-connection TCP/RFC793edu $node_(s1) \ TCPSink $node_(k1) 1] set ftp1 [$tcp1 attach-app FTP] $tcp1 set window_ 28 if {$tcptype == "rto-karn"} { $tcp1 set add793karnrtt_ true $tcp1 set add793expbackoff_ true } else { $tcp1 set add793karnrtt_ false $tcp1 set add793expbackoff_ false } $tcp1 set add793fastrtx_ true $tcp1 set add793jacobsonrtt_ false $tcp1 set add793slowstart_ true $ns_ at 0.0 "$self plotsrtt $tcp1 0.25" $ns_ at 0.5 "$ftp1 produce 100000" #$self traceQueues $node_(r1) [$self openTrace 50.0 $testName_] $ns_ at 50.0 "$self cleanupAll $testName_" }################################## jacobson88-noss if {$tcptype == "jacobson88-noss" || $tcptype == "jacobson88-ss" } { if {$quiet == "false"} { puts "" puts "Congestion avoidance and control" puts "------------------------------------------------------------------------" puts "" puts " s1---r1---n1---n2---n3---n4---n5---n6---n7---n8---r2---d1" puts " ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^" puts " (10Mb,2ms) (256Kb,10ms) all these links (10Mb,2ms)" puts "" puts "Experiment based on Jacobson's SIGCOMM'88 paper:" puts "- s1 uses a 32 pkt's tx. window and Karn's algorithm" puts "- s1 performs slow-start (ss) or not (noss)" puts "- r1 has capacity for 30 packets only" puts "- the 8 hops have capacity for a complete window, but r1 not" puts "" } set tcp1 [$ns_ create-connection TCP/RFC793edu $node_(s1) \ TCPSink $node_(d1) 1] set ftp1 [$tcp1 attach-app FTP] $tcp1 set window_ 32 $tcp1 set packetSize_ 512 $tcp1 set add793karnrtt_ true $tcp1 set add793expbackoff_ true if {$tcptype == "jacobson88-ss"} { $tcp1 set add793slowstart_ true } $ns_ at 0.0 "$ftp1 start" #$self traceQueues $node_(r1) [$self openTrace 10.0 $testName_] $ns_ at 10.0 "$self cleanupAll $testName_" } #$self tcpDump $tcp1 1.0 $ns_ run}TestSuite instproc plotseqn { tcp interval} { $self instvar trace_ ns_ set now [$ns_ now] puts $trace_(seqn) "$now [$tcp set seqno_]" $ns_ at [expr $now+$interval] "$self plotseqn $tcp $interval"}TestSuite instproc plotrto { tcp interval} { $self instvar trace_ ns_ set now [$ns_ now] puts $trace_(rto) "$now [expr [$tcp set tcpTick_] *[$tcp set rto_]]" puts $trace_(rtt) "$now [expr [$tcp set tcpTick_] *[$tcp set rtt_]]" $ns_ at [expr $now+$interval] "$self plotrto $tcp $interval"}TestSuite instproc plotsrtt { tcp interval} { $self instvar trace_ ns_ set now [$ns_ now] puts $trace_(srtt) "$now [expr [$tcp set tcpTick_] * ( [$tcp set srtt_] >> [$tcp set T_SRTT_BITS])]" $ns_ at [expr $now+$interval] "$self plotsrtt $tcp $interval"}# Definition of test-suite tests########## Jacobson/RFC793 RTTClass Test/rtt-jacobson -superclass TestSuiteTest/rtt-jacobson instproc init {} { $self instvar net_ test_ set net_ net5 set test_ rtt-jacobson $self next}Test/rtt-jacobson instproc run {} { $self setup rtt-jacobson {}}Class Test/rtt-rfc793 -superclass TestSuiteTest/rtt-rfc793 instproc init {} { $self instvar net_ test_ set net_ net5 set test_ rtt-rfc793 $self next}Test/rtt-rfc793 instproc run {} { $self setup rtt-rfc793 {}} ########## Arrival rate with/without fast rtxClass Test/seqno-nofastrtx -superclass TestSuite Test/seqno-nofastrtx instproc init {} { $self instvar net_ test_ set net_ net6 set test_ seqno-nofastrtx $self next}Test/seqno-nofastrtx instproc run {} { $self setup seqno-nofastrtx {}}Class Test/seqno-fastrtx -superclass TestSuiteTest/seqno-fastrtx instproc init {} { $self instvar net_ test_ set net_ net6 set test_ seqno-fastrtx $self next}Test/seqno-fastrtx instproc run {} { $self setup seqno-fastrtx {}}#### Karn Algorithm (RTT sampling + exp. backoff)Class Test/rto-karn -superclass TestSuiteTest/rto-karn instproc init {} { $self instvar net_ test_ set net_ net7 set test_ rto-karn $self next}Test/rto-karn instproc run {} { $self setup rto-karn {}}Class Test/rto-nokarn -superclass TestSuiteTest/rto-nokarn instproc init {} { $self instvar net_ test_ set net_ net7 set test_ rto-nokarn $self next}Test/rto-nokarn instproc run {} { $self setup rto-nokarn {}}########## Jacobson's SIGCOMM' 88 Class Test/jacobson88-noss -superclass TestSuiteTest/jacobson88-noss instproc init {} { $self instvar net_ test_ set net_ net8 set test_ jacobson88-noss $self next}Test/jacobson88-noss instproc run {} { $self setup jacobson88-noss {}}Class Test/jacobson88-ss -superclass TestSuiteTest/jacobson88-ss instproc init {} { $self instvar net_ test_ set net_ net8 set test_ jacobson88-ss $self next}Test/jacobson88-ss instproc run {} { $self setup jacobson88-ss {}}###TestSuite runTest
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -