test-suite-tcp-init-win.tcl
来自「一款用来进行网络模拟的软件」· TCL 代码 · 共 798 行 · 第 1/2 页
TCL
798 行
Test/newreno1 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo 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_ guide_ set net_ net6 set test_ newreno2(static_initial_windows) set guide_ "NewReno TCP, static initial windows." $self next pktTraceFile}Test/newreno2 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo set tcp1 [$self make_tcp s1 k1 0 Newreno] $tcp1 set windowInit_ 6 $tcp1 set syn_ false $tcp1 set delay_growth_ false 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_ guide_ set net_ net6 set test_ newreno3(dropped_syn) set guide_ "NewReno TCP, initial window after a dropped SYN packet." $self next pktTraceFile}Test/newreno3 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo 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_ guide_ set net_ net7 set test_ newreno4(fast_retransmit) set guide_ "NewReno TCP, window after a Fast Retransmit." Queue/RED set ns1_compat_ true $self next pktTraceFile}Test/newreno4 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set packetSize_ 1000 Agent/TCP set windowInitOption_ 2 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_ guide_ set net_ net6 set test_ sack1(variable_packet_sizes) set guide_ "Sack TCP, initial windows with different packet sizes." $self next pktTraceFile}Test/sack1 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo 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_ guide_ set net_ net6 set test_ sack2(static_initial_windows) set guide_ "Sack TCP, static initial windows." $self next pktTraceFile}Test/sack2 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo set tcp1 [$self make_tcp s1 k1 0 Sack] $tcp1 set windowInit_ 6 $tcp1 set syn_ false $tcp1 set delay_growth_ false 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_ guide_ set net_ net6 set test_ sack3(dropped_syn) set guide_ "Sack TCP, initial window after a dropped SYN packet." $self next pktTraceFile}Test/sack3 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo 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_ guide_ set net_ net7 set test_ sack4(fast_retransmit) set guide_ "Sack TCP, window after a Fast Retransmit." Queue/RED set ns1_compat_ true $self next pktTraceFile}Test/sack4 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set packetSize_ 1000 Agent/TCP set windowInitOption_ 2 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_ guide_ set net_ net8 set test_ slowLink(9.6K-link,1000-byte-pkt) set guide_ "Slow link, with statistics for sRTT, RTTvar, backoff" set plotacks true $self next pktTraceFile}Test/slowLink instproc run {} { $self instvar ns_ node_ testName_ $self setTopo 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_ guide_ # set net_ net8# set test_ slowLinkDelayAck(9.6K-link,1000-byte-pkt)# set plotacks true# $self next pktTraceFile# }# # Test/slowLinkDelayAck instproc run {} {# $self instvar ns_ node_ testName_ # $self setTopo# 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_ guide_ set net_ net8 set test_ slowLink1(9.6K-link,1500-byte-pkt) set guide_ "Slow link, with larger packets and a smaller initial window." set plotacks true $self next pktTraceFile}Test/slowLink1 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo 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_ guide_ set net_ net8 set test_ slowLink2(9.6K-link,1500-byte-pkt) set guide_ "Slow link, with an initial window of two packets." set plotacks true $self next pktTraceFile}Test/slowLink2 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo 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.Class Test/droppedSYN -superclass TestSuiteTest/droppedSYN instproc init {} { $self instvar net_ test_ guide_ set net_ net6 set test_ droppedSYN set guide_ "NewReno TCP before bugfix_ss_, dropped SYN packet." ## static initial window of four packets Agent/TCP set bugfix_ss_ 0 Agent/TCP set windowInit_ 4 $self next pktTraceFile}Test/droppedSYN instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set windowInitOption_ 1 set tcp1 [$self make_tcp s1 k1 0 Newreno] $self drop_pkt [$ns_ link $node_(r1) $node_(k1)] 0 1 $self runall_test $tcp1 5.0 5.0 }Class Test/droppedSYN1 -superclass TestSuiteTest/droppedSYN1 instproc init {} { $self instvar net_ test_ guide_ set net_ net6 set test_ droppedSYN(bugfix_ss_) set guide_ "NewReno TCP, dropped SYN packet." ## static initial window of four packets Agent/TCP set bugfix_ss_ 1 Agent/TCP set windowInit_ 4 Test/droppedSYN1 instproc run {} [Test/droppedSYN info instbody run ] $self next pktTraceFile}Class Test/droppedPKT -superclass TestSuiteTest/droppedPKT instproc init {} { $self instvar net_ test_ guide_ set net_ net6 set test_ droppedPKT(Newreno) set guide_ "NewReno TCP without bugfix_ss_, dropped initial data packet." ## static initial window of four packets Agent/TCP set bugfix_ss_ 0 Agent/TCP set windowInit_ 4 $self next pktTraceFile}Test/droppedPKT instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set windowInitOption_ 1 set tcp1 [$self make_tcp s1 k1 0 Newreno] $self drop_pkt [$ns_ link $node_(r1) $node_(k1)] 0 2 $self runall_test $tcp1 5.0 5.0 }Class Test/droppedPKT1 -superclass TestSuiteTest/droppedPKT1 instproc init {} { $self instvar net_ test_ guide_ set net_ net6 set test_ droppedPKT(NewReno,bugfix_ss_) set guide_ "NewReno TCP, dropped initial data packet." ## static initial window of four packets Agent/TCP set bugfix_ss_ 1 Agent/TCP set windowInit_ 4 Test/droppedPKT1 instproc run {} [Test/droppedPKT info instbody run ] $self next pktTraceFile}Class Test/droppedPKT2 -superclass TestSuiteTest/droppedPKT2 instproc init {} { $self instvar net_ test_ guide_ set net_ net6 set test_ droppedPKT2(Sack) set guide_ "Sack TCP without bugfix_ss_, dropped initial data packet." ## static initial window of four packets Agent/TCP set bugfix_ss_ 0 Agent/TCP set windowInit_ 4 $self next pktTraceFile}Test/droppedPKT2 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set windowInitOption_ 1 set tcp1 [$self make_tcp s1 k1 0 Sack] $self drop_pkt [$ns_ link $node_(r1) $node_(k1)] 0 2 $self runall_test $tcp1 5.0 5.0 }Class Test/droppedPKT3 -superclass TestSuiteTest/droppedPKT3 instproc init {} { $self instvar net_ test_ guide_ set net_ net6 set test_ droppedPKT3(Sack,bugfix_ss_) set guide_ "Sack TCP, dropped initial data packet." ## static initial window of four packets Agent/TCP set bugfix_ss_ 1 Agent/TCP set windowInit_ 4 Test/droppedPKT3 instproc run {} [Test/droppedPKT2 info instbody run ] $self next pktTraceFile}TestSuite runTest### Local Variables:### mode: tcl### tcl-indent-level: 8### tcl-default-application: ns### End:
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?