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

通讯编程

开发平台:

Visual C++

  1. #
  2. # Copyright (c) 2000  International Computer Science Institute
  3. # All rights reserved.
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions
  6. # are met:
  7. # 1. Redistributions of source code must retain the above copyright
  8. #    notice, this list of conditions and the following disclaimer.
  9. # 2. Redistributions in binary form must reproduce the above copyright
  10. #    notice, this list of conditions and the following disclaimer in the
  11. #    documentation and/or other materials provided with the distribution.
  12. # 3. All advertising materials mentioning features or use of this software
  13. #    must display the following acknowledgement:
  14. #      This product includes software developed by ACIRI, the AT&T
  15. #      Center for Internet Research at ICSI (the International Computer
  16. #      Science Institute).
  17. # 4. Neither the name of ACIRI nor of ICSI may be used
  18. #    to endorse or promote products derived from this software without
  19. #    specific prior written permission.
  20. # THIS SOFTWARE IS PROVIDED BY ICSI AND CONTRIBUTORS ``AS IS'' AND
  21. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23. # ARE DISCLAIMED.  IN NO EVENT SHALL ICSI OR CONTRIBUTORS BE LIABLE
  24. # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  26. # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  28. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  29. # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. # SUCH DAMAGE.
  31. #
  32. set dir [pwd]
  33. catch "cd tcl/test"
  34. source misc_simple.tcl
  35. Agent/TCP set tcpTick_ 0.1
  36. # The default for tcpTick_ is being changed to reflect a changing reality.
  37. Agent/TCP set rfc2988_ false
  38. # The default for rfc2988_ is being changed to true.
  39. # FOR UPDATING GLOBAL DEFAULTS:
  40. Agent/TCP set precisionReduce_ false ;   # default changed on 2006/1/24.
  41. Agent/TCP set rtxcur_init_ 6.0 ;      # Default changed on 2006/01/21
  42. Agent/TCP set updated_rttvar_ false ;  # Variable added on 2006/1/21
  43. Agent/TCP set minrto_ 1
  44. # default changed on 10/14/2004.
  45. Queue/RED set bytes_ false              
  46. # default changed on 10/11/2004.
  47. Queue/RED set queue_in_bytes_ false
  48. # default changed on 10/11/2004.
  49. Queue/RED set q_weight_ 0.002
  50. Queue/RED set thresh_ 5 
  51. Queue/RED set maxthresh_ 15
  52. # The RED parameter defaults are being changed for automatic configuration.
  53. Agent/TCP set useHeaders_ false
  54. # The default is being changed to useHeaders_ true.
  55. Agent/TCP set windowInit_ 1
  56. # The default is being changed to 2.
  57. Agent/TCP set singledup_ 0
  58. # The default is being changed to 1
  59. catch "cd $dir"
  60. Queue/RED set gentle_ true
  61. Agent/Pushback set verbose_ false
  62. #Agent/Pushback set verbose_ true
  63. Queue/RED/Pushback set rate_limiting_ 0
  64. Agent/Pushback set enable_pushback_ 0
  65. set flowfile fairflow.tr; # file where flow data is written
  66. set flowgraphfile fairflow.xgr; # file given to graph tool 
  67. TestSuite instproc finish file {
  68. global quiet PERL
  69. $self instvar ns_ tchan_ testName_ tmpschan_ maxAggregates_
  70. # was: -s 2 -d 3 
  71.         #exec $PERL ../../bin/getrc -s 12 -d 13 all.tr | 
  72.         #  $PERL ../../bin/raw2xg -a -s 0.01 -m 90 -t $file > temp2.rands
  73. #if {$quiet == "false"} {
  74.         # exec xgraph -bb -tk -nl -m -x time -y packets temp2.rands &
  75. #}
  76.         ## now use default graphing tool to make a data file
  77.         ## if so desired
  78. if { [info exists tchan_] && $quiet == "false" } {
  79. #$self plotQueue $testName_
  80. }
  81. if { [info exists tmpschan_]} {
  82. $self finishflows $testName_ $maxAggregates_
  83. close $tmpschan_
  84. }
  85. $ns_ halt
  86. }
  87. # display graph of results
  88. #
  89. # temp.s:
  90. # time: 4.000 LinkUtilThisTime  1.002 totalLinkUtil: 1.000 totalOQPkts: 1250
  91. # fid: 1 Util: 0.124 OQdroprate: 0.320 OQpkts: 155 OQdrops: 73
  92. #
  93. TestSuite instproc finishflows {testname maxAggregate} {
  94.         global quiet
  95.         $self instvar tmpschan_ tmpqchan_ topo_ node_ ns_
  96. $self instvar packetsize_
  97.         $topo_ instvar cbqlink_ bandwidth1_
  98.         set graphfile temp.rands
  99.         set maxbytes [expr $bandwidth1_ / 8.0]
  100. set maxpkts [expr 1.0 * $maxbytes / $packetsize_]
  101.         set awkCode  {
  102. {
  103. if ($1 == 0) {time=1; oldpkts=0;}
  104. if ($1 == "time:" && $3 == "LinkUtilThisTime") {
  105. time = $2
  106. }
  107. if ($1 == "fid:" && $2==flow) {
  108.   newpkts = $8;
  109.   pkts = newpkts - oldpkts;
  110.   print time, pkts/maxpkts;
  111.   oldpkts = newpkts
  112. }}
  113.         }
  114.         set awkCodeAll {
  115. {
  116. if ($1==0) {oldpkts=0}
  117. if ($1 == "time:" && $7 == "totalOQPkts:") {
  118. time = $2;
  119.    newpkts = $8;
  120.    pkts = newpkts - oldpkts;
  121.    print time, pkts/maxpkts;
  122.    oldpkts = newpkts
  123. }}
  124.         }
  125.         set awkCodeDrop {
  126. {
  127. if ($1==0) {oldpkts = 0; olddrops = 0; time=0;}
  128. if ($5~"totalOQDrops:"){
  129.   time = $2;
  130.   pkts = $4;
  131.   drops = $6;
  132.   newpkts = pkts - oldpkts;
  133.   newdrops = drops - olddrops;
  134.   print time, newdrops/newpkts;
  135.   oldpkts = pkts; olddrops = drops;
  136. }}
  137. }
  138.         if { [info exists tmpschan_] } {
  139.                 close $tmpschan_
  140.         }
  141.         set f [open $graphfile w]
  142.         puts $f "TitleText: $testname"
  143.         puts $f "Device: Postscript"
  144.         exec rm -f temp.p
  145.         exec touch temp.p
  146. for {set i 1} {$i < $maxAggregate + 1 } {incr i} {
  147.                 exec echo "n"flow $i" >> temp.p
  148.                 exec awk $awkCode flow=$i maxpkts=$maxpkts temp.s > flows$i
  149.                 exec cat flows$i >> temp.p
  150.                 exec echo " " >> temp.p
  151.         }
  152.         exec awk $awkCodeAll maxpkts=$maxpkts temp.s > all
  153.         exec echo "n"all " >> temp.p
  154.         exec cat all >> temp.p  
  155.         exec cat temp.p >@ $f
  156.         close $f
  157.         exec awk $awkCodeDrop temp.s > temp.droprate
  158.         if {$quiet == "false"} {
  159.                 exec xgraph -bb -tk -ly 0,1 -x time -y bandwidth $graphfile &
  160.         }
  161. #       exec csh gnuplotE.com $testname
  162. #       exec csh gnuplotF.com $testname
  163.         exit 0
  164. }
  165. Class Topology
  166. Topology instproc node? num {
  167.     $self instvar node_
  168.     return $node_($num)
  169. }
  170. Class Topology/net2 -superclass Topology
  171. Topology/net2 instproc init ns {
  172.     $self instvar node_ bandwidth_ bandwidth1_
  173.     set bandwidth_ 0.5Mb
  174.     set bandwidth1_ 500000
  175.     #the destinations; declared first 
  176.     for {set i 0} {$i < 2} {incr i} {
  177.         set node_(d$i) [$ns node]
  178.     }
  179.     #the routers
  180.     for {set i 0} {$i < 4} {incr i} {
  181.         set node_(r$i) [$ns node]
  182.         #$node_(r$i) add-pushback-agent
  183.     }
  184.     $node_(r0) add-pushback-agent
  185.     #the sources
  186.     for {set i 0} {$i < 4} {incr i} {
  187.         set node_(s$i) [$ns node]
  188.     }
  189.     $self next 
  190.     $ns duplex-link $node_(s0) $node_(r0) 10Mb 2ms DropTail
  191.     $ns duplex-link $node_(s1) $node_(r0) 10Mb 3ms DropTail
  192.     $ns pushback-simplex-link $node_(r0) $node_(r1) $bandwidth_ 10ms 
  193.     $ns simplex-link $node_(r1) $node_(r0) $bandwidth_ 10ms DropTail
  194.     $ns duplex-link $node_(d0) $node_(r1) 10Mb 2ms DropTail
  195.     $ns duplex-link $node_(d1) $node_(r1) 10Mb 2ms DropTail
  196.     $ns queue-limit $node_(r0) $node_(r1) 100
  197.     $ns queue-limit $node_(r1) $node_(r0) 100
  198. }   
  199. Class Topology/net3 -superclass Topology
  200. Topology/net3 instproc init ns {
  201.     $self next 
  202.     $self instvar node_ bandwidth_ bandwidth1_
  203.     set bandwidth_ 1.0Mb
  204.     set bandwidth1_ 1000000
  205.     #the destinations; declared first 
  206.     for {set i 0} {$i < 2} {incr i} {
  207.         set node_(d$i) [$ns node]
  208.     }
  209.     #the routers
  210.     for {set i 0} {$i < 4} {incr i} {
  211.         set node_(r$i) [$ns node]
  212. $node_(r$i) add-pushback-agent
  213.     }
  214.     #the sources
  215.     for {set i 0} {$i < 4} {incr i} {
  216.         set node_(s$i) [$ns node]
  217. set pushback($i) [$node_(s$i) add-pushback-agent]
  218.     }
  219.     $ns pushback-duplex-link $node_(s0) $node_(r2) 10Mb 2ms 
  220.     #$ns duplex-link $node_(s0) $node_(r2) 10Mb 2ms DropTail
  221.     $ns pushback-duplex-link $node_(s1) $node_(r2) 10Mb 3ms
  222.     #$ns duplex-link $node_(s1) $node_(r3) 10Mb 3ms DropTail
  223.     $ns pushback-duplex-link $node_(s2) $node_(r3) 10Mb 3ms
  224.     $ns pushback-duplex-link $node_(s3) $node_(r3) 10Mb 3ms
  225.     $ns pushback-duplex-link $node_(r0) $node_(r1) $bandwidth_ 10ms 
  226.     $ns pushback-duplex-link $node_(r2) $node_(r0) 10Mb 10ms 
  227.     $ns pushback-duplex-link $node_(r3) $node_(r0) 10Mb 10ms 
  228.     #
  229.     $ns pushback-simplex-link $node_(r1) $node_(d0) 10Mb 2ms
  230.     $ns simplex-link $node_(d0) $node_(r1) 10Mb 2ms DropTail
  231.     #$ns duplex-link $node_(d0) $node_(r1) 10Mb 2ms DropTail
  232.     #
  233.     $ns pushback-simplex-link $node_(r1) $node_(d1) 10Mb 2ms 
  234.     $ns simplex-link $node_(d1) $node_(r1) 10Mb 2ms DropTail
  235.     #$ns duplex-link $node_(d1) $node_(r1) 10Mb 2ms DropTail
  236.     $ns queue-limit $node_(r0) $node_(r1) 100
  237.     $ns queue-limit $node_(r1) $node_(r0) 100
  238. }   
  239. TestSuite instproc new-tcp {source dest size window fid startTime} {
  240.     $self instvar ns_
  241.     set tcp [$ns_ create-connection TCP/Sack1 $source TCPSink/Sack1 $dest $fid]
  242.     $tcp set window_ $window
  243.     $tcp set tcpTick_ 0.01
  244.     if {$size > 0}  {
  245.         $tcp set packetSize_ $size
  246.     }
  247.     set ftp [$tcp attach-source FTP]
  248.     #if {$maxPkts > 0} {$ftp set maxpkts_ $maxPkts}
  249.     $ns_ at $startTime "$ftp start"
  250. }
  251. TestSuite instproc new-cbr {src dst pktSize rate fid startTime {stopTime -1}} {
  252.     $self instvar ns_
  253.     set udp [$ns_ create-connection UDP $src Null $dst $fid]
  254.     set cbr [$udp attach-app Traffic/CBR]
  255.     $cbr set packetSize_ $pktSize
  256.     $cbr set rate_ $rate
  257.     $cbr set random_ 1
  258.     $ns_ at $startTime "$cbr start"
  259.     if {$stopTime != -1} {
  260.         $ns_ at $stopTime "$cbr set rate_ 1000"
  261.     }
  262.     return $cbr
  263. }
  264. #    
  265. # Arrange for time to be printed every
  266. # $interval seconds of simulation time
  267. #    
  268. TestSuite instproc statsDump { interval fmon packetsize oldpkts } {
  269.         global quiet 
  270.         $self instvar dump_inst_ ns_ tmpschan_ f
  271. $self instvar maxAggregates_
  272. set dumpfile temp.s
  273.         if ![info exists dump_inst_] {
  274. $self instvar tmpschan_ f
  275.                 set dump_inst_ 1
  276. set f [open $dumpfile w]
  277. set tmpschan_ $f
  278.                 $ns_ at 0.0 "$self statsDump $interval $fmon $packetsize $oldpkts"
  279.                 return
  280.         }
  281.         set time [$ns_ now]
  282.         puts $f "$time"
  283.         set newtime [expr [$ns_ now] + $interval]
  284. ## $quiet == "false"
  285.         if { $time > 0} {
  286.             set totalPkts [$fmon set pdepartures_]
  287.             set totalArrivals [$fmon set parrivals_]
  288.     set totalDrops [$fmon set pdrops_]
  289.             set packets [expr $totalPkts - $oldpkts]
  290.             set oldpkts $totalPkts
  291.          set linkBps [ expr 500000/8 ]
  292.          set recentUtil [expr (1.0*$packets*$packetsize)/($interval*$linkBps)]
  293.          set totalLinkUtil [expr (1.0*$totalPkts*$packetsize)/($time*$linkBps)]
  294.             set now [$ns_ now]
  295.     puts $f "time: [format %.3f $now] totalOQArrivals: $totalArrivals totalOQDrops: $totalDrops"
  296.          puts $f "time: [format %.3f $now] LinkUtilThisTime  [format %.3f $recentUtil] totalLinkUtil: [format %.3f $totalLinkUtil] totalOQPkts: $totalPkts" 
  297.          set fcl [$fmon classifier];
  298.     ## this 
  299.     for {set i 1} {$i < $maxAggregates_ + 1} {incr i} {
  300.              set flow [$fcl lookup auto 0 0 $i]
  301. if {$flow != "" } {
  302.   set flowpkts($flow) [$flow set pdepartures_]
  303.                set flowutil [expr (1.0*$flowpkts($flow)*$packetsize)/($time*$linkBps)]
  304.   set flowdrops($flow) [$flow set pdrops_]
  305.   if {$flowpkts($flow) + $flowdrops($flow) > 0} {
  306.                  set flowdroprate [expr (1.0*$flowdrops($flow)/($flowpkts($flow) + $flowdrops($flow)))] 
  307.                   } else { set flowdroprate 0 }
  308.   puts $f "fid: $i Util: [format %.3f $flowutil] OQdroprate: [format %.3f $flowdroprate] OQpkts: [format %d $flowpkts($flow)] OQdrops: [format %d $flowdrops($flow)]"
  309. }
  310.     }
  311.         }
  312.         $ns_ at $newtime "$self statsDump $interval $fmon $packetsize $oldpkts"
  313. }
  314. TestSuite instproc setup {} {
  315.     $self instvar ns_ node_ testName_ net_ topo_ cbr_ cbr2_ packetsize_
  316.     $self instvar maxAggregates_
  317.     set stoptime 100.0
  318.     #set stoptime 5.0
  319.     #set dumptime 5.0
  320.     set dumptime 1.0
  321.     set stoptime1 [expr $stoptime + 1.0]
  322.     set packetsize_ 200
  323.     Application/Traffic/CBR set random_ 0
  324.     Application/Traffic/CBR set packetSize_ $packetsize_
  325.     set slink [$ns_ link $node_(r0) $node_(r1)]; # link to collect stats on
  326.     set fmon [$ns_ makeflowmon Fid]
  327.     $ns_ attach-fmon $slink $fmon
  328.     set udp1 [$ns_ create-connection UDP $node_(s0) Null $node_(d0) 1]
  329.     set cbr1 [$udp1 attach-app Traffic/CBR]
  330.     $cbr1 set rate_ 0.12Mb
  331.     $cbr1 set random_ 0.005
  332.     set udp2 [$ns_ create-connection UDP $node_(s1) Null $node_(d1) 2]
  333.     set cbr2_ [$udp2 attach-app Traffic/CBR]
  334.     $cbr2_ set rate_ 0.08Mb
  335.     $cbr2_ set random_ 0.005
  336.     # bad traffic
  337.     set udp [$ns_ create-connection UDP $node_(s0) Null $node_(d1) 3]
  338.     set cbr_ [$udp attach-app Traffic/CBR]
  339.     $cbr_ set rate_ 0.5Mb
  340.     $cbr_ set random_ 0.001
  341.     $ns_ at 0.0 "$cbr_ start"
  342.     set udp4 [$ns_ create-connection UDP $node_(s1) Null $node_(d0) 4]
  343.     set cbr4 [$udp4 attach-app Traffic/CBR]
  344.     $cbr4 set rate_ 0.07Mb
  345.     $cbr4 set random_ 0.005
  346.     set udp5 [$ns_ create-connection UDP $node_(s0) Null $node_(d0) 5]
  347.     set cbr5 [$udp5 attach-app Traffic/CBR]
  348.     $cbr5 set rate_ 0.06Mb
  349.     $cbr5 set random_ 0.005
  350.     set udp6 [$ns_ create-connection UDP $node_(s0) Null $node_(d0) 6]
  351.     set cbr6 [$udp6 attach-app Traffic/CBR]
  352.     $cbr6 set rate_ 0.05Mb
  353.     $cbr6 set random_ 0.005
  354.     set maxAggregates_ 6
  355.     $ns_ at 0.2 "$cbr1 start"
  356.     $ns_ at 0.1 "$cbr2_ start"
  357.     $ns_ at 0.3 "$cbr4 start"
  358.     $ns_ at 0.4 "$cbr5 start"
  359.     $self statsDump $dumptime $fmon $packetsize_ 0
  360.     # trace only the bottleneck link
  361.     #$self traceQueues $node_(r1) [$self openTrace $stoptime $testName_]
  362.     $ns_ at $stoptime1 "$self cleanupAll $testName_"
  363. }
  364. #
  365. # one complete test with CBR flows only, no pushback and no ACC.
  366. #
  367. Class Test/cbrs -superclass TestSuite
  368. Test/cbrs instproc init {} {
  369.     $self instvar net_ test_
  370.     set net_ net2 
  371.     set test_ cbrs
  372.     $self next noTraceFiles
  373. }
  374. Test/cbrs instproc run {} {
  375.     $self instvar ns_ node_ testName_ net_ topo_
  376.     $self setTopo
  377.     $self setup
  378.     $ns_ run
  379. }
  380. #
  381. # one complete test with CBR flows only, with ACC.
  382. #
  383. Class Test/cbrs-acc -superclass TestSuite
  384. Test/cbrs-acc instproc init {} {
  385.     $self instvar net_ test_
  386.     set net_ net2 
  387.     set test_ cbrs-acc
  388.     Queue/RED/Pushback set rate_limiting_ 1
  389.     Test/cbrs-acc instproc run {} [Test/cbrs info instbody run]
  390.     $self next noTraceFiles
  391. }
  392. #
  393. # one complete test with CBR flows only, with no ACC
  394. # CBR flows flows starting and stopping 
  395. #
  396. Class Test/cbrs1 -superclass TestSuite
  397. Test/cbrs1 instproc init {} {
  398.     $self instvar net_ test_
  399.     set net_ net2 
  400.     set test_ cbrs1
  401.     $self next noTraceFiles
  402. }
  403. Test/cbrs1 instproc run {} {
  404.     $self instvar ns_ node_ testName_ net_ topo_ cbr_ cbr2_
  405.     $self setTopo
  406.     $self setup
  407.     $ns_ at 10.0 "$cbr_ set rate_ 0.1Mb"
  408.     $ns_ at 15.0 "$cbr2_ set rate_ 0.5Mb"
  409.     $ns_ run
  410. }
  411. #
  412. # one complete test with CBR flows only, with ACC 
  413. # CBR flows flows starting and stopping 
  414. #
  415. Class Test/cbrs-acc1 -superclass TestSuite
  416. Test/cbrs-acc1 instproc init {} {
  417.     $self instvar net_ test_
  418.     set net_ net2 
  419.     set test_ cbrs-acc1
  420.     Queue/RED/Pushback set rate_limiting_ 1
  421.     Test/cbrs-acc1 instproc run {} [Test/cbrs1 info instbody run]
  422.     $self next noTraceFiles
  423. }
  424. TestSuite instproc setup1 {} {
  425.     $self instvar ns_ node_ testName_ net_ topo_ cbr_ cbr2_ packetsize_
  426.     $self instvar maxAggregates_
  427.     set stoptime 50.0
  428.     #set dumptime 5.0
  429.     set dumptime 1.0
  430.     #set stoptime 5.0
  431.     set stoptime1 [expr $stoptime + 1.0]
  432.     set packetsize_ 200
  433.     Application/Traffic/CBR set random_ 0.001
  434.     Application/Traffic/CBR set packetSize_ $packetsize_
  435.     set slink [$ns_ link $node_(r0) $node_(r1)]; # link to collect stats on
  436.     set fmon [$ns_ makeflowmon Fid]
  437.     $ns_ attach-fmon $slink $fmon
  438.     $self new-cbr $node_(s0) $node_(d0) $packetsize_ 0.12Mb 1 0.1 
  439.     $self new-cbr $node_(s1) $node_(d1) $packetsize_ 0.08Mb 2 0.2
  440.     $self new-cbr $node_(s1) $node_(d1) $packetsize_ 0.07Mb 3 0.3
  441.     $self new-cbr $node_(s1) $node_(d1) $packetsize_ 0.06Mb 4 0.4
  442.     $self new-cbr $node_(s1) $node_(d1) $packetsize_ 0.04Mb 5 0.5
  443.     # bad traffic
  444.     set cbr_ [$self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.09Mb 5 0.0]
  445.     set maxAggregates_ 5
  446.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.1Mb 5 13.0 39.0
  447.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.1Mb 5 14.0 38.0
  448.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.05Mb 5 15.0 37.0
  449.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.05Mb 5 16.0 36.0
  450.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.05Mb 5 17.0 35.0
  451.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.05Mb 5 18.0 34.0
  452.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.05Mb 5 19.0 33.0
  453.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.05Mb 5 20.0 32.0
  454.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.05Mb 5 21.0 31.0
  455.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.05Mb 5 22.0 30.0
  456.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.05Mb 5 23.0 29.0
  457.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.05Mb 5 24.0 28.0
  458.     $self new-cbr $node_(s0) $node_(d1) $packetsize_ 0.05Mb 5 25.0 27.0
  459.     $self statsDump $dumptime $fmon $packetsize_ 0
  460.     # trace only the bottleneck link
  461.     #$self traceQueues $node_(r1) [$self openTrace $stoptime $testName_]
  462.     $ns_ at $stoptime1 "$self cleanupAll $testName_"
  463. }
  464. #
  465. # one complete test with CBR flows only, no pushback and no ACC.
  466. # Slowly-growing bad CBR aggregate.
  467. #
  468. Class Test/slowgrow -superclass TestSuite
  469. Test/slowgrow instproc init {} {
  470.     $self instvar net_ test_
  471.     set net_ net2 
  472.     set test_ slowgrow
  473.     $self next noTraceFiles
  474. }
  475. Test/slowgrow instproc run {} {
  476.     $self instvar ns_ node_ testName_ net_ topo_
  477.     $self setTopo
  478.     $self setup1
  479.     $ns_ run
  480. }
  481. #
  482. # one complete test with CBR flows only, with ACC.
  483. # Slowly-growing bad CBR aggregate.
  484. #
  485. Class Test/slowgrow-acc -superclass TestSuite
  486. Test/slowgrow-acc instproc init {} {
  487.     $self instvar net_ test_
  488.     set net_ net2 
  489.     set test_ slowgrow-acc
  490.     Queue/RED/Pushback set rate_limiting_ 1
  491.     Test/slowgrow-acc instproc run {} [Test/slowgrow info instbody run]
  492.     $self next noTraceFiles
  493. }
  494. ######################################################33
  495. TestSuite instproc setup6 {} {
  496.     $self instvar ns_ node_ testName_ net_ topo_ cbr_ cbr2_ packetsize_
  497.     $self instvar maxAggregates_
  498.     set stoptime 50.0
  499.     #set dumptime 5.0
  500.     set dumptime 1.0
  501.     #set stoptime 5.0
  502.     set stoptime1 [expr $stoptime + 1.0]
  503.     set packetsize_ 500
  504.     Application/Traffic/CBR set random_ 0
  505.     Application/Traffic/CBR set packetSize_ $packetsize_
  506.     set slink [$ns_ link $node_(r0) $node_(r1)]; # link to collect stats on
  507.     set fmon [$ns_ makeflowmon Fid]
  508.     $ns_ attach-fmon $slink $fmon
  509.     Application/Traffic/CBR set random_ 0.001 
  510.     $self new-cbr $node_(s0) $node_(d0) 500 0.12Mb 1 0.1 
  511.     $self new-tcp $node_(s0) $node_(d0) 500 10 2 1.2
  512.     $self new-tcp $node_(s1) $node_(d1) 500 10 3 2.3
  513.     $self new-tcp $node_(s1) $node_(d1) 500 10 3 3.4
  514.     $self new-tcp $node_(s0) $node_(d1) 500 10 4 5.6
  515.     $self new-tcp $node_(s0) $node_(d1) 500 10 4 6.7
  516.     $self new-tcp $node_(s1) $node_(d0) 500 20 4 7.7
  517.     # bad traffic
  518.     set cbr_ [$self new-cbr $node_(s0) $node_(d1) 500 0.1Mb 5 0.0]
  519.     $cbr_ set random_ 0.001
  520.     set maxAggregates_ 6
  521.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 13.0 39.0
  522.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 14.0 38.0
  523.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 15.0 37.0
  524.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 16.0 36.0
  525.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 17.0 35.0
  526.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 18.0 34.0
  527.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 19.0 33.0
  528.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 20.0 32.0
  529.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 21.0 31.0
  530.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 22.0 30.0
  531.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 23.0 29.0
  532.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 24.0 28.0
  533.     $self new-cbr $node_(s0) $node_(d1) 500 0.05Mb 5 25.0 27.0
  534.     $self statsDump $dumptime $fmon $packetsize_ 0
  535.     # trace only the bottleneck link
  536.     #$self traceQueues $node_(r1) [$self openTrace $stoptime $testName_]
  537.     $ns_ at $stoptime1 "$self cleanupAll $testName_"
  538. }
  539. #
  540. # Slowly-growing bad CBR aggregate, competing TCP and CBR traffic, no ACC.
  541. #
  542. Class Test/demo -superclass TestSuite
  543. Test/demo instproc init {} {
  544.     $self instvar net_ test_
  545.     set net_ net2 
  546.     set test_ demo
  547.     $self next noTraceFiles
  548. }
  549. Test/demo instproc run {} {
  550.     $self instvar ns_ node_ testName_ net_ topo_
  551.     $self setTopo
  552.     $self setup6
  553.     $ns_ run
  554. }
  555. #
  556. # Slowly-growing bad CBR aggregate, competing TCP and CBR traffic, local ACC.
  557. #
  558. Class Test/demo-acc -superclass TestSuite
  559. Test/demo-acc instproc init {} {
  560.     $self instvar net_ test_
  561.     set net_ net2 
  562.     set test_ demo-acc
  563.     Queue/RED/Pushback set rate_limiting_ 1
  564.     Test/demo-acc instproc run {} [Test/demo info instbody run]
  565.     $self next noTraceFiles
  566. }
  567. ######################################################33
  568. TestSuite instproc manytcps {starttime} {
  569.     $self instvar ns_ node_
  570.     set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s0) TCPSink/Sack1 $node_(d0) 1 ]
  571.     $tcp1 set window_ 10
  572.     set ftp1 [$tcp1 attach-app FTP]
  573.     $ns_ at $starttime.0 "$ftp1 start"
  574.     set tcp2 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 2 ]
  575.     $tcp2 set window_ 12
  576.     set ftp2 [$tcp2 attach-app FTP]
  577.     $ns_ at $starttime.1 "$ftp2 start"
  578.     set tcp3 [$ns_ create-connection TCP/Sack1 $node_(s0) TCPSink/Sack1 $node_(d1) 3 ]
  579.     $tcp3 set window_ 15
  580.     set ftp3 [$tcp3 attach-app FTP]
  581.     $ns_ at $starttime.2 "$ftp3 start"
  582.     set tcp4 [$ns_ create-connection TCP/Sack1 $node_(s0) TCPSink/Sack1 $node_(d0) 4 ]
  583.     $tcp4 set window_ 8
  584.     set ftp4 [$tcp4 attach-app FTP]
  585.     $ns_ at $starttime.3 "$ftp4 start"
  586.     set tcp5 [$ns_ create-connection TCP/Sack1 $node_(s0) TCPSink/Sack1 $node_(d1) 5 ]
  587.     $tcp5 set window_ 4
  588.     set ftp5 [$tcp5 attach-app FTP]
  589.     $ns_ at $starttime.4 "$ftp5 start"
  590. }
  591. TestSuite instproc badtcps {} {
  592.     $self instvar ns_ node_
  593.     Agent/TCP set window_ 100
  594.     # bad traffic
  595.     set tcp [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  596.     $tcp set window_ 1000
  597.     set ftp [$tcp attach-app FTP]
  598.     $ns_ at 11.0 "$ftp start"
  599.     $ns_ at 50.0 "$ftp stop"
  600.     set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  601.     $tcp1 set window_ 1000
  602.     set ftp1 [$tcp attach-app FTP]
  603.     $ns_ at 12.0 "$ftp1 start"
  604.     $ns_ at 49.0 "$ftp1 stop"
  605.     set tcp2 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  606.     $tcp2 set window_ 1000
  607.     set ftp2 [$tcp attach-app FTP]
  608.     $ns_ at 13.0 "$ftp2 start"
  609.     $ns_ at 48.0 "$ftp2 stop"
  610.     set tcp3 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  611.     $tcp3 set window_ 1000
  612.     set ftp3 [$tcp attach-app FTP]
  613.     $ns_ at 14.0 "$ftp3 start"
  614.     $ns_ at 47.0 "$ftp3 stop"
  615.     set tcp4 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  616.     $tcp4 set window_ 1000
  617.     set ftp4 [$tcp attach-app FTP]
  618.     $ns_ at 15.0 "$ftp4 start"
  619.     $ns_ at 46.0 "$ftp4 stop"
  620.     set tcp [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  621.     set ftp [$tcp attach-app FTP]
  622.     $ns_ at 16.0 "$ftp start"
  623.     $ns_ at 45.0 "$ftp stop"
  624.     set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  625.     set ftp1 [$tcp attach-app FTP]
  626.     $ns_ at 17.0 "$ftp1 start"
  627.     $ns_ at 44.0 "$ftp1 stop"
  628.     set tcp2 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  629.     set ftp2 [$tcp attach-app FTP]
  630.     $ns_ at 18.0 "$ftp2 start"
  631.     $ns_ at 43.0 "$ftp2 stop"
  632.     set tcp3 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  633.     set ftp3 [$tcp attach-app FTP]
  634.     $ns_ at 19.0 "$ftp3 start"
  635.     $ns_ at 42.0 "$ftp3 stop"
  636.     set tcp4 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  637.     set ftp4 [$tcp attach-app FTP]
  638.     $ns_ at 20.0 "$ftp4 start"
  639.     $ns_ at 41.0 "$ftp4 stop"
  640.     set tcp [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  641.     $tcp set window_ 1000
  642.     set ftp [$tcp attach-app FTP]
  643.     $ns_ at 21.0 "$ftp start"
  644.     $ns_ at 40.0 "$ftp stop"
  645.     set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  646.     $tcp1 set window_ 1000
  647.     set ftp1 [$tcp attach-app FTP]
  648.     $ns_ at 22.0 "$ftp1 start"
  649.     $ns_ at 39.0 "$ftp1 stop"
  650.     set tcp2 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  651.     $tcp2 set window_ 1000
  652.     set ftp2 [$tcp attach-app FTP]
  653.     $ns_ at 23.0 "$ftp2 start"
  654.     $ns_ at 38.0 "$ftp2 stop"
  655.     set tcp3 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  656.     $tcp3 set window_ 1000
  657.     set ftp3 [$tcp attach-app FTP]
  658.     $ns_ at 24.0 "$ftp3 start"
  659.     $ns_ at 37.0 "$ftp3 stop"
  660.     set tcp4 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(d0) 5 ]
  661.     $tcp4 set window_ 1000
  662.     set ftp4 [$tcp attach-app FTP]
  663.     $ns_ at 25.0 "$ftp4 start"
  664.     $ns_ at 36.0 "$ftp4 stop"
  665. }
  666. TestSuite instproc badcbr {} {
  667.     $self instvar ns_ node_
  668.     set udp [$ns_ create-connection UDP $node_(s0) Null $node_(d1) 5]
  669.     set cbr_ [$udp attach-app Traffic/CBR]
  670.     $cbr_ set rate_ 0.1Mb
  671.     $cbr_ set random_ 0.001
  672.     $ns_ at 0.0 "$cbr_ start"
  673.     $ns_ at 11.0 "$cbr_ set rate_ 0.15Mb"
  674.     $ns_ at 12.0 "$cbr_ set rate_ 0.2Mb"
  675.     $ns_ at 13.0 "$cbr_ set rate_ 0.25Mb"
  676.     $ns_ at 14.0 "$cbr_ set rate_ 0.3Mb"
  677.     $ns_ at 15.0 "$cbr_ set rate_ 0.35Mb"
  678.     $ns_ at 16.0 "$cbr_ set rate_ 0.4Mb"
  679.     $ns_ at 17.0 "$cbr_ set rate_ 0.45Mb"
  680.     $ns_ at 18.0 "$cbr_ set rate_ 0.5Mb"
  681.     $ns_ at 19.0 "$cbr_ set rate_ 0.55Mb"
  682.     $ns_ at 20.0 "$cbr_ set rate_ 0.6Mb"
  683.     $ns_ at 21.0 "$cbr_ set rate_ 0.65Mb"
  684.     $ns_ at 22.0 "$cbr_ set rate_ 0.7Mb"
  685.     $ns_ at 23.0 "$cbr_ set rate_ 0.75Mb"
  686.     $ns_ at 24.0 "$cbr_ set rate_ 0.8Mb"
  687.     $ns_ at 25.0 "$cbr_ set rate_ 0.855Mb"
  688.     $ns_ at 37.0 "$cbr_ set rate_ 0.8Mb"
  689.     $ns_ at 37.0 "$cbr_ set rate_ 0.75Mb"
  690.     $ns_ at 38.0 "$cbr_ set rate_ 0.7Mb"
  691.     $ns_ at 39.0 "$cbr_ set rate_ 0.65Mb"
  692.     $ns_ at 40.0 "$cbr_ set rate_ 0.6Mb"
  693.     $ns_ at 41.0 "$cbr_ set rate_ 0.55Mb"
  694.     $ns_ at 42.0 "$cbr_ set rate_ 0.5Mb"
  695.     $ns_ at 43.0 "$cbr_ set rate_ 0.45Mb"
  696.     $ns_ at 44.0 "$cbr_ set rate_ 0.4Mb"
  697.     $ns_ at 45.0 "$cbr_ set rate_ 0.35Mb"
  698.     $ns_ at 46.0 "$cbr_ set rate_ 0.3Mb"
  699.     $ns_ at 47.0 "$cbr_ set rate_ 0.25Mb"
  700.     $ns_ at 48.0 "$cbr_ set rate_ 0.2Mb"
  701.     $ns_ at 49.0 "$cbr_ set rate_ 0.15Mb"
  702.     $ns_ at 50.0 "$cbr_ set rate_ 0.1Mb"
  703. }
  704. TestSuite instproc setup4 {} {
  705.     $self instvar ns_ node_ testName_ net_ topo_ cbr_ cbr2_ packetsize_
  706.     $self instvar maxAggregates_
  707.     set stoptime 60.0
  708.     #set dumptime 5.0
  709.     set dumptime 1.0
  710.     #set stoptime 5.0
  711.     set stoptime1 [expr $stoptime + 1.0]
  712.     set packetsize_ 200
  713.     Application/Traffic/CBR set random_ 0
  714.     Application/Traffic/CBR set packetSize_ $packetsize_
  715.     Agent/TCP set packetSize_ $packetsize_
  716.     set slink [$ns_ link $node_(r0) $node_(r1)]; # link to collect stats on
  717.     set fmon [$ns_ makeflowmon Fid]
  718.     $ns_ attach-fmon $slink $fmon
  719.     $self manytcps 0
  720.     set maxAggregates_ 6
  721.     $self badcbr
  722.     $self statsDump $dumptime $fmon $packetsize_ 0
  723.     # trace only the bottleneck link
  724.     #$self traceQueues $node_(r1) [$self openTrace $stoptime $testName_]
  725.     $ns_ at $stoptime1 "$self cleanupAll $testName_"
  726. }
  727. #
  728. # Slowly-growing CBR aggregate competing against small TCP aggregates.  
  729. # No ACC.
  730. #
  731. Class Test/tcp -superclass TestSuite
  732. Test/tcp instproc init {} {
  733.     $self instvar net_ test_
  734.     set net_ net2 
  735.     set test_ tcp
  736.     $self next noTraceFiles
  737. }
  738. Test/tcp instproc run {} {
  739.     $self instvar ns_ node_ testName_ net_ topo_
  740.     $self setTopo
  741.     $self setup4
  742.     $ns_ run
  743. }
  744. #
  745. # Slowly-growing CBR aggregate competing against small TCP aggregates.  
  746. # No pushback, but with local ACC.
  747. #
  748. Class Test/tcp-acc -superclass TestSuite
  749. Test/tcp-acc instproc init {} {
  750.     $self instvar net_ test_
  751.     set net_ net2 
  752.     set test_ tcp-acc
  753.     Queue/RED/Pushback set rate_limiting_ 1
  754.     Test/tcp-acc instproc run {} [Test/tcp info instbody run]
  755.     $self next noTraceFiles
  756. }
  757. TestSuite instproc setup4a {} {
  758.     $self instvar ns_ node_ testName_ net_ topo_ cbr_ cbr2_ packetsize_
  759.     $self instvar maxAggregates_
  760.     set stoptime 60.0
  761.     #set dumptime 5.0
  762.     set dumptime 1.0
  763.     #set stoptime 5.0
  764.     set stoptime1 [expr $stoptime + 1.0]
  765.     set packetsize_ 200
  766.     Application/Traffic/CBR set random_ 0
  767.     Application/Traffic/CBR set packetSize_ $packetsize_
  768.     Agent/TCP set packetSize_ $packetsize_
  769.     set slink [$ns_ link $node_(r0) $node_(r1)]; # link to collect stats on
  770.     set fmon [$ns_ makeflowmon Fid]
  771.     $ns_ attach-fmon $slink $fmon
  772.     $self manytcps 0
  773.     $self manytcps 1
  774.     $self manytcps 2
  775.     $self manytcps 3
  776.     $self manytcps 4
  777.     $self manytcps 5
  778.     set maxAggregates_ 6
  779.     $self badcbr
  780.     $self statsDump $dumptime $fmon $packetsize_ 0
  781.     # trace only the bottleneck link
  782.     #$self traceQueues $node_(r1) [$self openTrace $stoptime $testName_]
  783.     $ns_ at $stoptime1 "$self cleanupAll $testName_"
  784. }
  785. #
  786. # Slowly-growing CBR aggregate competing against large TCP aggregates.  
  787. # No ACC.
  788. #
  789. Class Test/tcp1 -superclass TestSuite
  790. Test/tcp1 instproc init {} {
  791.     $self instvar net_ test_
  792.     set net_ net2 
  793.     set test_ tcp1
  794.     $self next noTraceFiles
  795. }
  796. Test/tcp1 instproc run {} {
  797.     $self instvar ns_ node_ testName_ net_ topo_
  798.     $self setTopo
  799.     $self setup4a
  800.     $ns_ run
  801. }
  802. #
  803. # Slowly-growing CBR aggregate competing against large TCP aggregates.
  804. # No pushback, but with local ACC.
  805. #
  806. Class Test/tcp1-acc -superclass TestSuite
  807. Test/tcp1-acc instproc init {} {
  808.     $self instvar net_ test_
  809.     set net_ net2 
  810.     set test_ tcp1-acc
  811.     Queue/RED/Pushback set rate_limiting_ 1
  812.     Test/tcp1-acc instproc run {} [Test/tcp1 info instbody run]
  813.     $self next noTraceFiles
  814. }
  815. TestSuite instproc setup4b {} {
  816.     $self instvar ns_ node_ testName_ net_ topo_ cbr_ cbr2_ packetsize_
  817.     $self instvar maxAggregates_
  818.     set stoptime 60.0
  819.     #set dumptime 5.0
  820.     set dumptime 1.0
  821.     #set stoptime 5.0
  822.     set stoptime1 [expr $stoptime + 1.0]
  823.     set packetsize_ 200
  824.     Application/Traffic/CBR set random_ 0
  825.     Application/Traffic/CBR set packetSize_ $packetsize_
  826.     Agent/TCP set packetSize_ $packetsize_
  827.     set slink [$ns_ link $node_(r0) $node_(r1)]; # link to collect stats on
  828.     set fmon [$ns_ makeflowmon Fid]
  829.     $ns_ attach-fmon $slink $fmon
  830.     $self manytcps 0
  831.     $self manytcps 1
  832.     $self manytcps 2
  833.     $self manytcps 3
  834.     $self manytcps 4
  835.     $self manytcps 5
  836.     set maxAggregates_ 6
  837.     $self badtcps
  838.     $self badtcps
  839.     $self badtcps
  840.     $self badtcps
  841.     $self badtcps
  842.     $self badtcps
  843.     $self badtcps
  844.     $self badtcps
  845.     $self badtcps
  846.     $self badtcps
  847.     $self badtcps
  848.     $self statsDump $dumptime $fmon $packetsize_ 0
  849.     # trace only the bottleneck link
  850.     #$self traceQueues $node_(r1) [$self openTrace $stoptime $testName_]
  851.     $ns_ at $stoptime1 "$self cleanupAll $testName_"
  852. }
  853. #
  854. # Slowly-growing TCP aggregate competing against large TCP aggregates.  
  855. # No ACC.
  856. #
  857. Class Test/tcp2 -superclass TestSuite
  858. Test/tcp2 instproc init {} {
  859.     $self instvar net_ test_
  860.     set net_ net2 
  861.     set test_ tcp2
  862.     $self next noTraceFiles
  863. }
  864. Test/tcp2 instproc run {} {
  865.     $self instvar ns_ node_ testName_ net_ topo_
  866.     $self setTopo
  867.     $self setup4b
  868.     $ns_ run
  869. }
  870. #
  871. # Slowly-growing TCP aggregate competing against large TCP aggregates.  
  872. # No pushback, but with local ACC.
  873. #
  874. Class Test/tcp2-acc -superclass TestSuite
  875. Test/tcp2-acc instproc init {} {
  876.     $self instvar net_ test_
  877.     set net_ net2 
  878.     set test_ tcp2-acc
  879.     Queue/RED/Pushback set rate_limiting_ 1
  880.     Test/tcp2-acc instproc run {} [Test/tcp2 info instbody run]
  881.     $self next noTraceFiles
  882. }
  883. ######################################################33
  884. ## TestSuite instproc setup5 {} {
  885. ##     $self instvar ns_ node_ testName_ net_ topo_ cbr_ cbr2_ packetsize_
  886. ##     $self instvar maxAggregates_
  887. ## 
  888. ##     set stoptime 100.0
  889. ##     #set stoptime 5.0
  890. ##     #set dumptime 5.0
  891. ##     set dumptime 1.0
  892. ##     set stoptime1 [expr $stoptime + 1.0]
  893. ##     set packetsize_ 200
  894. ##     Application/Traffic/CBR set random_ 0
  895. ##     Application/Traffic/CBR set packetSize_ $packetsize_
  896. ## 
  897. ##     set slink [$ns_ link $node_(r0) $node_(r1)]; # link to collect stats on
  898. ##     set fmon [$ns_ makeflowmon Fid]
  899. ##     $ns_ attach-fmon $slink $fmon
  900. ## 
  901. ##     set udp1 [$ns_ create-connection UDP $node_(s0) Null $node_(d0) 1]
  902. ##     set cbr1 [$udp1 attach-app Traffic/CBR]
  903. ##     $cbr1 set rate_ 0.12Mb
  904. ##     $cbr1 set random_ 0.005
  905. ## 
  906. ##     set udp2 [$ns_ create-connection UDP $node_(s1) Null $node_(d1) 2]
  907. ##     set cbr2 [$udp2 attach-app Traffic/CBR]
  908. ##     $cbr2 set rate_ 0.08Mb
  909. ##     $cbr2 set random_ 0.005
  910. ## 
  911. ##     # bad traffic
  912. ##     set udp [$ns_ create-connection UDP $node_(s0) Null $node_(d1) 3]
  913. ##     set cbr_ [$udp attach-app Traffic/CBR]
  914. ##     $cbr_ set rate_ 0.5Mb
  915. ##     $cbr_ set random_ 0.001
  916. ##     $ns_ at 0.0 "$cbr_ start"
  917. ## 
  918. ##     set udp4 [$ns_ create-connection UDP $node_(s1) Null $node_(d0) 4]
  919. ##     set cbr4 [$udp4 attach-app Traffic/CBR]
  920. ##     $cbr4 set rate_ 0.07Mb
  921. ##     $cbr4 set random_ 0.005
  922. ## 
  923. ##     set udp5 [$ns_ create-connection UDP $node_(s0) Null $node_(d0) 5]
  924. ##     set cbr5 [$udp5 attach-app Traffic/CBR]
  925. ##     $cbr5 set rate_ 0.06Mb
  926. ##     $cbr5 set random_ 0.005
  927. ## 
  928. ##     set udp6 [$ns_ create-connection UDP $node_(s0) Null $node_(d0) 6]
  929. ##     set cbr6 [$udp6 attach-app Traffic/CBR]
  930. ##     $cbr6 set rate_ 0.05Mb
  931. ##     $cbr6 set random_ 0.005
  932. ## 
  933. ## 
  934. ##     set maxAggregates_ 6
  935. ## 
  936. ##     $ns_ at 0.2 "$cbr1 start"
  937. ##     $ns_ at 0.1 "$cbr2 start"
  938. ##     $ns_ at 0.3 "$cbr4 start"
  939. ##     $ns_ at 0.4 "$cbr5 start"
  940. ## 
  941. ##     $self statsDump $dumptime $fmon $packetsize_ 0
  942. ##     # trace only the bottleneck link
  943. ##     #$self traceQueues $node_(r1) [$self openTrace $stoptime $testName_]
  944. ##     $ns_ at $stoptime1 "$self cleanupAll $testName_"
  945. ## }
  946. ## 
  947. ## #
  948. ## #
  949. ## Class Test/onoff -superclass TestSuite
  950. ## Test/onoff instproc init {} {
  951. ##     $self instvar net_ test_
  952. ##     set net_ net2 
  953. ##     set test_ onoff
  954. ##     $self next noTraceFiles
  955. ## }
  956. ## Test/onoff instproc run {} {
  957. ##     $self instvar ns_ node_ testName_ net_ topo_
  958. ##     $self setTopo
  959. ##     $self setup5
  960. ##     $ns_ run
  961. ## }
  962. ## 
  963. ## #
  964. ## #
  965. ## Class Test/onoff-acc -superclass TestSuite
  966. ## Test/onoff-acc instproc init {} {
  967. ##     $self instvar net_ test_
  968. ##     set net_ net2 
  969. ##     set test_ onoff-acc
  970. ##     Queue/RED/Pushback set rate_limiting_ 1
  971. ##     Test/onoff-acc instproc run {} [Test/onoff info instbody run]
  972. ##     $self next noTraceFiles
  973. ## }
  974. ## 
  975. ######################################################33
  976. TestSuite instproc setup2 {} {
  977.     $self instvar ns_ node_ testName_ net_ topo_ cbr_ cbr2_ packetsize_
  978.     $self instvar maxAggregates_
  979.     set stoptime 100.0
  980.     set dumptime 1.0
  981.     set stoptime1 [expr $stoptime + 1.0]
  982.     set packetsize_ 200
  983.     Application/Traffic/CBR set random_ 0
  984.     Application/Traffic/CBR set packetSize_ $packetsize_
  985.     set slink [$ns_ link $node_(r0) $node_(r1)]; # link to collect stats on
  986.     set fmon [$ns_ makeflowmon Fid]
  987.     $ns_ attach-fmon $slink $fmon
  988.     set udp1 [$ns_ create-connection UDP $node_(s2) Null $node_(d0) 1]
  989.     set cbr1 [$udp1 attach-app Traffic/CBR]
  990.     $cbr1 set rate_ 0.2Mb
  991.     $cbr1 set random_ 0.001
  992.     set udp2 [$ns_ create-connection UDP $node_(s3) Null $node_(d0) 2]
  993.     set cbr2_ [$udp2 attach-app Traffic/CBR]
  994.     $cbr2_ set rate_ 0.2Mb
  995.     $cbr2_ set random_ 0.001
  996.     # bad traffic
  997.     set udp [$ns_ create-connection UDP $node_(s0) Null $node_(d1) 3]
  998.     set cbr_ [$udp attach-app Traffic/CBR]
  999.     $cbr_ set rate_ 3.0Mb
  1000.     $cbr_ set random_ 0.001
  1001.     $ns_ at 0.0 "$cbr_ start"
  1002.     # poor traffic
  1003.     set udp6 [$ns_ create-connection UDP $node_(s1) Null $node_(d1) 3]
  1004.     set cbr6_ [$udp attach-app Traffic/CBR]
  1005.     $cbr6_ set rate_ 0.2Mb
  1006.     $cbr6_ set random_ 0.001
  1007.     $ns_ at 0.0 "$cbr6_ start"
  1008.     set maxAggregates_ 3
  1009.     $ns_ at 0.2 "$cbr1 start"
  1010.     $ns_ at 0.1 "$cbr2_ start"
  1011.     $self statsDump $dumptime $fmon $packetsize_ 0
  1012.     # trace only the bottleneck link
  1013.     #$self traceQueues $node_(r1) [$self openTrace $stoptime $testName_]
  1014.     $ns_ at $stoptime1 "$self cleanupAll $testName_"
  1015. }
  1016. #
  1017. # CBR flows only, no pushback and no local ACC
  1018. #
  1019. Class Test/A_noACC -superclass TestSuite
  1020. Test/A_noACC instproc init {} {
  1021.     $self instvar net_ test_
  1022.     set net_ net3 
  1023.     set test_ A_noACC
  1024.     $self next noTraceFiles
  1025. }
  1026. Test/A_noACC instproc run {} {
  1027.     $self instvar ns_ node_ testName_ net_ topo_
  1028.     $self setTopo
  1029.     $self setup2
  1030.     $ns_ run
  1031. }
  1032. #
  1033. # CBR flows only, local ACC
  1034. #
  1035. Class Test/A_ACC -superclass TestSuite
  1036. Test/A_ACC instproc init {} {
  1037.     $self instvar net_ test_
  1038.     set net_ net3 
  1039.     set test_ A_ACC
  1040.     Queue/RED/Pushback set rate_limiting_ 1
  1041.     Agent/Pushback set enable_pushback_ 0
  1042.     Test/A_ACC instproc run {} [Test/A_noACC info instbody run]
  1043.     $self next noTraceFiles
  1044. }
  1045. #
  1046. # CBR flows only, local and Pushback.
  1047. #
  1048. Class Test/A_Push -superclass TestSuite
  1049. Test/A_Push instproc init {} {
  1050.     $self instvar net_ test_
  1051.     set net_ net3 
  1052.     set test_ A_Push
  1053.     Queue/RED/Pushback set rate_limiting_ 1
  1054.     Agent/Pushback set enable_pushback_ 1
  1055.     Test/A_Push instproc run {} [Test/A_noACC info instbody run]
  1056.     $self next noTraceFiles
  1057. }
  1058. TestSuite runTest