test-suite-ecn.tcl
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:70k
源码类别:

通讯编程

开发平台:

Visual C++

  1. #
  2. # Copyright (c) 1995-1997 The Regents of the University of California.
  3. # All rights reserved.
  4. #
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions
  7. # are met:
  8. # 1. Redistributions of source code must retain the above copyright
  9. #    notice, this list of conditions and the following disclaimer.
  10. # 2. Redistributions in binary form must reproduce the above copyright
  11. #    notice, this list of conditions and the following disclaimer in the
  12. #    documentation and/or other materials provided with the distribution.
  13. # 3. All advertising materials mentioning features or use of this software
  14. #    must display the following acknowledgement:
  15. # This product includes software developed by the Computer Systems
  16. # Engineering Group at Lawrence Berkeley Laboratory.
  17. # 4. Neither the name of the University nor of the Laboratory may be used
  18. #    to endorse or promote products derived from this software without
  19. #    specific prior written permission.
  20. #
  21. # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24. # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25. # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27. # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30. # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31. # SUCH DAMAGE.
  32. #
  33. # @(#) $Header: /cvsroot/nsnam/ns-2/tcl/test/test-suite-ecn.tcl,v 1.45 2006/01/25 22:02:05 sallyfloyd Exp $
  34. #
  35. # To run all tests: test-all-ecn
  36. set dir [pwd]
  37. catch "cd tcl/test"
  38. source misc_simple.tcl
  39. remove-all-packet-headers       ; # removes all except common
  40. add-packet-header Flags IP TCP  ; # hdrs reqd for validation test
  41. Agent/TCP set tcpTick_ 0.1
  42. # The default for tcpTick_ is being changed to reflect a changing reality.
  43. Agent/TCP set rfc2988_ false
  44. # The default for rfc2988_ is being changed to true.
  45. # FOR UPDATING GLOBAL DEFAULTS:
  46. Agent/TCP set precisionReduce_ false ;   # default changed on 2006/1/24.
  47. Agent/TCP set rtxcur_init_ 6.0 ;      # Default changed on 2006/01/21
  48. Agent/TCP set updated_rttvar_ false ;  # Variable added on 2006/1/21
  49. Queue/RED set bytes_ false              
  50. # default changed on 10/11/2004.
  51. Queue/RED set queue_in_bytes_ false
  52. # default changed on 10/11/2004.
  53. Agent/TCP/Newreno set newreno_changes1_ 0
  54. # The default is being changed to 1 on 5/5/03, to reflect RFC 2582.
  55. Agent/TCP/Newreno set partial_window_deflation_ 0  
  56. # The default is being changed to 1 on 5/5/03, to reflect RFC 2582.
  57. Queue/RED set q_weight_ 0.002
  58. Queue/RED set thresh_ 5 
  59. Queue/RED set maxthresh_ 15
  60. # The RED parameter defaults are being changed for automatic configuration.
  61. Agent/TCP set useHeaders_ false
  62. # The default is being changed to useHeaders_ true.
  63. Agent/TCP set windowInit_ 1
  64. # The default is being changed to 2.
  65. Agent/TCP set singledup_ 0
  66. # The default is being changed to 1
  67. catch "cd $dir"
  68. #Agent/TCP set oldCode_ true
  69. Agent/TCP set minrto_ 0
  70. # The default is being changed to minrto_ 1
  71. Agent/TCP set syn_ false
  72. Agent/TCP set delay_growth_ false
  73. # In preparation for changing the default values for syn_ and delay_growth_.
  74. Agent/TCP set SetCWRonRetransmit_ true
  75. # Changing the default value.
  76. set flowfile fairflow.tr; # file where flow data is written
  77. set flowgraphfile fairflow.xgr; # file given to graph tool 
  78. Class Topology
  79. Topology instproc node? num {
  80.     $self instvar node_
  81.     return $node_($num)
  82. }
  83. Topology instproc makenodes ns {
  84.     $self instvar node_
  85.     set node_(s1) [$ns node]
  86.     set node_(s2) [$ns node]
  87.     set node_(r1) [$ns node]
  88.     set node_(r2) [$ns node]
  89.     set node_(s3) [$ns node]
  90.     set node_(s4) [$ns node]
  91.     set node_(r3) [$ns node]
  92. }
  93. Topology instproc createlinks ns {  
  94.     $self instvar node_
  95.     $ns duplex-link $node_(s1) $node_(r1) 10Mb 2ms DropTail
  96.     $ns duplex-link $node_(s2) $node_(r1) 10Mb 3ms DropTail
  97.     $ns duplex-link $node_(r1) $node_(r2) 1.5Mb 20ms RED
  98.     $ns queue-limit $node_(r1) $node_(r2) 25
  99.     $ns queue-limit $node_(r2) $node_(r1) 25
  100.     $ns duplex-link $node_(s3) $node_(r2) 10Mb 4ms DropTail
  101.     $ns duplex-link $node_(s4) $node_(r2) 10Mb 5ms DropTail
  102.     $ns duplex-link-op $node_(s1) $node_(r1) orient right-down
  103.     $ns duplex-link-op $node_(s2) $node_(r1) orient right-up
  104.     $ns duplex-link-op $node_(r1) $node_(r2) orient right
  105.     $ns duplex-link-op $node_(r1) $node_(r2) queuePos 0
  106.     $ns duplex-link-op $node_(r2) $node_(r1) queuePos 0
  107.     $ns duplex-link-op $node_(s3) $node_(r2) orient left-down
  108.     $ns duplex-link-op $node_(s4) $node_(r2) orient left-up
  109. }
  110. Topology instproc createlinks3 ns {  
  111.     $self instvar node_
  112.     $ns duplex-link $node_(s1) $node_(r1) 10Mb 2ms DropTail
  113.     $ns duplex-link $node_(s2) $node_(r1) 10Mb 3ms DropTail
  114.     $ns duplex-link $node_(r1) $node_(r2) 1.5Mb 20ms RED
  115.     $ns queue-limit $node_(r1) $node_(r2) 25
  116.     $ns queue-limit $node_(r2) $node_(r1) 25
  117.     $ns duplex-link $node_(r2) $node_(r3) 100Mb 0ms RED
  118.     $ns queue-limit $node_(r2) $node_(r3) 100
  119.     $ns queue-limit $node_(r3) $node_(r2) 100
  120.     $ns duplex-link $node_(s3) $node_(r3) 10Mb 4ms DropTail
  121.     $ns duplex-link $node_(s4) $node_(r3) 10Mb 5ms DropTail
  122.     $ns duplex-link-op $node_(s1) $node_(r1) orient right-down
  123.     $ns duplex-link-op $node_(s2) $node_(r1) orient right-up
  124.     $ns duplex-link-op $node_(r1) $node_(r2) orient right
  125.     $ns duplex-link-op $node_(r1) $node_(r2) queuePos 0
  126.     $ns duplex-link-op $node_(r2) $node_(r1) queuePos 0
  127.     $ns duplex-link-op $node_(r2) $node_(r3) queuePos 0
  128.     $ns duplex-link-op $node_(r3) $node_(r2) queuePos 0
  129.     $ns duplex-link-op $node_(s3) $node_(r3) orient left-down
  130.     $ns duplex-link-op $node_(s4) $node_(r3) orient left-up
  131. }
  132. Class Topology/net2 -superclass Topology
  133. Topology/net2 instproc init ns {
  134.     $self instvar node_
  135.     $self makenodes $ns
  136.     $self createlinks $ns
  137. }
  138. Class Topology/net2-lossy -superclass Topology
  139. Topology/net2-lossy instproc init ns {
  140.     $self instvar node_
  141.     $self makenodes $ns
  142.     $self createlinks $ns
  143.  
  144.     $self instvar lossylink_
  145.     set lossylink_ [$ns link $node_(r1) $node_(r2)]
  146.     set em [new ErrorModule Fid]
  147.     set errmodel [new ErrorModel/Periodic]
  148.     $errmodel unit pkt
  149.     $lossylink_ errormodule $em
  150.     $em insert $errmodel
  151.     $em bind $errmodel 0
  152.     $em default pass
  153. Class Topology/net3-lossy -superclass Topology
  154. Topology/net3-lossy instproc init ns {
  155.     $self instvar node_
  156.     $self makenodes $ns
  157.     $self createlinks3 $ns
  158.  
  159.     $self instvar lossylink_
  160.     set lossylink_ [$ns link $node_(r1) $node_(r2)]
  161.     set em [new ErrorModule Fid]
  162.     set errmodel [new ErrorModel/Periodic]
  163.     $errmodel unit pkt
  164.     $lossylink_ errormodule $em
  165.     $em insert $errmodel
  166.     $em bind $errmodel 0
  167.     $em default pass
  168.     $self instvar lossylink1_
  169.     set lossylink1_ [$ns link $node_(r2) $node_(r3)]
  170.     set em [new ErrorModule Fid]
  171.     set errmodel [new ErrorModel/Periodic]
  172.     $errmodel unit pkt
  173.     $lossylink1_ errormodule $em
  174.     $em insert $errmodel
  175.     $em bind $errmodel 0
  176.     $em default pass
  177. TestSuite instproc finish file {
  178. global quiet PERL
  179. $self instvar ns_ tchan_ testName_ cwnd_chan_
  180.         exec $PERL ../../bin/getrc -s 2 -d 3 all.tr | 
  181.    $PERL ../../bin/raw2xg -a -e -s 0.01 -m 90 -t $file > temp.rands
  182. exec $PERL ../../bin/getrc -s 3 -d 2 all.tr | 
  183.   $PERL ../../bin/raw2xg -a -e -s 0.01 -m 90 -t $file > temp1.rands
  184. if {$quiet == "false"} {
  185. exec xgraph -bb -tk -nl -m -x time -y packets temp.rands &
  186. # The line below plots both data and ack packets.
  187. #         exec xgraph -bb -tk -nl -m -x time -y packets temp.rands 
  188. #                     temp1.rands &
  189. }
  190.         ## now use default graphing tool to make a data file
  191.         ## if so desired
  192. if { [info exists tchan_] && $quiet == "false" } {
  193. $self plotQueue $testName_
  194. }
  195. if { [info exists cwnd_chan_] && $quiet == "false" } {
  196. $self plot_cwnd 
  197. }
  198. $ns_ halt
  199. }
  200. TestSuite instproc enable_tracequeue ns {
  201. $self instvar tchan_ node_
  202. set redq [[$ns link $node_(r1) $node_(r2)] queue]
  203. set tchan_ [open all.q w]
  204. $redq trace curq_
  205. $redq trace ave_
  206. $redq attach $tchan_
  207. }
  208. TestSuite instproc plotQueue file {
  209. global quiet
  210. $self instvar tchan_
  211. #
  212. # Plot the queue size and average queue size, for RED gateways.
  213. #
  214. set awkCode {
  215. {
  216. if ($1 == "Q" && NF>2) {
  217. print $2, $3 >> "temp.q";
  218. set end $2
  219. }
  220. else if ($1 == "a" && NF>2)
  221. print $2, $3 >> "temp.a";
  222. }
  223. }
  224. set f [open temp.queue w]
  225. puts $f "TitleText: $file"
  226. puts $f "Device: Postscript"
  227. if { [info exists tchan_] } {
  228. close $tchan_
  229. }
  230. exec rm -f temp.q temp.a 
  231. exec touch temp.a temp.q
  232. exec awk $awkCode all.q
  233. puts $f "queue
  234. exec cat temp.q >@ $f  
  235. puts $f n"ave_queue
  236. exec cat temp.a >@ $f
  237. ###puts $f n"thresh
  238. ###puts $f 0 [[ns link $r1 $r2] get thresh]
  239. ###puts $f $end [[ns link $r1 $r2] get thresh]
  240. close $f
  241. if {$quiet == "false"} {
  242. exec xgraph -bb -tk -x time -y queue temp.queue &
  243. }
  244. }
  245. TestSuite instproc tcpDumpAll { tcpSrc interval label } {
  246.     global quiet
  247.     $self instvar dump_inst_ ns_
  248.     if ![info exists dump_inst_($tcpSrc)] {
  249. set dump_inst_($tcpSrc) 1
  250. set report $label/window=[$tcpSrc set window_]/packetSize=[$tcpSrc set packetSize_]
  251. if {$quiet == "false"} {
  252. puts $report
  253. }
  254. $ns_ at 0.0 "$self tcpDumpAll $tcpSrc $interval $label"
  255. return
  256.     }
  257.     $ns_ at [expr [$ns_ now] + $interval] "$self tcpDumpAll $tcpSrc $interval $label"
  258.     set report time=[$ns_ now]/class=$label/ack=[$tcpSrc set ack_]/packets_resent=[$tcpSrc set nrexmitpack_]
  259.     if {$quiet == "false"} {
  260.      puts $report
  261.     }
  262. }       
  263. TestSuite instproc emod {} {
  264. $self instvar topo_
  265. $topo_ instvar lossylink_ 
  266.         set errmodule [$lossylink_ errormodule]
  267. return $errmodule
  268. }
  269. TestSuite instproc emod2 {} {
  270. $self instvar topo_
  271. $topo_ instvar lossylink1_ 
  272.         set errmodule [$lossylink1_ errormodule]
  273. return $errmodule
  274. }
  275. TestSuite instproc setloss {} {
  276. $self instvar topo_
  277. $topo_ instvar lossylink_
  278.         set errmodule [$lossylink_ errormodule]
  279.         set errmodel [$errmodule errormodels]
  280.         if { [llength $errmodel] > 1 } {
  281.                 puts "droppedfin: confused by >1 err models..abort"
  282.                 exit 1
  283.         }
  284. return $errmodel
  285. }
  286. Class Test/ecn -superclass TestSuite
  287. Test/ecn instproc init {} {
  288.     $self instvar net_ test_ guide_
  289.     Queue/RED set setbit_ true
  290.     set net_ net2
  291.     set test_ ecn
  292.     set guide_ "Two connections using ECN."
  293.     $self next pktTraceFile
  294. }
  295. Test/ecn instproc run {} {
  296.     global quiet
  297.     $self instvar ns_ node_ testName_ guide_
  298.     puts "Guide: $guide_"
  299.     $self setTopo 
  300.     Agent/TCP set old_ecn_ 1
  301.     set stoptime 10.0
  302.     set redq [[$ns_ link $node_(r1) $node_(r2)] queue]
  303.     $redq set setbit_ true
  304.     set tcp1 [$ns_ create-connection TCP/Reno $node_(s1) TCPSink $node_(s3) 0]
  305.     $tcp1 set window_ 15
  306.     $tcp1 set ecn_ 1
  307.     set tcp2 [$ns_ create-connection TCP/Reno $node_(s2) TCPSink $node_(s3) 1]
  308.     $tcp2 set window_ 15
  309.     $tcp2 set ecn_ 1
  310.         
  311.     set ftp1 [$tcp1 attach-app FTP]
  312.     set ftp2 [$tcp2 attach-app FTP]
  313.         
  314.     $self enable_tracequeue $ns_
  315.     $ns_ at 0.0 "$ftp1 start"
  316.     $ns_ at 3.0 "$ftp2 start"
  317.         
  318.     $self tcpDump $tcp1 5.0
  319.         
  320.     # trace only the bottleneck link
  321.     #$self traceQueues $node_(r1) [$self openTrace $stoptime $testName_]
  322.     $ns_ at $stoptime "$self cleanupAll $testName_" 
  323.         
  324.     $ns_ run
  325. }
  326. #######################################################################
  327. TestSuite instproc ecnsetup { tcptype {stoptime 3.0} { tcp1fid 0 } { delack 0 }} {
  328.     $self instvar ns_ node_ testName_ net_
  329.     $self setTopo
  330. ##
  331. ##  Agent/TCP set maxburst_ 4
  332. ##
  333.     set delay 10ms
  334.     $ns_ delay $node_(r1) $node_(r2) $delay
  335.     $ns_ delay $node_(r2) $node_(r1) $delay
  336.     set redq [[$ns_ link $node_(r1) $node_(r2)] queue]
  337.     $redq set setbit_ true
  338.     if {$tcptype == "Tahoe" && $delack == 0} {
  339.       set tcp1 [$ns_ create-connection TCP $node_(s1) 
  340.   TCPSink $node_(s3) $tcp1fid]
  341.     } elseif {$tcptype == "Sack1" && $delack == 0} {
  342.       set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s1) 
  343.   TCPSink/Sack1  $node_(s3) $tcp1fid]
  344.     } elseif {$delack == 0} {
  345.       set tcp1 [$ns_ create-connection TCP/$tcptype $node_(s1) 
  346.   TCPSink $node_(s3) $tcp1fid]
  347.     } elseif {$tcptype == "Tahoe" && $delack == 1} {
  348.       set tcp1 [$ns_ create-connection TCP $node_(s1) 
  349.   TCPSink/DelAck $node_(s3) $tcp1fid]
  350.     } elseif {$tcptype == "Sack1" && $delack == 1} {
  351.       set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s1) 
  352.   TCPSink/Sack1/DelAck  $node_(s3) $tcp1fid]
  353.     } else {
  354.       set tcp1 [$ns_ create-connection TCP/$tcptype $node_(s1) 
  355.   TCPSink/DelAck $node_(s3) $tcp1fid]
  356.     } 
  357.     $tcp1 set window_ 30
  358.     $tcp1 set ecn_ 1
  359.     set ftp1 [$tcp1 attach-app FTP]
  360.     $self enable_tracecwnd $ns_ $tcp1
  361.         
  362.     #$self enable_tracequeue $ns_
  363.     $ns_ at 0.0 "$ftp1 start"
  364.         
  365.     $self tcpDump $tcp1 5.0
  366.         
  367.     # trace only the bottleneck link
  368.     #$self traceQueues $node_(r1) [$self openTrace $stoptime $testName_]
  369.     $ns_ at $stoptime "$self cleanupAll $testName_" 
  370. }
  371. TestSuite instproc second_tcp { tcptype starttime } {
  372.     $self instvar ns_ node_ 
  373.     if {$tcptype == "Tahoe"} {
  374.       set tcp [$ns_ create-connection TCP $node_(s1) 
  375.  TCPSink $node_(s3) 2]    
  376.     } elseif {$tcptype == "Sack1"} { 
  377.       set tcp [$ns_ create-connection TCP/Sack1 $node_(s1) 
  378.           TCPSink/Sack1  $node_(s3) 2]
  379.     } else {
  380.       set tcp [$ns_ create-connection TCP/$tcptype $node_(s1) 
  381.  TCPSink $node_(s3) 2]
  382.     }
  383.     $tcp set window_ 30
  384.     $tcp set ecn_ 1
  385.     set ftp [$tcp attach-app FTP]
  386.     $ns_ at $starttime "$ftp start"
  387. }
  388. # Drop the specified packet.
  389. TestSuite instproc drop_pkt { number } {
  390.     $self instvar ns_ lossmodel
  391.     set lossmodel [$self setloss]
  392.     $lossmodel set offset_ $number
  393.     $lossmodel set period_ 10000
  394. }
  395. TestSuite instproc drop_pkts pkts {
  396.     $self instvar ns_ errmodel1
  397.     set emod [$self emod]
  398.     set errmodel1 [new ErrorModel/List]
  399.     $errmodel1 droplist $pkts
  400.     $emod insert $errmodel1
  401.     $emod bind $errmodel1 1
  402. }
  403. TestSuite instproc drop_pkts2 pkts {
  404.     $self instvar ns_ errmodel2
  405.     set emod [$self emod2]
  406.     set errmodel2 [new ErrorModel/List]
  407.     $errmodel2 droplist $pkts
  408.     $emod insert $errmodel2
  409.     $emod bind $errmodel2 1
  410. }
  411. #######################################################################
  412. # Tahoe Tests #
  413. #######################################################################
  414. # Plain ECN
  415. Class Test/ecn_nodrop_tahoe -superclass TestSuite
  416. Test/ecn_nodrop_tahoe instproc init {} {
  417.         $self instvar net_ test_ guide_
  418.         Queue/RED set setbit_ true
  419.         set net_ net2-lossy
  420. Agent/TCP set bugFix_ true
  421.         set test_ ecn_nodrop_tahoe
  422.         set guide_ "Tahoe with ECN."
  423.         $self next pktTraceFile
  424. }
  425. Test/ecn_nodrop_tahoe instproc run {} {
  426. global quiet
  427. $self instvar ns_ guide_
  428. puts "Guide: $guide_"
  429. Agent/TCP set old_ecn_ 1
  430. $self ecnsetup Tahoe 3.0 
  431. $self drop_pkt 10000
  432. $ns_ run
  433. }
  434. # Two ECNs close together
  435. Class Test/ecn_twoecn_tahoe -superclass TestSuite
  436. Test/ecn_twoecn_tahoe instproc init {} {
  437.         $self instvar net_ test_ guide_ 
  438.         Queue/RED set setbit_ true
  439.         set net_ net2-lossy
  440. Agent/TCP set bugFix_ true
  441.         set test_ ecn_twoecn_tahoe
  442. set guide_  "Tahoe, two marked packets in one window."
  443.         $self next pktTraceFile
  444. }
  445. Test/ecn_twoecn_tahoe instproc run {} {
  446.         global quiet
  447. $self instvar ns_ lossmodel guide_
  448.         puts "Guide: $guide_"
  449. Agent/TCP set old_ecn_ 1
  450. $self ecnsetup Tahoe 3.0 
  451. $self drop_pkt 243
  452. $lossmodel set markecn_ true
  453. $ns_ run
  454. }
  455. # ECN followed by packet loss.
  456. Class Test/ecn_drop_tahoe -superclass TestSuite
  457. Test/ecn_drop_tahoe instproc init {} {
  458.         $self instvar net_ test_ guide_
  459.         Queue/RED set setbit_ true
  460.         set net_ net2-lossy
  461. Agent/TCP set bugFix_ true
  462.         set test_ ecn_drop_tahoe
  463.         set guide_ "Tahoe, ECN followed by packet loss."
  464.         $self next pktTraceFile
  465. }
  466. Test/ecn_drop_tahoe instproc run {} {
  467.         global quiet
  468. $self instvar ns_ guide_
  469.         puts "Guide: $guide_"
  470. Agent/TCP set old_ecn_ 1
  471. $self ecnsetup Tahoe 3.0
  472. $self drop_pkt 243
  473. $ns_ run
  474. }
  475. # ECN preceded by packet loss.
  476. Class Test/ecn_drop1_tahoe -superclass TestSuite
  477. Test/ecn_drop1_tahoe instproc init {} {
  478.         $self instvar net_ test_ guide_
  479.         Queue/RED set setbit_ true
  480.         set net_ net2-lossy
  481. Agent/TCP set bugFix_ true
  482.         set test_ ecn_drop1_tahoe
  483.         set guide_      "Tahoe, ECN preceded by packet loss."
  484.         $self next pktTraceFile
  485. }
  486. Test/ecn_drop1_tahoe instproc run {} {
  487.         global quiet
  488. $self instvar ns_ guide_
  489.         puts "Guide: $guide_"
  490. Agent/TCP set old_ecn_ 1
  491. $self ecnsetup Tahoe 3.0
  492. $self drop_pkt 241
  493. $ns_ run
  494. }
  495. # ECN preceded by packet loss.
  496. Class Test/ecn_drop2_tahoe -superclass TestSuite
  497. Test/ecn_drop2_tahoe instproc init {} {
  498.         $self instvar net_ test_ guide_
  499.         Queue/RED set setbit_ true
  500.         set net_ net2-lossy
  501. Agent/TCP set bugFix_ true
  502.         set test_ ecn_drop2_tahoe
  503.         set guide_      "Tahoe, ECN preceded by packet loss."
  504.         $self next pktTraceFile
  505. }
  506. Test/ecn_drop2_tahoe instproc run {} {
  507.         global quiet
  508. $self instvar ns_ guide_
  509.         puts "Guide: $guide_"
  510. Agent/TCP set old_ecn_ 1
  511. $self ecnsetup Tahoe 3.0
  512. $self drop_pkt 235
  513. $ns_ run
  514. }
  515. # Packet loss only.
  516. Class Test/ecn_noecn_tahoe -superclass TestSuite
  517. Test/ecn_noecn_tahoe instproc init {} {
  518.         $self instvar net_ test_ guide_
  519.         Queue/RED set setbit_ true
  520. Queue/RED set thresh_ 1000
  521. Queue/RED set maxthresh_ 1000
  522.         set net_ net2-lossy
  523. Agent/TCP set bugFix_ true
  524.         set test_ ecn_noecn_tahoe
  525. Test/ecn_noecn_tahoe instproc run {} [Test/ecn_drop_tahoe info instbody run ]
  526.         set guide_      "Tahoe, packet loss only, no ECN."
  527.         $self next pktTraceFile
  528. }
  529. # Multiple dup acks with bugFix_
  530. Class Test/ecn_bursty_tahoe -superclass TestSuite
  531. Test/ecn_bursty_tahoe instproc init {} {
  532.         $self instvar net_ test_ guide_
  533.         Queue/RED set setbit_ true
  534. Queue/RED set thresh_ 100
  535. Queue/RED set maxthresh_ 100
  536.         set net_ net2-lossy
  537. Agent/TCP set bugFix_ true
  538.         set test_ ecn_bursty_tahoe
  539.         set guide_      "Tahoe, multiple dup acks, with bugFix."
  540.         $self next pktTraceFile
  541. }
  542. Test/ecn_bursty_tahoe instproc run {} {
  543.         global quiet
  544. $self instvar ns_ guide_
  545.         puts "Guide: $guide_"
  546. $self ecnsetup Tahoe 3.0
  547.         set lossmodel [$self setloss]
  548.         $lossmodel set offset_ 245
  549. $lossmodel set burstlen_ 15
  550.         $lossmodel set period_ 10000
  551. $ns_ run
  552. }
  553. # Multiple dup acks following ECN
  554. Class Test/ecn_burstyEcn_tahoe -superclass TestSuite
  555. Test/ecn_burstyEcn_tahoe instproc init {} {
  556.         $self instvar net_ test_ guide_
  557.         Queue/RED set setbit_ true
  558.         set net_ net2-lossy
  559. Agent/TCP set bugFix_ true
  560. Agent/TCP set old_ecn_ 1
  561.         set test_ ecn_burstyEcn_tahoe
  562. Test/ecn_burstyEcn_tahoe instproc run {} [Test/ecn_bursty_tahoe info instbody run ]   
  563.         set guide_      "Tahoe, multiple dup acks and ECN, with bugFix."
  564.         $self next pktTraceFile
  565. }
  566. # Multiple dup acks without bugFix_
  567. Class Test/ecn_noBugfix_tahoe -superclass TestSuite
  568. Test/ecn_noBugfix_tahoe instproc init {} {
  569.         $self instvar net_ test_ guide_
  570. Queue/RED set thresh_ 100 
  571. Queue/RED set maxthresh_ 100
  572.         Queue/RED set setbit_ true
  573.         set net_ net2-lossy
  574. Agent/TCP set bugFix_ false
  575.         set test_ ecn_noBugfix_tahoe
  576. Test/ecn_noBugfix_tahoe instproc run {} [Test/ecn_bursty_tahoe info instbody run ]
  577.         set guide_      "Tahoe, multiple dup acks, no bugFix."
  578.         $self next pktTraceFile
  579. }
  580. # ECN followed by timeout.
  581. Class Test/ecn_timeout_tahoe -superclass TestSuite
  582. Test/ecn_timeout_tahoe instproc init {} {
  583.         $self instvar net_ test_ guide_
  584.         Queue/RED set setbit_ true
  585.         set net_ net2-lossy
  586. Agent/TCP set bugFix_ true
  587.         set test_ ecn_timeout_tahoe
  588.         set guide_      "Tahoe, drops and ECN followed by a timeout."
  589.         $self next pktTraceFile
  590. }
  591. Test/ecn_timeout_tahoe instproc run {} {
  592.         global quiet
  593. $self instvar ns_ guide_
  594.         puts "Guide: $guide_"
  595. $self ecnsetup Tahoe 3.0 1
  596. $self drop_pkts {242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268} 
  597. $ns_ run
  598. }
  599. # Only the timeout.
  600. Class Test/ecn_timeout2_tahoe -superclass TestSuite
  601. Test/ecn_timeout2_tahoe instproc init {} {
  602.         $self instvar net_ test_ guide_
  603.         Queue/RED set setbit_ true
  604. Queue/RED set thresh_ 100
  605. Queue/RED set maxthresh_ 100
  606.         set net_ net2-lossy
  607. Agent/TCP set bugFix_ true
  608.         set test_ ecn_timeout2_tahoe
  609.         set guide_      "Tahoe, drops followed by a timeout, no ECN."
  610.         $self next pktTraceFile
  611. }
  612. Test/ecn_timeout2_tahoe instproc run {} {
  613.         global quiet
  614. $self instvar ns_ guide_
  615.         puts "Guide: $guide_"
  616. $self ecnsetup Tahoe 3.0 1
  617. $self drop_pkts {241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268} 
  618. $ns_ run
  619. }
  620. # The timeout with the ECN in the middle of dropped packets.
  621. Class Test/ecn_timeout3_tahoe -superclass TestSuite
  622. Test/ecn_timeout3_tahoe instproc init {} {
  623.         $self instvar net_ test_ guide_
  624.         Queue/RED set setbit_ true
  625.         set net_ net2-lossy
  626. Agent/TCP set bugFix_ true
  627.         set test_ ecn_timeout3_tahoe
  628.         set guide_      "Tahoe, drops and ECN followed by a timeout."
  629.         $self next pktTraceFile
  630. }
  631. Test/ecn_timeout3_tahoe instproc run {} {
  632.         global quiet
  633. $self instvar ns_ guide_
  634.         puts "Guide: $guide_"
  635. $self ecnsetup Tahoe 3.0 1
  636. $self drop_pkts {241 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270} 
  637. $ns_ run
  638. }
  639. # Packet drops with a window of one packet.
  640. Class Test/ecn_smallwin_tahoe -superclass TestSuite
  641. Test/ecn_smallwin_tahoe instproc init {} {
  642.         $self instvar net_ test_ guide_
  643.         Queue/RED set setbit_ true
  644. Agent/TCP set bugFix_ true
  645. Agent/TCP set timerfix_ false
  646. # The default is being changed to true.
  647.         set net_ net2-lossy
  648.         set test_ ecn_smallwin_tahoe
  649.         set guide_      "Tahoe, packet drops with a window of one."
  650.         $self next pktTraceFile
  651. }
  652. Test/ecn_smallwin_tahoe instproc run {} {
  653.         global quiet
  654. $self instvar ns_ guide_
  655.         puts "Guide: $guide_"
  656. Agent/TCP set old_ecn_ 0
  657. $self ecnsetup Tahoe 6.0 1
  658. $self drop_pkts {4 8 9 10 11 100 115 118 119}
  659. $ns_ run
  660. }
  661. # ECN with a window of one packet.
  662. Class Test/ecn_smallwinEcn_tahoe -superclass TestSuite
  663. Test/ecn_smallwinEcn_tahoe instproc init {} {
  664.         $self instvar net_ test_ guide_ 
  665.         Queue/RED set setbit_ true
  666.         set net_ net2-lossy
  667. Agent/TCP set bugFix_ true
  668. Agent/TCP set timerfix_ false
  669. # The default is being changed to true.
  670.         set test_ ecn_smallwinEcn_tahoe
  671.         set guide_      "Tahoe, ECN with a window of one."
  672.         $self next pktTraceFile
  673. }
  674. Test/ecn_smallwinEcn_tahoe instproc run {} {
  675.         global quiet
  676. $self instvar ns_ guide_ errmodel1
  677.         puts "Guide: $guide_"
  678. Agent/TCP set old_ecn_ 0
  679. $self ecnsetup Tahoe 10.0 1
  680. $self drop_pkts {4 8 9 11 12 13 120 135 143 148 150 151 152 153} 
  681. $errmodel1 set markecn_ true
  682. $ns_ run
  683. }
  684. # ECN, cwnd 4, packet 4 is dropped, and then packet 6 is marked. 
  685. # The retransmit timer expires, packet 4 is retransmitted, and then the
  686. #   ECN bit is set on the retransmitted packet.
  687. # When the ACK for packet 4 comes in, the retransmit timer must not get 
  688. #   cancelled.
  689. Class Test/ecn_smallwin1Ecn_tahoe -superclass TestSuite
  690. Test/ecn_smallwin1Ecn_tahoe instproc init {} {
  691.         $self instvar net_ test_ guide_ 
  692.         Queue/RED set setbit_ true
  693.         set net_ net3-lossy
  694. Agent/TCP set bugFix_ true
  695. Agent/TCP set timerfix_ false
  696. # The default is being changed to true.
  697.         set test_ ecn_smallwin1Ecn_tahoe
  698.         set guide_      "Tahoe, ECN with small windows."
  699.         $self next pktTraceFile
  700. }
  701. Test/ecn_smallwin1Ecn_tahoe instproc run {} {
  702.         global quiet
  703. $self instvar ns_ guide_ errmodel1 errmodel2
  704.         puts "Guide: $guide_"
  705. Agent/TCP set old_ecn_ 0
  706. $self ecnsetup Tahoe 10.0 1
  707. $self drop_pkts {4 8 9 11 12 13 120 135 143 148 150 153} 
  708. $errmodel1 set markecn_ true
  709. $self drop_pkts2 {6}
  710. $errmodel2 set markecn_ false
  711. $ns_ run
  712. }
  713. # ECN with a window of one packet, slow_start_restart_ false.
  714. Class Test/ecn_smallwin2Ecn_tahoe -superclass TestSuite
  715. Test/ecn_smallwin2Ecn_tahoe instproc init {} {
  716.         $self instvar net_ test_ guide_ 
  717.         Queue/RED set setbit_ true
  718.         set net_ net2-lossy
  719. Agent/TCP set bugFix_ true
  720. Agent/TCP set slow_start_restart_ false
  721. Agent/TCP set timerfix_ false
  722. # The default is being changed to true.
  723.         set test_ ecn_smallwin2Ecn_tahoe
  724. Test/ecn_smallwin2Ecn_tahoe instproc run {} [Test/ecn_smallwinEcn_tahoe info instbody run ]
  725.         set guide_      "Tahoe, ECN with a window of one, no slow_start_restart."
  726.         $self next pktTraceFile
  727. }
  728. Class Test/ecn_smallwin3Ecn_tahoe -superclass TestSuite
  729. Test/ecn_smallwin3Ecn_tahoe instproc init {} {
  730.         $self instvar net_ test_ guide_ 
  731.         Queue/RED set setbit_ true
  732.         set net_ net3-lossy
  733. Agent/TCP set bugFix_ true
  734. Agent/TCP set slow_start_restart_ false
  735.         set test_ ecn_smallwin3Ecn_tahoe
  736. Test/ecn_smallwin3Ecn_tahoe instproc run {} [Test/ecn_smallwin1Ecn_tahoe info instbody run ]
  737.         set guide_      "Tahoe, ECN with small windows, no slow_start_restart."
  738.         $self next pktTraceFile
  739. }
  740. # Packet drops for the second packet.
  741. Class Test/ecn_secondpkt_tahoe -superclass TestSuite
  742. Test/ecn_secondpkt_tahoe instproc init {} {
  743.         $self instvar net_ test_ guide_
  744.         Queue/RED set setbit_ true
  745. Agent/TCP set bugFix_ true
  746.         set net_ net2-lossy
  747.         set test_ ecn_secondpkt_tahoe
  748.         set guide_      "Tahoe, with the second packet dropped."
  749.         $self next pktTraceFile
  750. }
  751. Test/ecn_secondpkt_tahoe instproc run {} {
  752.         global quiet
  753. $self instvar ns_ guide_
  754.         puts "Guide: $guide_"
  755. Agent/TCP set old_ecn_ 0
  756. $self ecnsetup Tahoe 2.0 1
  757. $self drop_pkts {1 3} 
  758. $ns_ run
  759. }
  760. # ECN for the second packet.
  761. Class Test/ecn_secondpktEcn_tahoe -superclass TestSuite
  762. Test/ecn_secondpktEcn_tahoe instproc init {} {
  763.         $self instvar net_ test_ guide_ 
  764.         Queue/RED set setbit_ true
  765.         set net_ net2-lossy
  766. Agent/TCP set bugFix_ true
  767.         set test_ ecn_secondpktEcn_tahoe
  768.         set guide_      "Tahoe, with the second packet marked."
  769.         $self next pktTraceFile
  770. }
  771. Test/ecn_secondpktEcn_tahoe instproc run {} {
  772.         global quiet
  773. $self instvar ns_ guide_ errmodel1
  774.         puts "Guide: $guide_"
  775. Agent/TCP set old_ecn_ 0
  776. $self ecnsetup Tahoe 2.0 1
  777. $self drop_pkts {1 3} 
  778. $errmodel1 set markecn_ true
  779. $ns_ run
  780. }
  781. #######################################################################
  782. # Delayed Ack Tahoe Tests #
  783. #######################################################################
  784. # Plain ECN
  785. Class Test/ecn_nodrop_tahoe_delack -superclass TestSuite
  786. Test/ecn_nodrop_tahoe_delack instproc init {} {
  787.         $self instvar net_ test_ guide_
  788.         Queue/RED set setbit_ true
  789.         set net_ net2-lossy
  790. Agent/TCP set bugFix_ true
  791.         set test_ ecn_nodrop_tahoe_delack
  792.         set guide_      "Tahoe with ECN, delayed acks."
  793.         $self next pktTraceFile
  794. }
  795. Test/ecn_nodrop_tahoe_delack instproc run {} {
  796.         global quiet
  797. $self instvar ns_ guide_
  798.         puts "Guide: $guide_"
  799. Agent/TCP set old_ecn_ 1
  800. $self ecnsetup Tahoe 3.0 0 1
  801. $self drop_pkt 10000
  802. $ns_ run
  803. }
  804. # This one doesn't have two ECNs close together..
  805. Class Test/ecn_twoecn_tahoe_delack -superclass TestSuite
  806. Test/ecn_twoecn_tahoe_delack instproc init {} {
  807.         $self instvar net_ test_ guide_ 
  808.         Queue/RED set setbit_ true
  809.         set net_ net2-lossy
  810. Agent/TCP set bugFix_ true
  811.         set test_ ecn_twoecn_tahoe_delack
  812.         set guide_      "Tahoe, ECN, delayed acks."
  813.         $self next pktTraceFile
  814. }
  815. Test/ecn_twoecn_tahoe_delack instproc run {} {
  816.         global quiet
  817. $self instvar ns_ guide_ lossmodel
  818.         puts "Guide: $guide_"
  819. Agent/TCP set old_ecn_ 1
  820. $self ecnsetup Tahoe 3.0 0 1 
  821. $self drop_pkt 243
  822. $lossmodel set markecn_ true
  823. $ns_ run
  824. }
  825. # ECN followed by packet loss?
  826. Class Test/ecn_drop_tahoe_delack -superclass TestSuite
  827. Test/ecn_drop_tahoe_delack instproc init {} {
  828.         $self instvar net_ test_ guide_
  829.         Queue/RED set setbit_ true
  830.         set net_ net2-lossy
  831. Agent/TCP set bugFix_ true
  832.         set test_ ecn_drop_tahoe_delack
  833.         set guide_      "Tahoe, ECN, delayed acks."
  834.         $self next pktTraceFile
  835. }
  836. Test/ecn_drop_tahoe_delack instproc run {} {
  837.         global quiet
  838. $self instvar ns_ guide_
  839.         puts "Guide: $guide_"
  840. Agent/TCP set old_ecn_ 1
  841. $self ecnsetup Tahoe 3.0 0 1
  842. $self drop_pkt 243
  843. $ns_ run
  844. }
  845. # ECN preceded by packet loss?
  846. Class Test/ecn_drop1_tahoe_delack -superclass TestSuite
  847. Test/ecn_drop1_tahoe_delack instproc init {} {
  848.         $self instvar net_ test_ guide_
  849.         Queue/RED set setbit_ true
  850.         set net_ net2-lossy
  851. Agent/TCP set bugFix_ true
  852.         set test_ ecn_drop1_tahoe_delack
  853.         set guide_      "Tahoe, ECN, delayed acks."
  854.         $self next pktTraceFile
  855. }
  856. Test/ecn_drop1_tahoe_delack instproc run {} {
  857.         global quiet
  858. $self instvar ns_ guide_
  859.         puts "Guide: $guide_"
  860. Agent/TCP set old_ecn_ 1
  861. $self ecnsetup Tahoe 3.0 0 1
  862. $self drop_pkt 241
  863. $ns_ run
  864. }
  865. # ECN with a window of one packet.
  866. Class Test/ecn_smallwinEcn_tahoe_delack -superclass TestSuite
  867. Test/ecn_smallwinEcn_tahoe_delack instproc init {} {
  868.         $self instvar net_ test_ guide_ 
  869.         Queue/RED set setbit_ true
  870.         set net_ net2-lossy
  871. Agent/TCP set bugFix_ true
  872. Agent/TCP set timerfix_ false
  873. # The default is being changed to true.
  874.         set test_ ecn_smallwinEcn_tahoe_delack
  875.         set guide_      "Tahoe, ECN with a window of one, delayed acks."
  876.         $self next pktTraceFile
  877. }
  878. Test/ecn_smallwinEcn_tahoe_delack instproc run {} {
  879.         global quiet
  880. $self instvar ns_ guide_ errmodel1
  881.         puts "Guide: $guide_"
  882. Agent/TCP set old_ecn_ 0
  883. $self ecnsetup Tahoe 10.0 1 1
  884. $self drop_pkts {4 8 9 11 12 13 120 135 143 148 150 151 152 153} 
  885. $errmodel1 set markecn_ true
  886. $ns_ run
  887. }
  888. #######################################################################
  889. # Reno Tests #
  890. #######################################################################
  891. # Plain ECN
  892. Class Test/ecn_nodrop_reno -superclass TestSuite
  893. Test/ecn_nodrop_reno instproc init {} {
  894.         $self instvar net_ test_ guide_
  895.         Queue/RED set setbit_ true
  896.         set net_ net2-lossy
  897. Agent/TCP set bugFix_ true
  898.         set test_ ecn_nodrop_reno
  899.   set guide_      "Reno with ECN."  
  900.         $self next pktTraceFile
  901. }
  902. Test/ecn_nodrop_reno instproc run {} {
  903.         global quiet
  904. $self instvar ns_ guide_
  905.         puts "Guide: $guide_"
  906. Agent/TCP set old_ecn_ 1
  907. $self ecnsetup Reno 3.0 
  908. $self drop_pkt 10000
  909. $ns_ run
  910. }
  911. # Two ECNs close together
  912. Class Test/ecn_twoecn_reno -superclass TestSuite
  913. Test/ecn_twoecn_reno instproc init {} {
  914.         $self instvar net_ test_ guide_ 
  915.         Queue/RED set setbit_ true
  916.         set net_ net2-lossy
  917. Agent/TCP set bugFix_ true
  918.         set test_ ecn_twoecn_reno
  919.         set guide_      "Reno, two marked packets in one window."
  920.         $self next pktTraceFile
  921. }
  922. Test/ecn_twoecn_reno instproc run {} {
  923.         global quiet
  924. $self instvar ns_ guide_ lossmodel
  925.         puts "Guide: $guide_"
  926. Agent/TCP set old_ecn_ 1
  927. $self ecnsetup Reno 3.0 
  928. $self drop_pkt 243
  929. $lossmodel set markecn_ true
  930. $ns_ run
  931. }
  932. # ECN followed by packet loss.
  933. Class Test/ecn_drop_reno -superclass TestSuite
  934. Test/ecn_drop_reno instproc init {} {
  935.         $self instvar net_ test_ guide_
  936.         Queue/RED set setbit_ true
  937.         set net_ net2-lossy
  938. Agent/TCP set bugFix_ true
  939.         set test_ ecn_drop_reno
  940.         set guide_      "Reno, ECN followed by packet loss."
  941.         $self next pktTraceFile
  942. }
  943. Test/ecn_drop_reno instproc run {} {
  944.         global quiet
  945. $self instvar ns_ guide_
  946.         puts "Guide: $guide_"
  947. Agent/TCP set old_ecn_ 1
  948. $self ecnsetup Reno 3.0
  949. $self drop_pkt 243
  950. $ns_ run
  951. }
  952. # ECN preceded by packet loss.
  953. Class Test/ecn_drop1_reno -superclass TestSuite
  954. Test/ecn_drop1_reno instproc init {} {
  955.         $self instvar net_ test_ guide_
  956.         Queue/RED set setbit_ true
  957.         set net_ net2-lossy
  958. Agent/TCP set bugFix_ true
  959.         set test_ ecn_drop1_reno
  960.         set guide_      "Reno, ECN preceded by packet loss."
  961.         $self next pktTraceFile
  962. }
  963. Test/ecn_drop1_reno instproc run {} {
  964.         global quiet
  965. $self instvar ns_ guide_
  966.         puts "Guide: $guide_"
  967. Agent/TCP set old_ecn_ 1
  968. $self ecnsetup Reno 3.0
  969. $self drop_pkt 241
  970. $ns_ run
  971. }
  972. # Packet loss only.
  973. Class Test/ecn_noecn_reno -superclass TestSuite
  974. Test/ecn_noecn_reno instproc init {} {
  975.         $self instvar net_ test_ guide_
  976.         Queue/RED set setbit_ true
  977. Queue/RED set thresh_ 1000
  978. Queue/RED set maxthresh_ 1000
  979.         set net_ net2-lossy
  980. Agent/TCP set bugFix_ true
  981.         set test_ ecn_noecn_reno
  982. Test/ecn_noecn_reno instproc run {} [Test/ecn_drop_reno info instbody run ]
  983.         set guide_      "Reno, packet loss only, no ECN."
  984.         $self next pktTraceFile
  985. }
  986. # Multiple dup acks with bugFix_
  987. Class Test/ecn_bursty_reno -superclass TestSuite
  988. Test/ecn_bursty_reno instproc init {} {
  989.         $self instvar net_ test_ guide_
  990.         Queue/RED set setbit_ true
  991. Queue/RED set thresh_ 100
  992. Queue/RED set maxthresh_ 100
  993.         set net_ net2-lossy
  994. Agent/TCP set bugFix_ true
  995.         set test_ ecn_bursty_reno
  996.         set guide_      "Reno, multiple dup acks, with bugFix."
  997.         $self next pktTraceFile
  998. }
  999. Test/ecn_bursty_reno instproc run {} {
  1000.         global quiet
  1001. $self instvar ns_ guide_
  1002.         puts "Guide: $guide_"
  1003. $self ecnsetup Reno 3.0
  1004.         set lossmodel [$self setloss]
  1005.         $lossmodel set offset_ 245
  1006. $lossmodel set burstlen_ 15
  1007.         $lossmodel set period_ 10000
  1008. $ns_ run
  1009. }
  1010. # Multiple dup acks following ECN
  1011. Class Test/ecn_burstyEcn_reno -superclass TestSuite
  1012. Test/ecn_burstyEcn_reno instproc init {} {
  1013.         $self instvar net_ test_ guide_
  1014.         Queue/RED set setbit_ true
  1015.         set net_ net2-lossy
  1016. Agent/TCP set bugFix_ true
  1017.         set test_ ecn_burstyEcn_reno
  1018. Test/ecn_burstyEcn_reno instproc run {} [Test/ecn_bursty_reno info instbody run ]   
  1019.         set guide_      "Reno, multiple dup acks and ECN, with bugFix."
  1020.         $self next pktTraceFile
  1021. }
  1022. # Multiple dup acks without bugFix_
  1023. Class Test/ecn_noBugfix_reno -superclass TestSuite
  1024. Test/ecn_noBugfix_reno instproc init {} {
  1025.         $self instvar net_ test_ guide_
  1026. Queue/RED set thresh_ 100 
  1027. Queue/RED set maxthresh_ 100
  1028.         Queue/RED set setbit_ true
  1029.         set net_ net2-lossy
  1030. Agent/TCP set bugFix_ false
  1031.         set test_ ecn_noBugfix_reno
  1032. Test/ecn_noBugfix_reno instproc run {} [Test/ecn_bursty_reno info instbody run ]
  1033.         set guide_      "Reno, multiple dup acks, no bugFix."
  1034.         $self next pktTraceFile
  1035. }
  1036. # ECN followed by timeout?.
  1037. # Nope.
  1038. Class Test/ecn_timeout_reno -superclass TestSuite
  1039. Test/ecn_timeout_reno instproc init {} {
  1040.         $self instvar net_ test_ guide_
  1041.         Queue/RED set setbit_ true
  1042.         set net_ net2-lossy
  1043. Agent/TCP set bugFix_ true
  1044.         set test_ ecn_timeout_reno
  1045.         set guide_      "Reno, drops followed by a timeout, no ECN."
  1046.         $self next pktTraceFile
  1047. }
  1048. Test/ecn_timeout_reno instproc run {} {
  1049.         global quiet
  1050. $self instvar ns_ guide_
  1051.         puts "Guide: $guide_"
  1052. $self ecnsetup Reno 3.0 1
  1053. $self drop_pkts {242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268} 
  1054. $ns_ run
  1055. }
  1056. # ECN followed by a timeout, followed by an ECN representing a
  1057. # new instance of congestion.
  1058. Class Test/ecn_timeout1_reno -superclass TestSuite
  1059. Test/ecn_timeout1_reno instproc init {} {
  1060.         $self instvar net_ test_ guide_
  1061.         Queue/RED set setbit_ true
  1062.         set net_ net2-lossy
  1063. Agent/TCP set bugFix_ true
  1064.         set test_ ecn_timeout1_reno
  1065.         set guide_      "Reno, drops and ECN followed by a timeout."
  1066.         $self next pktTraceFile
  1067. }
  1068. Test/ecn_timeout1_reno instproc run {} {
  1069.         global quiet
  1070. $self instvar ns_ guide_
  1071.         puts "Guide: $guide_"
  1072. Agent/TCP set old_ecn_ 1
  1073. $self ecnsetup Reno 3.0 1
  1074. $self drop_pkts {245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265} 
  1075. $self second_tcp Tahoe 1.0
  1076. $ns_ run
  1077. }
  1078. # Packet drops with a window of one packet.
  1079. Class Test/ecn_smallwin_reno -superclass TestSuite
  1080. Test/ecn_smallwin_reno instproc init {} {
  1081.         $self instvar net_ test_ guide_
  1082.         Queue/RED set setbit_ true
  1083. Agent/TCP set bugFix_ true
  1084.         set net_ net2-lossy
  1085.         set test_ ecn_smallwin_reno
  1086.         set guide_      "Reno, packet drops with a window of one."
  1087.         $self next pktTraceFile
  1088. }
  1089. Test/ecn_smallwin_reno instproc run {} {
  1090.         global quiet
  1091. $self instvar ns_ guide_
  1092.         puts "Guide: $guide_"
  1093. Agent/TCP set old_ecn_ 0
  1094. $self ecnsetup Reno 6.0 1
  1095. $self drop_pkts {4 8 9 10 11 100 115 118 119 121 122}
  1096. $ns_ run
  1097. }
  1098. # ECN with a window of one packet.
  1099. Class Test/ecn_smallwinEcn_reno -superclass TestSuite
  1100. Test/ecn_smallwinEcn_reno instproc init {} {
  1101.         $self instvar net_ test_ guide_ 
  1102.         Queue/RED set setbit_ true
  1103.         set net_ net2-lossy
  1104. Agent/TCP set bugFix_ true
  1105.         set test_ ecn_smallwinEcn_reno
  1106.         set guide_      "Reno, ECN with a window of one."
  1107.         $self next pktTraceFile
  1108. }
  1109. Test/ecn_smallwinEcn_reno instproc run {} {
  1110.         global quiet
  1111. $self instvar ns_ guide_ errmodel1
  1112.         puts "Guide: $guide_"
  1113. Agent/TCP set old_ecn_ 0
  1114. $self ecnsetup Reno 10.0 1
  1115. $self drop_pkts {4 8 9 11 12 13 120 135 143 148 150 151 152 153} 
  1116. $errmodel1 set markecn_ true
  1117. $ns_ run
  1118. }
  1119. Class Test/ecn_smallwin1Ecn_reno -superclass TestSuite
  1120. Test/ecn_smallwin1Ecn_reno instproc init {} {
  1121.         $self instvar net_ test_ guide_ 
  1122.         Queue/RED set setbit_ true
  1123.         set net_ net3-lossy
  1124. Agent/TCP set bugFix_ true
  1125.         set test_ ecn_smallwin1Ecn_reno
  1126.         set guide_      "Reno, ECN with small windows."
  1127.         $self next pktTraceFile
  1128. }
  1129. Test/ecn_smallwin1Ecn_reno instproc run {} {
  1130.         global quiet
  1131. $self instvar ns_ guide_ errmodel1 errmodel2
  1132.         puts "Guide: $guide_"
  1133. Agent/TCP set old_ecn_ 0
  1134. $self ecnsetup Reno 10.0 1
  1135. $self drop_pkts {4 8 9 11 12 13 120 135 143 148 150 153} 
  1136. $errmodel1 set markecn_ true
  1137. $self drop_pkts2 {6}
  1138. $errmodel2 set markecn_ false
  1139. $ns_ run
  1140. }
  1141. # Packet drops for the second packet.
  1142. Class Test/ecn_secondpkt_reno -superclass TestSuite
  1143. Test/ecn_secondpkt_reno instproc init {} {
  1144.         $self instvar net_ test_ guide_
  1145.         Queue/RED set setbit_ true
  1146. Agent/TCP set bugFix_ true
  1147.         set net_ net2-lossy
  1148.         set test_ ecn_secondpkt_reno
  1149.         set guide_      "Reno, with the second packet dropped."
  1150.         $self next pktTraceFile
  1151. }
  1152. Test/ecn_secondpkt_reno instproc run {} {
  1153.         global quiet
  1154. $self instvar ns_ guide_
  1155.         puts "Guide: $guide_"
  1156. Agent/TCP set old_ecn_ 0
  1157. $self ecnsetup Reno 2.0 1
  1158. $self drop_pkts {1 3} 
  1159. $ns_ run
  1160. }
  1161. # ECN for the second packet.
  1162. Class Test/ecn_secondpktEcn_reno -superclass TestSuite
  1163. Test/ecn_secondpktEcn_reno instproc init {} {
  1164.         $self instvar net_ test_ guide_ 
  1165.         Queue/RED set setbit_ true
  1166.         set net_ net2-lossy
  1167. Agent/TCP set bugFix_ true
  1168.         set test_ ecn_secondpktEcn_reno
  1169.         set guide_      "Reno, with the second packet marked."
  1170.         $self next pktTraceFile
  1171. }
  1172. Test/ecn_secondpktEcn_reno instproc run {} {
  1173.         global quiet
  1174. $self instvar ns_ guide_ errmodel1
  1175.         puts "Guide: $guide_"
  1176. Agent/TCP set old_ecn_ 0
  1177. $self ecnsetup Reno 2.0 1
  1178. $self drop_pkts {1 3} 
  1179. $errmodel1 set markecn_ true
  1180. $ns_ run
  1181. }
  1182. #######################################################################
  1183. # Delayed Ack Reno Tests #
  1184. #######################################################################
  1185. # Plain ECN
  1186. Class Test/ecn_nodrop_reno_delack -superclass TestSuite
  1187. Test/ecn_nodrop_reno_delack instproc init {} {
  1188.         $self instvar net_ test_ guide_
  1189.         Queue/RED set setbit_ true
  1190.         set net_ net2-lossy
  1191. Agent/TCP set bugFix_ true
  1192.         set test_ ecn_nodrop_reno_delack
  1193.         set guide_      "Reno, ECN, delayed acks."
  1194.         $self next pktTraceFile
  1195. }
  1196. Test/ecn_nodrop_reno_delack instproc run {} {
  1197.         global quiet
  1198. $self instvar ns_ guide_
  1199.         puts "Guide: $guide_"
  1200. Agent/TCP set old_ecn_ 1
  1201. $self ecnsetup Reno 3.0 0 1 
  1202. $self drop_pkt 10000
  1203. $ns_ run
  1204. }
  1205. # Two ECNs close together
  1206. Class Test/ecn_twoecn_reno_delack -superclass TestSuite
  1207. Test/ecn_twoecn_reno_delack instproc init {} {
  1208.         $self instvar net_ test_ guide_ 
  1209.         Queue/RED set setbit_ true
  1210.         set net_ net2-lossy
  1211. Agent/TCP set bugFix_ true
  1212.         set test_ ecn_twoecn_reno_delack
  1213.         set guide_      "Reno, ECN, delayed acks."
  1214.         $self next pktTraceFile
  1215. }
  1216. Test/ecn_twoecn_reno_delack instproc run {} {
  1217.         global quiet
  1218. $self instvar ns_ guide_ lossmodel
  1219.         puts "Guide: $guide_"
  1220. Agent/TCP set old_ecn_ 1
  1221. $self ecnsetup Reno 3.0 0 1 
  1222. $self drop_pkt 243
  1223. $lossmodel set markecn_ true
  1224. $ns_ run
  1225. }
  1226. # ECN followed by packet loss.
  1227. Class Test/ecn_drop_reno_delack -superclass TestSuite
  1228. Test/ecn_drop_reno_delack instproc init {} {
  1229.         $self instvar net_ test_ guide_
  1230.         Queue/RED set setbit_ true
  1231.         set net_ net2-lossy
  1232. Agent/TCP set bugFix_ true
  1233.         set test_ ecn_drop_reno_delack
  1234.         set guide_      "Reno, packet loss followed by ECN, delayed acks."
  1235.         $self next pktTraceFile
  1236. }
  1237. Test/ecn_drop_reno_delack instproc run {} {
  1238.         global quiet
  1239. $self instvar ns_ guide_
  1240.         puts "Guide: $guide_"
  1241. Agent/TCP set old_ecn_ 1
  1242. $self ecnsetup Reno 3.0 0 1
  1243. $self drop_pkt 243
  1244. $ns_ run
  1245. }
  1246. # ECN preceded by packet loss.
  1247. # NO.
  1248. Class Test/ecn_drop1_reno_delack -superclass TestSuite
  1249. Test/ecn_drop1_reno_delack instproc init {} {
  1250.         $self instvar net_ test_ guide_
  1251.         Queue/RED set setbit_ true
  1252.         set net_ net2-lossy
  1253. Agent/TCP set bugFix_ true
  1254.         set test_ ecn_drop1_reno_delack
  1255.         set guide_      "Reno, packet loss followed by ECN, delayed acks."
  1256.         $self next pktTraceFile
  1257. }
  1258. Test/ecn_drop1_reno_delack instproc run {} {
  1259.         global quiet
  1260. $self instvar ns_ guide_
  1261.         puts "Guide: $guide_"
  1262. Agent/TCP set old_ecn_ 1
  1263. $self ecnsetup Reno 3.0 0 1
  1264. $self drop_pkt 241
  1265. $ns_ run
  1266. }
  1267. # ECN with a window of one packet.
  1268. Class Test/ecn_smallwinEcn_reno_delack -superclass TestSuite
  1269. Test/ecn_smallwinEcn_reno_delack instproc init {} {
  1270.         $self instvar net_ test_ guide_ 
  1271.         Queue/RED set setbit_ true
  1272.         set net_ net2-lossy
  1273. Agent/TCP set bugFix_ true
  1274.         set test_ ecn_smallwinEcn_reno_delack
  1275.         set guide_      "Reno, delayed acks, ECN with a window of one."
  1276.         $self next pktTraceFile
  1277. }
  1278. Test/ecn_smallwinEcn_reno_delack instproc run {} {
  1279.         global quiet
  1280. $self instvar ns_ guide_ errmodel1
  1281.         puts "Guide: $guide_"
  1282. Agent/TCP set old_ecn_ 0
  1283. $self ecnsetup Reno 10.0 1 1
  1284. $self drop_pkts {4 8 9 11 120 135 143 148 150 151 152 153} 
  1285. $errmodel1 set markecn_ true
  1286. $ns_ run
  1287. }
  1288. #######################################################################
  1289. # Sack1 Tests #
  1290. #######################################################################
  1291. # Plain ECN
  1292. Class Test/ecn_nodrop_sack -superclass TestSuite
  1293. Test/ecn_nodrop_sack instproc init {} {
  1294.         $self instvar net_ test_ guide_
  1295.         Queue/RED set setbit_ true
  1296.         set net_ net2-lossy
  1297. Agent/TCP set bugFix_ true
  1298.         set test_ ecn_nodrop_sack
  1299.         set guide_      "Sack with ECN."
  1300.         $self next pktTraceFile
  1301. }
  1302. Test/ecn_nodrop_sack instproc run {} {
  1303.         global quiet
  1304. $self instvar ns_ guide_
  1305.         puts "Guide: $guide_"
  1306. Agent/TCP set old_ecn_ 1
  1307. $self ecnsetup Sack1 3.0 
  1308. $self drop_pkt 10000
  1309. $ns_ run
  1310. }
  1311. # Two ECNs close together
  1312. Class Test/ecn_twoecn_sack -superclass TestSuite
  1313. Test/ecn_twoecn_sack instproc init {} {
  1314.         $self instvar net_ test_ guide_ 
  1315.         Queue/RED set setbit_ true
  1316.         set net_ net2-lossy
  1317. Agent/TCP set bugFix_ true
  1318.         set test_ ecn_twoecn_sack
  1319.         set guide_      "Sack, two marked packets in one window."
  1320.         $self next pktTraceFile
  1321. }
  1322. Test/ecn_twoecn_sack instproc run {} {
  1323.         global quiet
  1324. $self instvar ns_ guide_ lossmodel
  1325.         puts "Guide: $guide_"
  1326. Agent/TCP set old_ecn_ 1
  1327. $self ecnsetup Sack1 3.0 
  1328. $self drop_pkt 243
  1329. $lossmodel set markecn_ true
  1330. $ns_ run
  1331. }
  1332. # ECN followed by packet loss.
  1333. Class Test/ecn_drop_sack -superclass TestSuite
  1334. Test/ecn_drop_sack instproc init {} {
  1335.         $self instvar net_ test_ guide_
  1336. #        Queue/RED set setbit_ true
  1337.         set net_        net2-lossy
  1338.         Agent/TCP set bugFix_ true  
  1339.         set test_       ecn_drop_sack
  1340.         set guide_      "Sack, ECN preceded by packet loss."
  1341.         $self next pktTraceFile
  1342. Test/ecn_drop_sack instproc run {} {
  1343.         global quiet
  1344.         $self instvar ns_ guide_
  1345.         puts "Guide: $guide_"
  1346. Agent/TCP set old_ecn_ 1
  1347.         $self ecnsetup Sack1 3.0
  1348.         $self drop_pkt 243
  1349.         $ns_ run
  1350. }
  1351. # ECN followed by packet loss.
  1352. Class Test/ecn_drop1_sack -superclass TestSuite
  1353. Test/ecn_drop1_sack instproc init {} {
  1354.         $self instvar net_ test_ guide_
  1355. #        Queue/RED set setbit_ true
  1356.         set net_ net2-lossy
  1357. Agent/TCP set bugFix_ true
  1358.         set test_ ecn_drop1_sack
  1359.         set guide_      "Sack, ECN preceded by packet loss."
  1360.         $self next pktTraceFile
  1361. }
  1362. Test/ecn_drop1_sack instproc run {} {
  1363.         global quiet
  1364. $self instvar ns_ guide_
  1365.         puts "Guide: $guide_"
  1366. Agent/TCP set old_ecn_ 1
  1367. $self ecnsetup Sack1 3.0
  1368. $self drop_pkt 241
  1369. $ns_ run
  1370. }
  1371. # Packet loss only.
  1372. Class Test/ecn_noecn_sack -superclass TestSuite
  1373. Test/ecn_noecn_sack instproc init {} {
  1374.         $self instvar net_ test_ guide_
  1375.         Queue/RED set setbit_ true
  1376. Queue/RED set thresh_ 1000
  1377. Queue/RED set maxthresh_ 1000
  1378.         set net_ net2-lossy
  1379. Agent/TCP set bugFix_ true
  1380.         set test_ ecn_noecn_sack
  1381. Test/ecn_noecn_sack instproc run {} [Test/ecn_drop_sack info instbody run ]
  1382.         set guide_      "Sack, packet loss only, no ECN."
  1383.         $self next pktTraceFile
  1384. }
  1385. # Multiple dup acks with bugFix_
  1386. Class Test/ecn_bursty_sack -superclass TestSuite
  1387. Test/ecn_bursty_sack instproc init {} {
  1388.         $self instvar net_ test_ guide_
  1389.         Queue/RED set setbit_ true
  1390. Queue/RED set thresh_ 100
  1391. Queue/RED set maxthresh_ 100
  1392.         set net_ net2-lossy
  1393. Agent/TCP set bugFix_ true
  1394.         set test_ ecn_bursty_sack
  1395.         set guide_      "Sack, multiple dup acks, with bugFix."
  1396.         $self next pktTraceFile
  1397. }
  1398. Test/ecn_bursty_sack instproc run {} {
  1399.         global quiet
  1400. $self instvar ns_ guide_
  1401.         puts "Guide: $guide_"
  1402. $self ecnsetup Sack1 3.0
  1403.         set lossmodel [$self setloss]
  1404.         $lossmodel set offset_ 245
  1405. $lossmodel set burstlen_ 15
  1406.         $lossmodel set period_ 10000
  1407. $ns_ run
  1408. }
  1409. # Multiple dup acks following ECN
  1410. Class Test/ecn_burstyEcn_sack -superclass TestSuite
  1411. Test/ecn_burstyEcn_sack instproc init {} {
  1412.         $self instvar net_ test_ guide_
  1413.         Queue/RED set setbit_ true
  1414.         set net_ net2-lossy
  1415. Agent/TCP set bugFix_ true
  1416. Agent/TCP set old_ecn_ 1
  1417.         set test_ ecn_burstyEcn_sack
  1418. Test/ecn_burstyEcn_sack instproc run {} [Test/ecn_bursty_sack info instbody run ]   
  1419.         set guide_      "Sack, multiple dup acks and ECN, with bugFix."
  1420.         $self next pktTraceFile
  1421. }
  1422. # Multiple dup acks following ECN
  1423. Class Test/ecn_burstyEcn1_sack -superclass TestSuite
  1424. Test/ecn_burstyEcn1_sack instproc init {} {
  1425.         $self instvar net_ test_ guide_
  1426.         Queue/RED set setbit_ true
  1427.         set net_ net2-lossy
  1428. Agent/TCP set bugFix_ true
  1429.         set test_ ecn_burstyEcn1_sack
  1430.         set guide_      "Sack, multiple dup acks and ECN, with bugFix."
  1431.         $self next pktTraceFile
  1432. }
  1433. Test/ecn_burstyEcn1_sack instproc run {} {
  1434.         global quiet
  1435. $self instvar ns_ guide_
  1436.         puts "Guide: $guide_"
  1437. $self ecnsetup Sack1 3.0
  1438.         set lossmodel [$self setloss]
  1439.         $lossmodel set offset_ 245
  1440. $lossmodel set burstlen_ 17
  1441.         $lossmodel set period_ 10000
  1442. $ns_ run
  1443. }
  1444. # Multiple dup acks without bugFix_
  1445. Class Test/ecn_noBugfix_sack -superclass TestSuite
  1446. Test/ecn_noBugfix_sack instproc init {} {
  1447.         $self instvar net_ test_ guide_
  1448. Queue/RED set thresh_ 100 
  1449. Queue/RED set maxthresh_ 100
  1450.         Queue/RED set setbit_ true
  1451.         set net_ net2-lossy
  1452. Agent/TCP set bugFix_ false
  1453.         set test_ ecn_noBugfix_sack
  1454. Test/ecn_noBugfix_sack instproc run {} [Test/ecn_bursty_sack info instbody run ]
  1455.         set guide_      "Sack, multiple dup acks, no bugFix."
  1456.         $self next pktTraceFile
  1457. }
  1458. # ECN followed by timeout.
  1459. Class Test/ecn_timeout_sack -superclass TestSuite
  1460. Test/ecn_timeout_sack instproc init {} {
  1461.         $self instvar net_ test_ guide_
  1462.         Queue/RED set setbit_ true
  1463.         set net_ net2-lossy
  1464. Agent/TCP set bugFix_ true
  1465.         set test_ ecn_timeout_sack
  1466.         set guide_      "Sack, drops and ECN followed by a timeout."
  1467.         $self next pktTraceFile
  1468. }
  1469. Test/ecn_timeout_sack instproc run {} {
  1470.         global quiet
  1471. $self instvar ns_ guide_
  1472.         puts "Guide: $guide_"
  1473. $self ecnsetup Sack1 3.0 1
  1474. $self drop_pkts {242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268} 
  1475. $ns_ run
  1476. }
  1477. # ECN followed by a timeout, followed by an ECN representing a
  1478. # new instance of congestion.
  1479. Class Test/ecn_timeout1_sack -superclass TestSuite
  1480. Test/ecn_timeout1_sack instproc init {} {
  1481.         $self instvar net_ test_ guide_
  1482.         Queue/RED set setbit_ true
  1483.         set net_ net2-lossy
  1484. Agent/TCP set bugFix_ true
  1485.         set test_ ecn_timeout1_sack
  1486.         set guide_      "Sack, drops and ECN followed by a timeout."
  1487.         $self next pktTraceFile
  1488. }
  1489. Test/ecn_timeout1_sack instproc run {} {
  1490.         global quiet
  1491. $self instvar ns_ guide_
  1492.         puts "Guide: $guide_"
  1493. Agent/TCP set old_ecn_ 1
  1494. $self ecnsetup Sack1 3.0 1
  1495. $self drop_pkts {245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265} 
  1496. $self second_tcp Tahoe 1.0
  1497. $ns_ run
  1498. }
  1499. # ECN and packet drops.
  1500. Class Test/ecn_fourdrops_sack -superclass TestSuite
  1501. Test/ecn_fourdrops_sack instproc init {} {
  1502.         $self instvar net_ test_ guide_
  1503.         Queue/RED set setbit_ true
  1504.         set net_ net2-lossy
  1505. Agent/TCP set bugFix_ true
  1506.         set test_ ecn_fourdrops_sack
  1507.         set guide_      "Reno, ECN with four packet drops."
  1508.         $self next pktTraceFile
  1509. }
  1510. Test/ecn_fourdrops_sack instproc run {} {
  1511.         global quiet
  1512. $self instvar ns_ guide_
  1513.         puts "Guide: $guide_"
  1514. $self ecnsetup Sack1 3.0 1
  1515. $self drop_pkts {242 244 267 268} 
  1516. $ns_ run
  1517. }
  1518. # Packet drops with a window of one packet.
  1519. Class Test/ecn_smallwin_sack -superclass TestSuite
  1520. Test/ecn_smallwin_sack instproc init {} {
  1521.         $self instvar net_ test_ guide_
  1522.         Queue/RED set setbit_ true
  1523. Agent/TCP set bugFix_ true
  1524.         set net_ net2-lossy
  1525.         set test_ ecn_smallwin_sack
  1526.         set guide_      "Sack, packet drops with a window of one."
  1527.         $self next pktTraceFile
  1528. }
  1529. Test/ecn_smallwin_sack instproc run {} {
  1530.         global quiet
  1531. $self instvar ns_ guide_
  1532.         puts "Guide: $guide_"
  1533. Agent/TCP set old_ecn_ 0
  1534. $self ecnsetup Sack1 6.0 1
  1535. $self drop_pkts {4 8 9 10 11 100 115 121 124 126 127 128}
  1536. $ns_ run
  1537. }
  1538. # ECN with a window of one packet.
  1539. Class Test/ecn_smallwinEcn_sack -superclass TestSuite
  1540. Test/ecn_smallwinEcn_sack instproc init {} {
  1541.         $self instvar net_ test_ guide_ 
  1542.         Queue/RED set setbit_ true
  1543.         set net_ net2-lossy
  1544. Agent/TCP set bugFix_ true
  1545.         set test_ ecn_smallwinEcn_sack
  1546.         set guide_      "Sack, ECN with a window of one."
  1547.         $self next pktTraceFile
  1548. }
  1549. Test/ecn_smallwinEcn_sack instproc run {} {
  1550.         global quiet
  1551. $self instvar ns_ guide_ errmodel1
  1552.         puts "Guide: $guide_"
  1553. Agent/TCP set old_ecn_ 0
  1554. $self ecnsetup Sack1 10.0 1
  1555. $self drop_pkts {4 7 9 10 11 12 13 14 120 135 143 148 150 151 152} 
  1556. $errmodel1 set markecn_ true
  1557. $ns_ run
  1558. }
  1559. Class Test/ecn_smallwin1Ecn_sack -superclass TestSuite
  1560. Test/ecn_smallwin1Ecn_sack instproc init {} {
  1561.         $self instvar net_ test_ guide_ 
  1562.         Queue/RED set setbit_ true
  1563.         set net_ net3-lossy
  1564. Agent/TCP set bugFix_ true
  1565.         set test_ ecn_smallwin1Ecn_sack
  1566.         set guide_      "Sack, ECN with small windows."
  1567.         $self next pktTraceFile
  1568. }
  1569. Test/ecn_smallwin1Ecn_sack instproc run {} {
  1570.         global quiet
  1571. $self instvar ns_ guide_ errmodel1 errmodel2
  1572.         puts "Guide: $guide_"
  1573. Agent/TCP set old_ecn_ 0
  1574. $self ecnsetup Sack1 10.0 1
  1575. $self drop_pkts {4 8 9 11 12 13 120 135 143 148 150 153} 
  1576. $errmodel1 set markecn_ true
  1577. $self drop_pkts2 {6}
  1578. $errmodel2 set markecn_ false
  1579. $ns_ run
  1580. }
  1581. # Packet drops for the second packet.
  1582. Class Test/ecn_secondpkt_sack -superclass TestSuite
  1583. Test/ecn_secondpkt_sack instproc init {} {
  1584.         $self instvar net_ test_ guide_
  1585.         Queue/RED set setbit_ true
  1586. Agent/TCP set bugFix_ true
  1587.         set net_ net2-lossy
  1588.         set test_ ecn_secondpkt_sack
  1589.         set guide_      "Sack, with the second packet dropped."
  1590.         $self next pktTraceFile
  1591. }
  1592. Test/ecn_secondpkt_sack instproc run {} {
  1593.         global quiet
  1594. $self instvar ns_ guide_
  1595.         puts "Guide: $guide_"
  1596. Agent/TCP set old_ecn_ 0
  1597. $self ecnsetup Sack1 2.0 1
  1598. $self drop_pkts {1 3} 
  1599. $ns_ run
  1600. }
  1601. # ECN for the second packet.
  1602. Class Test/ecn_secondpktEcn_sack -superclass TestSuite
  1603. Test/ecn_secondpktEcn_sack instproc init {} {
  1604.         $self instvar net_ test_ guide_ 
  1605.         Queue/RED set setbit_ true
  1606.         set net_ net2-lossy
  1607. Agent/TCP set bugFix_ true
  1608.         set test_ ecn_secondpktEcn_sack
  1609.         set guide_      "Sack, with the second packet marked."
  1610.         $self next pktTraceFile
  1611. }
  1612. Test/ecn_secondpktEcn_sack instproc run {} {
  1613.         global quiet
  1614. $self instvar ns_ guide_ errmodel1
  1615.         puts "Guide: $guide_"
  1616. Agent/TCP set old_ecn_ 0
  1617. $self ecnsetup Sack1 2.0 1
  1618. $self drop_pkts {1 3} 
  1619. $errmodel1 set markecn_ true
  1620. $ns_ run
  1621. }
  1622. #######################################################################
  1623. # Delayed Ack Sack1 Tests #
  1624. #######################################################################
  1625. # Plain ECN
  1626. Class Test/ecn_nodrop_sack_delack -superclass TestSuite
  1627. Test/ecn_nodrop_sack_delack instproc init {} {
  1628.         $self instvar net_ test_ guide_
  1629.         Queue/RED set setbit_ true
  1630.         set net_ net2-lossy
  1631. Agent/TCP set bugFix_ true
  1632.         set test_ ecn_nodrop_sack_delack
  1633.         set guide_      "Sack, ECN, delayed acks."
  1634.         $self next pktTraceFile
  1635. }
  1636. Test/ecn_nodrop_sack_delack instproc run {} {
  1637.         global quiet
  1638. $self instvar ns_ guide_
  1639.         puts "Guide: $guide_"
  1640. Agent/TCP set old_ecn_ 1
  1641. $self ecnsetup Sack1 3.0 0 1 
  1642. $self drop_pkt 10000
  1643. $ns_ run
  1644. }
  1645. # Two ECNs close together
  1646. Class Test/ecn_twoecn_sack_delack -superclass TestSuite
  1647. Test/ecn_twoecn_sack_delack instproc init {} {
  1648.         $self instvar net_ test_ guide_ 
  1649.         Queue/RED set setbit_ true
  1650.         set net_ net2-lossy
  1651. Agent/TCP set bugFix_ true
  1652.         set test_ ecn_twoecn_sack_delack
  1653.         set guide_      "Sack, ECN, delayed acks."
  1654.         $self next pktTraceFile
  1655. }
  1656. Test/ecn_twoecn_sack_delack instproc run {} {
  1657.         global quiet
  1658. $self instvar ns_ guide_ lossmodel
  1659.         puts "Guide: $guide_"
  1660. Agent/TCP set old_ecn_ 1
  1661. $self ecnsetup Sack1 3.0 0 1 
  1662. $self drop_pkt 243
  1663. $lossmodel set markecn_ true
  1664. $ns_ run
  1665. }
  1666. # ECN followed by packet loss.
  1667. Class Test/ecn_drop_sack_delack -superclass TestSuite
  1668. Test/ecn_drop_sack_delack instproc init {} {
  1669.         $self instvar net_ test_ guide_
  1670. #        Queue/RED set setbit_ true
  1671.         set net_        net2-lossy
  1672.         Agent/TCP set bugFix_ true  
  1673.         set test_       ecn_drop_sack_delack
  1674.         set guide_      "Sack, packet loss followed by ECN, delayed acks."
  1675.         $self next pktTraceFile
  1676. Test/ecn_drop_sack_delack instproc run {} {
  1677.         global quiet
  1678.         $self instvar ns_ guide_
  1679.         puts "Guide: $guide_"
  1680. Agent/TCP set old_ecn_ 1
  1681.         $self ecnsetup Sack1 3.0 0 1
  1682.         $self drop_pkt 243
  1683.         $ns_ run
  1684. }
  1685. # ECN followed by packet loss.
  1686. Class Test/ecn_drop1_sack_delack -superclass TestSuite
  1687. Test/ecn_drop1_sack_delack instproc init {} {
  1688.         $self instvar net_ test_ guide_
  1689. #        Queue/RED set setbit_ true
  1690.         set net_ net2-lossy
  1691. Agent/TCP set bugFix_ true
  1692.         set test_ ecn_drop1_sack_delack
  1693.         set guide_      "Sack, packet loss followed by ECN, delayed acks."
  1694.         $self next pktTraceFile
  1695. }
  1696. Test/ecn_drop1_sack_delack instproc run {} {
  1697.         global quiet
  1698. $self instvar ns_ guide_
  1699.         puts "Guide: $guide_"
  1700. Agent/TCP set old_ecn_ 1
  1701. $self ecnsetup Sack1 3.0 0 1
  1702. $self drop_pkt 241
  1703. $ns_ run
  1704. }
  1705. # ECN with a window of one packet.
  1706. Class Test/ecn_smallwinEcn_sack_delack -superclass TestSuite
  1707. Test/ecn_smallwinEcn_sack_delack instproc init {} {
  1708.         $self instvar net_ test_ guide_ 
  1709.         Queue/RED set setbit_ true
  1710.         set net_ net2-lossy
  1711. Agent/TCP set bugFix_ true
  1712.         set test_ ecn_smallwinEcn_sack_delack
  1713.         set guide_      "Sack, delayed ack, ECN with small windows."
  1714.         $self next pktTraceFile
  1715. }
  1716. Test/ecn_smallwinEcn_sack_delack instproc run {} {
  1717.         global quiet
  1718. $self instvar ns_ guide_ errmodel1
  1719.         puts "Guide: $guide_"
  1720. Agent/TCP set old_ecn_ 0
  1721. $self ecnsetup Sack1 10.0 1 1
  1722. $self drop_pkts {4 7 9 11 12 120 135 143 148 150 151 152} 
  1723. $errmodel1 set markecn_ true
  1724. $ns_ run
  1725. }
  1726. #######################################################################
  1727. # Newreno Tests #
  1728. #######################################################################
  1729. # Plain ECN
  1730. Class Test/ecn_nodrop_newreno -superclass TestSuite
  1731. Test/ecn_nodrop_newreno instproc init {} {
  1732.         $self instvar net_ test_ guide_
  1733.         Queue/RED set setbit_ true
  1734.         set net_ net2-lossy
  1735. Agent/TCP set bugFix_ true
  1736.         set test_ ecn_nodrop_newreno
  1737.         set guide_      "NewReno with ECN."
  1738.         $self next pktTraceFile
  1739. }
  1740. Test/ecn_nodrop_newreno instproc run {} {
  1741.         global quiet
  1742. $self instvar ns_ guide_
  1743. Agent/TCP set old_ecn_ 1
  1744. $self ecnsetup Newreno 3.0 
  1745. $self drop_pkt 10000
  1746. $ns_ run
  1747. }
  1748. # Two ECNs close together
  1749. Class Test/ecn_twoecn_newreno -superclass TestSuite
  1750. Test/ecn_twoecn_newreno instproc init {} {
  1751.         $self instvar net_ test_ guide_ 
  1752.         Queue/RED set setbit_ true
  1753.         set net_ net2-lossy
  1754. Agent/TCP set bugFix_ true
  1755.         set test_ ecn_twoecn_newreno
  1756.         set guide_      "NewReno, two marked packets in one window."
  1757.         $self next pktTraceFile
  1758. }
  1759. Test/ecn_twoecn_newreno instproc run {} {
  1760.         global quiet
  1761. $self instvar ns_ guide_ lossmodel
  1762.         puts "Guide: $guide_"
  1763. Agent/TCP set old_ecn_ 1
  1764. $self ecnsetup Newreno 3.0 
  1765. $self drop_pkt 243
  1766. $lossmodel set markecn_ true
  1767. $ns_ run
  1768. }
  1769. # ECN followed by packet loss.
  1770. Class Test/ecn_drop_newreno -superclass TestSuite
  1771. Test/ecn_drop_newreno instproc init {} {
  1772.         $self instvar net_ test_ guide_
  1773.         Queue/RED set setbit_ true
  1774.         set net_ net2-lossy
  1775. Agent/TCP set bugFix_ true
  1776.         set test_ ecn_drop_newreno
  1777.         set guide_      "NewReno, ECN preceded by packet loss."
  1778.         $self next pktTraceFile
  1779. }
  1780. Test/ecn_drop_newreno instproc run {} {
  1781.         global quiet
  1782. $self instvar ns_ guide_
  1783. Agent/TCP set old_ecn_ 1
  1784. $self ecnsetup Newreno 3.0
  1785. $self drop_pkt 243
  1786. $ns_ run
  1787. }
  1788. # ECN preceded by packet loss.
  1789. Class Test/ecn_drop1_newreno -superclass TestSuite
  1790. Test/ecn_drop1_newreno instproc init {} {
  1791.         $self instvar net_ test_ guide_
  1792.         Queue/RED set setbit_ true
  1793.         set net_ net2-lossy
  1794. Agent/TCP set bugFix_ true
  1795.         set test_ ecn_drop1_newreno
  1796.         set guide_      "NewReno, ECN preceded by packet loss."
  1797.         $self next pktTraceFile
  1798. }
  1799. Test/ecn_drop1_newreno instproc run {} {
  1800.         global quiet
  1801. $self instvar ns_ guide_
  1802.         puts "Guide: $guide_"
  1803. Agent/TCP set old_ecn_ 1
  1804. $self ecnsetup Newreno 3.0
  1805. $self drop_pkt 241
  1806. $ns_ run
  1807. }
  1808. # Packet loss only.
  1809. Class Test/ecn_noecn_newreno -superclass TestSuite
  1810. Test/ecn_noecn_newreno instproc init {} {
  1811.         $self instvar net_ test_ guide_
  1812.         Queue/RED set setbit_ true
  1813. Queue/RED set thresh_ 1000
  1814. Queue/RED set maxthresh_ 1000
  1815.         set net_ net2-lossy
  1816. Agent/TCP set bugFix_ true
  1817.         set test_ ecn_noecn_newreno
  1818. Test/ecn_noecn_newreno instproc run {} [Test/ecn_drop_newreno info instbody run ]
  1819.         set guide_      "NewReno, packet loss only, no ECN."
  1820.         $self next pktTraceFile
  1821. }
  1822. # Multiple dup acks with bugFix_
  1823. Class Test/ecn_bursty_newreno -superclass TestSuite
  1824. Test/ecn_bursty_newreno instproc init {} {
  1825.         $self instvar net_ test_ guide_
  1826.         Queue/RED set setbit_ true
  1827. Queue/RED set thresh_ 100
  1828. Queue/RED set maxthresh_ 100
  1829.         set net_ net2-lossy
  1830. Agent/TCP set bugFix_ true
  1831.         set test_ ecn_bursty_newreno
  1832.         set guide_      "NewReno, multiple dup acks, with bugFix."
  1833.         $self next pktTraceFile
  1834. }
  1835. Test/ecn_bursty_newreno instproc run {} {
  1836.         global quiet
  1837. $self instvar ns_ guide_
  1838.         puts "Guide: $guide_"
  1839. $self ecnsetup Newreno 3.0
  1840.         set lossmodel [$self setloss]
  1841.         $lossmodel set offset_ 245
  1842. $lossmodel set burstlen_ 15
  1843.         $lossmodel set period_ 10000
  1844. $ns_ run
  1845. }
  1846. # Multiple dup acks following ECN
  1847. Class Test/ecn_burstyEcn_newreno -superclass TestSuite
  1848. Test/ecn_burstyEcn_newreno instproc init {} {
  1849.         $self instvar net_ test_ guide_
  1850.         Queue/RED set setbit_ true
  1851.         set net_ net2-lossy
  1852. Agent/TCP set bugFix_ true
  1853. Agent/TCP set old_ecn_ 1
  1854.         set test_ ecn_burstyEcn_newreno
  1855. Test/ecn_burstyEcn_newreno instproc run {} [Test/ecn_bursty_newreno info instbody run ]   
  1856.         set guide_      "NewReno, multiple dup acks and ECN, with bugFix."
  1857.         $self next pktTraceFile
  1858. }
  1859. # ECN followed by timeout.
  1860. # Nope.
  1861. Class Test/ecn_timeout_newreno -superclass TestSuite
  1862. Test/ecn_timeout_newreno instproc init {} {
  1863.         $self instvar net_ test_ guide_
  1864.         Queue/RED set setbit_ true
  1865.         set net_ net2-lossy
  1866. Agent/TCP set bugFix_ true
  1867.         set test_ ecn_timeout_newreno
  1868.         set guide_      "NewReno, multiple dup acks"
  1869.         $self next pktTraceFile
  1870. }
  1871. Test/ecn_timeout_newreno instproc run {} {
  1872.         global quiet
  1873. $self instvar ns_ guide_
  1874.         puts "Guide: $guide_"
  1875. $self ecnsetup Newreno 3.0 1
  1876. $self drop_pkts {242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268} 
  1877. $ns_ run
  1878. }
  1879. # ECN followed by a timeout, followed by an ECN representing a
  1880. # new instance of congestion.
  1881. Class Test/ecn_timeout1_newreno -superclass TestSuite
  1882. Test/ecn_timeout1_newreno instproc init {} {
  1883.         $self instvar net_ test_ guide_
  1884.         Queue/RED set setbit_ true
  1885.         set net_ net2-lossy
  1886. Agent/TCP set bugFix_ true
  1887.         set test_ ecn_timeout1_newreno
  1888.         set guide_      "NewReno, drops and ECN followed by a timeout."
  1889.         $self next pktTraceFile
  1890. }
  1891. Test/ecn_timeout1_newreno instproc run {} {
  1892.         global quiet
  1893. $self instvar ns_ guide_
  1894.         puts "Guide: $guide_"
  1895. Agent/TCP set old_ecn_ 1
  1896. $self ecnsetup Newreno 3.0 1
  1897. Agent/TCP set old_ecn_ 1
  1898. $self drop_pkts {245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265} 
  1899. $self second_tcp Tahoe 1.0
  1900. $ns_ run
  1901. }
  1902. # Packet drops with a window of one packet.
  1903. Class Test/ecn_smallwin_newreno -superclass TestSuite
  1904. Test/ecn_smallwin_newreno instproc init {} {
  1905.         $self instvar net_ test_ guide_
  1906.         Queue/RED set setbit_ true
  1907. Agent/TCP set bugFix_ true
  1908.         set net_ net2-lossy
  1909.         set test_ ecn_smallwin_newreno
  1910.         set guide_      "NewReno, packet drops with a window of one."
  1911.         $self next pktTraceFile
  1912. }
  1913. Test/ecn_smallwin_newreno instproc run {} {
  1914.         global quiet
  1915. $self instvar ns_ guide_
  1916.         puts "Guide: $guide_"
  1917. Agent/TCP set old_ecn_ 0
  1918. $self ecnsetup Newreno 6.0 1
  1919. $self drop_pkts {4 8 9 10 11 100 115 121 124 126 127 128}
  1920. $ns_ run
  1921. }
  1922. # ECN with a window of one packet.
  1923. Class Test/ecn_smallwinEcn_newreno -superclass TestSuite
  1924. Test/ecn_smallwinEcn_newreno instproc init {} {
  1925.         $self instvar net_ test_ guide_ 
  1926.         Queue/RED set setbit_ true
  1927.         set net_ net2-lossy
  1928. Agent/TCP set bugFix_ true
  1929.         set test_ ecn_smallwinEcn_newreno
  1930.         set guide_      "NewReno, ECN with a window of one."
  1931.         $self next pktTraceFile
  1932. }
  1933. Test/ecn_smallwinEcn_newreno instproc run {} {
  1934.         global quiet
  1935. $self instvar ns_ guide_ errmodel1
  1936.         puts "Guide: $guide_"
  1937. Agent/TCP set old_ecn_ 0
  1938. $self ecnsetup Newreno 10.0 1
  1939. $self drop_pkts {4 8 9 11 12 13 120 135 143 148 150 151 152 153} 
  1940. $errmodel1 set markecn_ true
  1941. $ns_ run
  1942. }
  1943. # Packet drops for the second packet.
  1944. Class Test/ecn_secondpkt_newreno -superclass TestSuite
  1945. Test/ecn_secondpkt_newreno instproc init {} {
  1946.         $self instvar net_ test_ guide_
  1947.         Queue/RED set setbit_ true
  1948. Agent/TCP set bugFix_ true
  1949.         set net_ net2-lossy
  1950.         set test_ ecn_secondpkt_newreno
  1951.         set guide_      "NewReno, with the second packet dropped."
  1952.         $self next pktTraceFile
  1953. }
  1954. Test/ecn_secondpkt_newreno instproc run {} {
  1955.         global quiet
  1956. $self instvar ns_ guide_
  1957.         puts "Guide: $guide_"
  1958. Agent/TCP set old_ecn_ 0
  1959. $self ecnsetup Newreno 2.0 1
  1960. $self drop_pkts {1 3} 
  1961. $ns_ run
  1962. }
  1963. # ECN for the second packet.
  1964. Class Test/ecn_secondpktEcn_newreno -superclass TestSuite
  1965. Test/ecn_secondpktEcn_newreno instproc init {} {
  1966.         $self instvar net_ test_ guide_ 
  1967.         Queue/RED set setbit_ true
  1968.         set net_ net2-lossy
  1969. Agent/TCP set bugFix_ true
  1970.         set test_ ecn_secondpktEcn_newreno
  1971.         set guide_      "NewReno, with the second packet marked."
  1972.         $self next pktTraceFile
  1973. }
  1974. Test/ecn_secondpktEcn_newreno instproc run {} {
  1975.         global quiet
  1976. $self instvar ns_ guide_ errmodel1
  1977.         puts "Guide: $guide_"
  1978. Agent/TCP set old_ecn_ 0
  1979. $self ecnsetup Newreno 2.0 1
  1980. $self drop_pkts {1 3} 
  1981. $errmodel1 set markecn_ true
  1982. $ns_ run
  1983. }
  1984. #######################################################################
  1985. # Delayed Ack Newreno Tests #
  1986. #######################################################################
  1987. # Plain ECN
  1988. Class Test/ecn_nodrop_newreno_delack -superclass TestSuite
  1989. Test/ecn_nodrop_newreno_delack instproc init {} {
  1990.         $self instvar net_ test_ guide_
  1991.         Queue/RED set setbit_ true
  1992.         set net_ net2-lossy
  1993. Agent/TCP set bugFix_ true
  1994.         set test_ ecn_nodrop_newreno_delack
  1995.         set guide_      "NewReno, with the second packet marked."
  1996.         $self next pktTraceFile
  1997. }
  1998. Test/ecn_nodrop_newreno_delack instproc run {} {
  1999.         global quiet
  2000. $self instvar ns_ guide_
  2001.         puts "Guide: $guide_"
  2002. Agent/TCP set old_ecn_ 1
  2003. $self ecnsetup Newreno 3.0 0 1 
  2004. $self drop_pkt 10000
  2005. $ns_ run
  2006. }
  2007. # Two ECNs close together
  2008. # Nope.
  2009. Class Test/ecn_twoecn_newreno_delack -superclass TestSuite
  2010. Test/ecn_twoecn_newreno_delack instproc init {} {
  2011.         $self instvar net_ test_ guide_ 
  2012.         Queue/RED set setbit_ true
  2013.         set net_ net2-lossy
  2014. Agent/TCP set bugFix_ true
  2015.         set test_ ecn_twoecn_newreno_delack
  2016.         set guide_ "NewReno, delayed acks."
  2017.         $self next pktTraceFile
  2018. }
  2019. Test/ecn_twoecn_newreno_delack instproc run {} {
  2020.         global quiet guide_
  2021. $self instvar ns_ guide_ lossmodel
  2022.         puts "Guide: $guide_"
  2023. Agent/TCP set old_ecn_ 1
  2024. $self ecnsetup Newreno 3.0 0 1 
  2025. $self drop_pkt 243
  2026. $lossmodel set markecn_ true
  2027. $ns_ run
  2028. }
  2029. # ECN followed by packet loss.
  2030. Class Test/ecn_drop_newreno_delack -superclass TestSuite
  2031. Test/ecn_drop_newreno_delack instproc init {} {
  2032.         $self instvar net_ test_ guide_
  2033.         Queue/RED set setbit_ true
  2034.         set net_ net2-lossy
  2035. Agent/TCP set bugFix_ true
  2036.         set test_ ecn_drop_newreno_delack
  2037.         set guide_  "ECN followed by packet loss."
  2038.         $self next pktTraceFile
  2039. }
  2040. Test/ecn_drop_newreno_delack instproc run {} {
  2041.         global quiet
  2042. $self instvar ns_ guide_
  2043.         puts "Guide: $guide_"
  2044. Agent/TCP set old_ecn_ 1
  2045. $self ecnsetup Newreno 3.0 0 1
  2046. $self drop_pkt 243
  2047. $ns_ run
  2048. }
  2049. # ECN preceded by packet loss.
  2050. # NO.
  2051. Class Test/ecn_drop1_newreno_delack -superclass TestSuite
  2052. Test/ecn_drop1_newreno_delack instproc init {} {
  2053.         $self instvar net_ test_ guide_
  2054.         Queue/RED set setbit_ true
  2055.         set net_ net2-lossy
  2056. Agent/TCP set bugFix_ true
  2057.         set test_ ecn_drop1_newreno_delack
  2058. set guide_ "ECN preceded by packet loss?"
  2059.         $self next pktTraceFile
  2060. }
  2061. Test/ecn_drop1_newreno_delack instproc run {} {
  2062.         global quiet
  2063. $self instvar ns_ guide_
  2064.         puts "Guide: $guide_"
  2065. Agent/TCP set old_ecn_ 1
  2066. $self ecnsetup Newreno 3.0 0 1
  2067. $self drop_pkt 241
  2068. $ns_ run
  2069. }
  2070. # ECN with a window of one packet.
  2071. Class Test/ecn_smallwinEcn_newreno_delack -superclass TestSuite
  2072. Test/ecn_smallwinEcn_newreno_delack instproc init {} {
  2073.         $self instvar net_ test_ guide_ 
  2074.         Queue/RED set setbit_ true
  2075.         set net_ net2-lossy
  2076. Agent/TCP set bugFix_ true
  2077.         set test_ ecn_smallwinEcn_newreno_delack
  2078. set guide_ "ECN with a window of one packet."
  2079.         $self next pktTraceFile
  2080. }
  2081. Test/ecn_smallwinEcn_newreno_delack instproc run {} {
  2082.         global quiet
  2083. $self instvar ns_ guide_ errmodel1
  2084.         puts "Guide: $guide_"
  2085. Agent/TCP set old_ecn_ 0
  2086. $self ecnsetup Newreno 10.0 1 1
  2087. $self drop_pkts {4 8 9 11 120 135 143 148 150 151 152 153} 
  2088. $errmodel1 set markecn_ true
  2089. $ns_ run
  2090. }
  2091. #################################################################
  2092. #################################################################
  2093. # Links1 uses 8Mb, 5ms feeders, and a 800Kb 20ms bottleneck.
  2094. # Queue-limit on bottleneck is 25 packets.
  2095. #    
  2096. Class Topology/net6 -superclass Topology
  2097. Topology/net6 instproc init ns {
  2098.     $self instvar node_
  2099.     set node_(s1) [$ns node]
  2100.     set node_(s2) [$ns node]
  2101.     set node_(r1) [$ns node]
  2102.     set node_(k1) [$ns node]
  2103.     Queue/RED set setbit_ true
  2104.     $ns duplex-link $node_(s1) $node_(r1) 8Mb 5ms DropTail
  2105.     $ns duplex-link $node_(s2) $node_(r1) 8Mb 5ms DropTail
  2106.     $ns duplex-link $node_(r1) $node_(k1) 800Kb 20ms RED
  2107.     $ns queue-limit $node_(r1) $node_(k1) 25
  2108.     $ns queue-limit $node_(k1) $node_(r1) 25
  2109. # This test shows two TCPs when one is ECN-capable and the other 
  2110. # is not.
  2111. Class Test/ecn1 -superclass TestSuite
  2112. Test/ecn1 instproc init {} {
  2113.         $self instvar net_ test_ guide_
  2114.         set net_        net6
  2115.         set test_       ecn1_(one_with_ecn1,_one_without)
  2116. set guide_  "Two TCPs, one with ECN and one without."
  2117.         $self next pktTraceFile
  2118. }
  2119. Test/ecn1 instproc run {} {
  2120.         global quiet
  2121.         $self instvar ns_ guide_ node_ guide_ testName_
  2122.         puts "Guide: $guide_"
  2123.         $self setTopo
  2124. Agent/TCP set old_ecn_ 1
  2125.         # Set up TCP connection 
  2126.         set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(k1) 0]
  2127.         $tcp1 set window_ 30
  2128.         $tcp1 set ecn_ 1
  2129.         set ftp1 [$tcp1 attach-app FTP]
  2130.         $ns_ at 0.0 "$ftp1 start"
  2131.         # Set up TCP connection
  2132.         set tcp2 [$ns_ create-connection TCP $node_(s2) TCPSink $node_(k1) 1]
  2133.         $tcp2 set window_ 20
  2134.         $tcp2 set ecn_ 0
  2135.         set ftp2 [$tcp2 attach-app FTP]
  2136.         $ns_ at 3.0 "$ftp2 start"
  2137.         $self tcpDump $tcp1 5.0
  2138.         $self tcpDump $tcp2 5.0 
  2139.         #$self traceQueues $node_(r1) [$self openTrace 10.0 $testName_]
  2140. $ns_ at 10.0 "$self cleanupAll $testName_" 
  2141.         $ns_ run
  2142. }
  2143. TestSuite runTest