📄 test-suite-tcp-init-win.tcl
字号:
set em [new ErrorModule Fid] set errmodel [new ErrorModel/Periodic] $errmodel unit pkt $errmodel set offset_ n $errmodel set period_ 1000.0 $link errormodule $em $em insert $errmodel $em bind $errmodel $flow}Test/reno3 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set syn_ true Agent/TCP set delay_growth_ true Agent/TCP set windowInitOption_ 2 set tcp1 [$self make_tcp s1 k1 0 Reno] $tcp1 set packetSize_ 1000 $self drop_pkt [$ns_ link $node_(r1) $node_(k1)] 0 1 $self runall_test $tcp1 10.0 10.0 }Class Test/reno4 -superclass TestSuiteTest/reno4 instproc init {} { $self instvar net_ test_ set net_ net7 set test_ reno4(fast_retransmit) Queue/RED set ns1_compat_ true $self next}Test/reno4 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set packetSize_ 1000 Agent/TCP set windowInitOption_ 2 Agent/TCP set syn_ true Agent/TCP set delay_growth_ true set tcp1 [$self make_tcp s1 k1 0 Reno] set tcp2 [$self make_tcp s2 k1 1 Reno] $self second_test $tcp1 $tcp2}Class Test/newreno1 -superclass TestSuiteTest/newreno1 instproc init {} { $self instvar net_ test_ set net_ net6 set test_ newreno1(variable_packet_sizes) $self next}Test/newreno1 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set syn_ true Agent/TCP set delay_growth_ true Agent/TCP set windowInitOption_ 2 set tcp1 [$self make_tcp s1 k1 0 Newreno] $tcp1 set packetSize_ 1000 set tcp2 [$self make_tcp s2 k1 1 Newreno] $tcp2 set packetSize_ 1500 set tcp3 [$self make_tcp s2 k1 2 Newreno] $tcp3 set packetSize_ 2500 $self run_test $tcp1 $tcp2 $tcp3 1.0 1.0 16}Class Test/newreno2 -superclass TestSuiteTest/newreno2 instproc init {} { $self instvar net_ test_ set net_ net6 set test_ newreno2(static_initial_windows) $self next}Test/newreno2 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo set tcp1 [$self make_tcp s1 k1 0 Newreno] $tcp1 set windowInit_ 6 set tcp2 [$self make_tcp s2 k1 1 Newreno] $tcp2 set syn_ true $tcp2 set delay_growth_ true set tcp3 [$self make_tcp s2 k1 2 Newreno] $tcp3 set windowInit_ 6 $tcp3 set syn_ true $tcp3 set delay_growth_ true $self run_test $tcp1 $tcp2 $tcp3 1.0 1.0 16}Class Test/newreno3 -superclass TestSuiteTest/newreno3 instproc init {} { $self instvar net_ test_ set net_ net6 set test_ newreno3(dropped_syn) $self next}## Drop the n-th packet for flow on link.TestSuite instproc drop_pkt { link flow n } { set em [new ErrorModule Fid] set errmodel [new ErrorModel/Periodic] $errmodel unit pkt $errmodel set offset_ n $errmodel set period_ 1000.0 $link errormodule $em $em insert $errmodel $em bind $errmodel $flow}Test/newreno3 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set syn_ true Agent/TCP set delay_growth_ true Agent/TCP set windowInitOption_ 2 set tcp1 [$self make_tcp s1 k1 0 Newreno] $tcp1 set packetSize_ 1000 $self drop_pkt [$ns_ link $node_(r1) $node_(k1)] 0 1 $self runall_test $tcp1 10.0 10.0 }Class Test/newreno4 -superclass TestSuiteTest/newreno4 instproc init {} { $self instvar net_ test_ set net_ net7 set test_ newreno4(fast_retransmit) Queue/RED set ns1_compat_ true $self next}Test/newreno4 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set packetSize_ 1000 Agent/TCP set windowInitOption_ 2 Agent/TCP set syn_ true Agent/TCP set delay_growth_ true set tcp1 [$self make_tcp s1 k1 0 Newreno] set tcp2 [$self make_tcp s2 k1 1 Newreno] $self second_test $tcp1 $tcp2}Class Test/sack1 -superclass TestSuiteTest/sack1 instproc init {} { $self instvar net_ test_ set net_ net6 set test_ sack1(variable_packet_sizes) $self next}Test/sack1 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set syn_ true Agent/TCP set delay_growth_ true Agent/TCP set windowInitOption_ 2 set tcp1 [$self make_tcp s1 k1 0 Sack] $tcp1 set packetSize_ 1000 set tcp2 [$self make_tcp s2 k1 1 Sack] $tcp2 set packetSize_ 1500 set tcp3 [$self make_tcp s2 k1 2 Sack] $tcp3 set packetSize_ 2500 $self run_test $tcp1 $tcp2 $tcp3 1.0 1.0 16}Class Test/sack2 -superclass TestSuiteTest/sack2 instproc init {} { $self instvar net_ test_ set net_ net6 set test_ sack2(static_initial_windows) $self next}Test/sack2 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo set tcp1 [$self make_tcp s1 k1 0 Sack] $tcp1 set windowInit_ 6 set tcp2 [$self make_tcp s2 k1 1 Sack] $tcp2 set syn_ true $tcp2 set delay_growth_ true set tcp3 [$self make_tcp s2 k1 2 Sack] $tcp3 set windowInit_ 6 $tcp3 set syn_ true $tcp3 set delay_growth_ true $self run_test $tcp1 $tcp2 $tcp3 1.0 1.0 16}Class Test/sack3 -superclass TestSuiteTest/sack3 instproc init {} { $self instvar net_ test_ set net_ net6 set test_ sack3(dropped_syn) $self next}## Drop the n-th packet for flow on link.TestSuite instproc drop_pkt { link flow n } { set em [new ErrorModule Fid] set errmodel [new ErrorModel/Periodic] $errmodel unit pkt $errmodel set offset_ n $errmodel set period_ 1000.0 $link errormodule $em $em insert $errmodel $em bind $errmodel $flow}Test/sack3 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set syn_ true Agent/TCP set delay_growth_ true Agent/TCP set windowInitOption_ 2 set tcp1 [$self make_tcp s1 k1 0 Sack] $tcp1 set packetSize_ 1000 $self drop_pkt [$ns_ link $node_(r1) $node_(k1)] 0 1 $self runall_test $tcp1 10.0 10.0 }Class Test/sack4 -superclass TestSuiteTest/sack4 instproc init {} { $self instvar net_ test_ set net_ net7 set test_ sack4(fast_retransmit) Queue/RED set ns1_compat_ true $self next}Test/sack4 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set packetSize_ 1000 Agent/TCP set windowInitOption_ 2 Agent/TCP set syn_ true Agent/TCP set delay_growth_ true set tcp1 [$self make_tcp s1 k1 0 Sack] set tcp2 [$self make_tcp s2 k1 1 Sack] $self second_test $tcp1 $tcp2}TestSuite instproc printtimers { tcp time} { global quiet if {$quiet == "false"} { set srtt [expr [$tcp set srtt_]/8 ] set rttvar [expr [$tcp set rttvar_]/4 ] set rto [expr $srtt + 2 * $rttvar ] puts "time: $time sRTT(in ticks): $srtt RTTvar(in ticks): $rttvar sRTT+2*RTTvar: $rto backoff: [$tcp set backoff_]" }}TestSuite instproc printtimersAll { tcp time interval } { $self instvar dump_inst_ ns_ if ![info exists dump_inst_($tcp)] { set dump_inst_($tcp) 1 $ns_ at $time "$self printtimersAll $tcp $time $interval" return } set newTime [expr [$ns_ now] + $interval] $ns_ at $time "$self printtimers $tcp $time" $ns_ at $newTime "$self printtimersAll $tcp $newTime $interval"}# This test shows the packets and acknowledgements at the source,# for a path with a 9.6Kbps link, and 1000-byte packets.Class Test/slowLink -superclass TestSuiteTest/slowLink instproc init {} { global plotacks $self instvar net_ test_ set net_ net8 set test_ slowLink(9.6K-link,1000-byte-pkt) set plotacks true $self next}Test/slowLink instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set syn_ true Agent/TCP set delay_growth_ true Agent/TCP set windowInitOption_ 2 Agent/TCP set minrto_ 1 set tcp1 [$self make_tcp s1 k1 0 Sack] $tcp1 set packetSize_ 1000 $ns_ at 0.0 "$self printtimersAll $tcp1 0 1" $self runall_test $tcp1 30.0 30.0 }# # This test shows the packets and acknowledgements at the source,# # for a path with a 9.6Kbps link, and 1000-byte packets.# Class Test/slowLinkDelayAck -superclass TestSuite# Test/slowLinkDelayAck instproc init {} {# global plotacks# $self instvar net_ test_ # set net_ net8# set test_ slowLinkDelayAck(9.6K-link,1000-byte-pkt)# set plotacks true# $self next# }# # Test/slowLinkDelayAck instproc run {} {# $self instvar ns_ node_ testName_ # $self setTopo# Agent/TCP set syn_ true# Agent/TCP set delay_growth_ true# Agent/TCP set windowInitOption_ 2# Agent/TCP set minrto_ 1# set tcp1 [$self make_tcp s1 k1 0 SackDelAck]# $tcp1 set packetSize_ 1000# $ns_ at 0.0 "$self printtimersAll $tcp1 0 1"# $self runall_test $tcp1 30.0 30.0 # }# This test shows the packets and acknowledgements at the source,# for a path with a 9.6Kbps link, and 1500-byte packets.Class Test/slowLink1 -superclass TestSuiteTest/slowLink1 instproc init {} { global plotacks $self instvar net_ test_ set net_ net8 set test_ slowLink1(9.6K-link,1500-byte-pkt) set plotacks true $self next}Test/slowLink1 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set syn_ true Agent/TCP set delay_growth_ true Agent/TCP set windowInitOption_ 2 Agent/TCP set minrto_ 1 set tcp1 [$self make_tcp s1 k1 0 Sack] $tcp1 set packetSize_ 1500 $self runall_test $tcp1 30.0 30.0 }# This test shows the packets and acknowledgements at the source,# for a path with a 9.6Kbps link, and 1500-byte packets.# Initial window of one packet.Class Test/slowLink2 -superclass TestSuiteTest/slowLink2 instproc init {} { global plotacks $self instvar net_ test_ set net_ net8 set test_ slowLink2(9.6K-link,1500-byte-pkt) set plotacks true $self next}Test/slowLink2 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set syn_ true Agent/TCP set delay_growth_ true Agent/TCP set windowInitOption_ 1 Agent/TCP set minrto_ 1 set tcp1 [$self make_tcp s1 k1 0 Sack] $tcp1 set packetSize_ 1500 $self runall_test $tcp1 30.0 30.0 }# time 1.1: RTO, pkt 1 retransmitted, slow-start entered.# time 1.4: ACK arrives for (first) pkt 1, pkts 2 and 3 transmitted.# time 2.4: RTO, pkt 2 retransmitted, slow-start entered.# time 2.6: ACK arrives for (second) pkt 1. # time 3.7: RTO, pkt 2 retransmitted, slow-start entered.# time 3.9: ACK arrives for (first) pkt 2, pkt 3 retransmitted, pkt 4# transmitted# time 5.2: ACK arrives for (first) pkt 3, pkt 5 transmitted.TestSuite runTest### Local Variables:### mode: tcl### tcl-indent-level: 8### tcl-default-application: ns### End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -