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

通讯编程

开发平台:

Visual C++

  1. #
  2. # Copyright (c) 1995 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-testReno-full.tcl,v 1.13 2006/01/24 23:00:08 sallyfloyd Exp $
  34. #
  35. # To view a list of available tests to run with this script:
  36. # ns test-suite-testReno-full.tcl
  37. #
  38. source misc_simple.tcl
  39. remove-all-packet-headers       ; # removes all except common
  40. add-packet-header Flags IP TCP  ; # hdrs reqd for TCP
  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. Agent/TCP set useHeaders_ false
  50. # The default is being changed to useHeaders_ true.
  51. Agent/TCP set windowInit_ 1
  52. # The default is being changed to 2.
  53. Agent/TCP set singledup_ 0
  54. # The default is being changed to 1
  55. Agent/TCP set minrto_ 0
  56. # The default is being changed to minrto_ 1
  57. Agent/TCP set syn_ false
  58. Agent/TCP set delay_growth_ false
  59. # In preparation for changing the default values for syn_ and delay_growth_.
  60. Trace set show_tcphdr_ 1
  61. set wrap 90
  62. set wrap1 [expr 90 * 512 + 40]
  63. Class Topology
  64. Topology instproc node? num {
  65.     $self instvar node_
  66.     return $node_($num)
  67. }
  68. #
  69. # Links1 uses 8Mb, 5ms feeders, and a 800Kb 10ms bottleneck.
  70. # Queue-limit on bottleneck is 2 packets.
  71. #
  72. Class Topology/net4 -superclass Topology
  73. Topology/net4 instproc init ns {
  74.     $self instvar node_
  75.     set node_(s1) [$ns node]
  76.     set node_(s2) [$ns node]
  77.     set node_(r1) [$ns node]
  78.     set node_(k1) [$ns node]
  79.     $self next
  80.     $ns duplex-link $node_(s1) $node_(r1) 8Mb 0ms DropTail
  81.     $ns duplex-link $node_(s2) $node_(r1) 8Mb 0ms DropTail
  82.     $ns duplex-link $node_(r1) $node_(k1) 800Kb 100ms DropTail
  83.     $ns queue-limit $node_(r1) $node_(k1) 8
  84.     $ns queue-limit $node_(k1) $node_(r1) 8
  85.     $self instvar lossylink_
  86.     set lossylink_ [$ns link $node_(r1) $node_(k1)]
  87.     set em [new ErrorModule Fid]
  88.     set errmodel [new ErrorModel/Periodic]
  89.     $errmodel unit pkt
  90.     $lossylink_ errormodule $em
  91. }
  92. TestSuite instproc finish file {
  93.     global quiet wrap PERL
  94.     set wrap [expr 90 * 1000 + 40]
  95.     exec $PERL ../../bin/set_flow_id -s all.tr | 
  96.     $PERL ../../bin/getrc -e -s 2 -d 3 | 
  97.     $PERL ../../bin/raw2xg -v -s 0.00001 -m $wrap -t $file > temp.rands
  98.     
  99.     if {$quiet == "false"} {
  100. exec xgraph -bb -tk -nl -m -x time -y packets temp.rands &
  101.     }
  102.     ## now use default graphing tool to make a data file
  103.     ## if so desired
  104.     # exec csh gnuplotC.com temp.rands $file
  105.     exit 0
  106. }
  107. TestSuite instproc emod {} {
  108.         $self instvar topo_
  109.         $topo_ instvar lossylink_
  110.         set errmodule [$lossylink_ errormodule]
  111.         return $errmodule
  112. TestSuite instproc drop_pkts pkts {
  113.     $self instvar ns_
  114.     set emod [$self emod]
  115.     set errmodel1 [new ErrorModel/List]
  116.     $errmodel1 droplist $pkts
  117.     $emod insert $errmodel1
  118.     $emod bind $errmodel1 1
  119. }
  120. TestSuite instproc setup {tcptype window list} {
  121.     global wrap wrap1
  122.     $self instvar ns_ node_ testName_
  123.     $self setTopo
  124.     
  125.     Agent/TCP set bugFix_ false
  126.     set fid 1
  127.     # Set up TCP connection
  128.     if {$tcptype == "FullTcp"} {
  129. set tcp1 [new Agent/TCP/FullTcp]
  130. set sink [new Agent/TCP/FullTcp]
  131. $ns_ attach-agent $node_(s1) $tcp1
  132. $ns_ attach-agent $node_(k1) $sink
  133. $tcp1 set fid_ $fid
  134. $sink set fid_ $fid
  135. $ns_ connect $tcp1 $sink
  136. # set up TCP-level connections
  137. $sink listen ; # will figure out who its peer is
  138.     } elseif {$tcptype == "BayFullTcp"} {
  139. set sink [new Agent/TCP/BayFullTcp]
  140. set tcp1 [new Agent/TCP/BayFullTcp]
  141. $ns_ attach-agent $node_(k1) $sink
  142. $ns_ attach-agent $node_(s1) $tcp1
  143. $sink set fid_ $fid
  144. $tcp1 set fid_ $fid
  145. $ns_ connect $sink $tcp1
  146. # set up TCP-level connections
  147. $tcp1 listen ; # will figure out who its peer is
  148.     } elseif {$tcptype == "FullTcpTahoe"} {
  149. set tcp1 [new Agent/TCP/FullTcp/Tahoe]
  150. set sink [new Agent/TCP/FullTcp/Tahoe]
  151. $ns_ attach-agent $node_(s1) $tcp1
  152. $ns_ attach-agent $node_(k1) $sink
  153. $tcp1 set fid_ $fid
  154. $sink set fid_ $fid
  155. $ns_ connect $tcp1 $sink
  156. # set up TCP-level connections
  157. $sink listen ; # will figure out who its peer is
  158.     } elseif {$tcptype == "FullTcpNewreno"} {
  159. set tcp1 [new Agent/TCP/FullTcp/Newreno]
  160. set sink [new Agent/TCP/FullTcp/Newreno]
  161. $ns_ attach-agent $node_(s1) $tcp1
  162. $ns_ attach-agent $node_(k1) $sink
  163. $tcp1 set fid_ $fid
  164. $sink set fid_ $fid
  165. $ns_ connect $tcp1 $sink
  166. # set up TCP-level connections
  167. $sink listen ; # will figure out who its peer is
  168.     } elseif {$tcptype == "FullTcpSack1"} {
  169. set tcp1 [new Agent/TCP/FullTcp/Sack]
  170. set sink [new Agent/TCP/FullTcp/Sack]
  171. $ns_ attach-agent $node_(s1) $tcp1
  172. $ns_ attach-agent $node_(k1) $sink
  173. $tcp1 set fid_ $fid
  174. $sink set fid_ $fid
  175. $ns_ connect $tcp1 $sink
  176. # set up TCP-level connections
  177. $sink listen ; # will figure out who its peer is
  178.     } else {
  179. puts "Error: Type of FullTcp not supportedn"
  180. exit 1
  181.     }
  182.     #$tcp1 set window_ 5
  183.     $tcp1 set window_ $window
  184.     if {$tcptype == "BayFullTcp"} {
  185. $tcp1 set window_ $window 
  186. set cli [new Agent/BayTcpApp/FtpClient]
  187. $sink attach-application $cli
  188. $cli tcp $sink
  189. set sftp [new Agent/BayTcpApp/FtpServer]
  190. $sftp file_size 10000000
  191. $tcp1 attach-application $sftp
  192.         $ns_ at 1.0 "$cli start"
  193.     } else {
  194.         set ftp1 [$tcp1 attach-app FTP]
  195.         $ns_ at 1.0 "$ftp1 start"
  196.     }
  197.     
  198.     $self tcpDump $tcp1 4.0
  199.     $self drop_pkts $list
  200.     
  201.     #$self traceQueues $node_(r1) [$self openTrace 4.01 $testName_]
  202.     $ns_ at 4.01 "$self cleanupAll $testName_"
  203.     $ns_ run
  204. }
  205.     
  206. # Definition of test-suite tests
  207. ###################################################
  208. ## Two drops
  209. ###################################################
  210. Class Test/Tahoe_FullTCP -superclass TestSuite
  211. Test/Tahoe_FullTCP instproc init {} {
  212. $self instvar net_ test_
  213. set net_ net4
  214. set test_ Tahoe_FullTCP
  215. $self next
  216. }
  217. Test/Tahoe_FullTCP instproc run {} {
  218.     $self setup FullTcpTahoe {5} {15 18}
  219. }
  220. #Class Test/Tahoe_FullTCP_without_Fast_Retransmit -superclass TestSuite
  221. #Test/Tahoe_FullTCP_without_Fast_Retransmit instproc init {} {
  222. # $self instvar net_ test_
  223. # set net_ net4
  224. # set test_ Tahoe_FullTCP_without_Fast_Retransmit
  225. # Agent/TCP set noFastRetrans_ true
  226. # $self next
  227. #}
  228. #Test/Tahoe_FullTCP_without_Fast_Retransmit instproc run {} {
  229. #        $self setup FullTcpTahoe {5} {15 18}
  230. #}
  231. Class Test/Reno_FullTCP -superclass TestSuite
  232. Test/Reno_FullTCP instproc init {} {
  233. $self instvar net_ test_
  234. set net_ net4
  235. set test_ Reno_FullTCP
  236. $self next
  237. }
  238. Test/Reno_FullTCP instproc run {} {
  239.         $self setup FullTcp {5} {15 18}
  240. }
  241. # What is this test doing?
  242. # After the partial ACK, it seems that BayFullTCP keeps the inflated
  243. #  congestion window, but advances the left edge of the congestion window? 
  244. Class Test/Reno_BayFullTCP -superclass TestSuite
  245. Test/Reno_BayFullTCP instproc init {} {
  246. $self instvar net_ test_
  247. set net_ net4
  248. set test_ Reno_BayFullTCP
  249. $self next
  250. }
  251. Test/Reno_BayFullTCP instproc run {} {
  252.         $self setup BayFullTcp {5} {14 17}
  253. }
  254. Class Test/NewReno_FullTCP -superclass TestSuite
  255. Test/NewReno_FullTCP instproc init {} {
  256. $self instvar net_ test_
  257. set net_ net4
  258. set test_ NewReno_FullTCP
  259. Agent/TCP set noFastRetrans_ false
  260. $self next
  261. }
  262. Test/NewReno_FullTCP instproc run {} {
  263.         $self setup FullTcpNewreno {5} {15 18}
  264. }
  265. #Class Test/Sack_FullTCP -superclass TestSuite
  266. #Test/Sack_FullTCP instproc init {} {
  267. # $self instvar net_ test_
  268. # set net_ net4
  269. # set test_ Sack_FullTCP
  270. # Agent/TCP set noFastRetrans_ false
  271. # $self next
  272. #}
  273. #Test/Sack_FullTCP instproc run {} {
  274. #        $self setup FullTcpSack1 {5} {15 18}
  275. #}
  276. ###################################################
  277. ## One drop
  278. ###################################################
  279. Class Test/Tahoe_FullTCP2 -superclass TestSuite
  280. Test/Tahoe_FullTCP2 instproc init {} {
  281.     $self instvar net_ test_
  282.     set net_ net4
  283.     set test_ Tahoe_FullTCP2
  284.     $self next
  285. }
  286. Test/Tahoe_FullTCP2 instproc run {} {
  287.         $self setup FullTcpTahoe {8} {17}
  288. }
  289. #Class Test/Tahoe_FullTCP2_without_Fast_Retransmit -superclass TestSuite
  290. #Test/Tahoe_FullTCP2_without_Fast_Retransmit instproc init {} {
  291.     #$self instvar net_ test_
  292.     #set net_ net4
  293.     #set test_ Tahoe_FullTCP2_without_Fast_Retransmit
  294.     #Agent/TCP/FullTcp/Tahoe set noFastRetrans_ true
  295.     #$self next
  296.     #}
  297. #Test/Tahoe_FullTCP2_without_Fast_Retransmit instproc run {} {
  298.     #$self setup FullTcpTahoe {8} {17}
  299.     #}
  300. Class Test/Reno_FullTCP2 -superclass TestSuite
  301. Test/Reno_FullTCP2 instproc init {} {
  302. $self instvar net_ test_
  303. set net_ net4
  304. set test_ Reno_FullTCP2
  305. $self next
  306. }
  307. Test/Reno_FullTCP2 instproc run {} {
  308.         $self setup FullTcp {8} {17}
  309. }
  310. Class Test/Reno_BayFullTCP2 -superclass TestSuite
  311. Test/Reno_BayFullTCP2 instproc init {} {
  312. $self instvar net_ test_
  313. set net_ net4
  314. set test_ Reno_BayFullTCP2
  315. $self next
  316. }
  317. Test/Reno_BayFullTCP2 instproc run {} {
  318.         $self setup BayFullTcp {8} {16}
  319. }
  320. Class Test/NewReno_FullTCP2 -superclass TestSuite
  321. Test/NewReno_FullTCP2 instproc init {} {
  322. $self instvar net_ test_
  323. set net_ net4
  324. set test_ NewReno_FullTCP2
  325. Agent/TCP set noFastRetrans_ false
  326. $self next
  327. }
  328. Test/NewReno_FullTCP2 instproc run {} {
  329.         $self setup FullTcpNewreno {8} {17}
  330. }
  331. #Class Test/Sack_FullTCP2 -superclass TestSuite
  332. #Test/Sack_FullTCP2 instproc init {} {
  333. # $self instvar net_ test_
  334. # set net_ net4
  335. # set test_ Sack_FullTCP2
  336. # Agent/TCP set noFastRetrans_ false
  337. # $self next
  338. #}
  339. #Test/Sack_FullTCP2 instproc run {} {
  340. #        $self setup FullTcpSack1 {8} {17}
  341. #}
  342. TestSuite runTest