📄 test-suite-ecn.tcl
字号:
Class Test/ecn_secondpktEcn_sack -superclass TestSuiteTest/ecn_secondpktEcn_sack instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_secondpktEcn_sack $self next}Test/ecn_secondpktEcn_sack instproc run {} { $self instvar ns_ errmodel1 Agent/TCP set old_ecn_ 0 $self ecnsetup Sack1 2.0 1 $self drop_pkts {1 3} $errmodel1 set markecn_ true $ns_ run}######################################################################## Delayed Ack Sack1 Tests ######################################################################### Plain ECNClass Test/ecn_nodrop_sack_delack -superclass TestSuiteTest/ecn_nodrop_sack_delack instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_nodrop_sack_delack $self next}Test/ecn_nodrop_sack_delack instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 1 $self ecnsetup Sack1 3.0 0 1 $self drop_pkt 10000 $ns_ run}# Two ECNs close togetherClass Test/ecn_twoecn_sack_delack -superclass TestSuiteTest/ecn_twoecn_sack_delack instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_twoecn_sack_delack $self next}Test/ecn_twoecn_sack_delack instproc run {} { $self instvar ns_ lossmodel Agent/TCP set old_ecn_ 1 $self ecnsetup Sack1 3.0 0 1 $self drop_pkt 243 $lossmodel set markecn_ true $ns_ run}# ECN followed by packet loss.Class Test/ecn_drop_sack_delack -superclass TestSuiteTest/ecn_drop_sack_delack instproc init {} { $self instvar net_ test_# Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_drop_sack_delack $self next} Test/ecn_drop_sack_delack instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 1 $self ecnsetup Sack1 3.0 0 1 $self drop_pkt 243 $ns_ run}# ECN followed by packet loss.Class Test/ecn_drop1_sack_delack -superclass TestSuiteTest/ecn_drop1_sack_delack instproc init {} { $self instvar net_ test_# Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_drop1_sack_delack $self next}Test/ecn_drop1_sack_delack instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 1 $self ecnsetup Sack1 3.0 0 1 $self drop_pkt 241 $ns_ run}# ECN with a window of one packet.Class Test/ecn_smallwinEcn_sack_delack -superclass TestSuiteTest/ecn_smallwinEcn_sack_delack instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_smallwinEcn_sack_delack $self next}Test/ecn_smallwinEcn_sack_delack instproc run {} { $self instvar ns_ errmodel1 Agent/TCP set old_ecn_ 0 $self ecnsetup Sack1 10.0 1 1 $self drop_pkts {4 7 9 11 12 120 135 143 148 150 151 152} $errmodel1 set markecn_ true $ns_ run}######################################################################## Newreno Tests ######################################################################### Plain ECNClass Test/ecn_nodrop_newreno -superclass TestSuiteTest/ecn_nodrop_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_nodrop_newreno $self next}Test/ecn_nodrop_newreno instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 1 $self ecnsetup Newreno 3.0 $self drop_pkt 10000 $ns_ run}# Two ECNs close togetherClass Test/ecn_twoecn_newreno -superclass TestSuiteTest/ecn_twoecn_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_twoecn_newreno $self next}Test/ecn_twoecn_newreno instproc run {} { $self instvar ns_ lossmodel Agent/TCP set old_ecn_ 1 $self ecnsetup Newreno 3.0 $self drop_pkt 243 $lossmodel set markecn_ true $ns_ run}# ECN followed by packet loss.Class Test/ecn_drop_newreno -superclass TestSuiteTest/ecn_drop_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_drop_newreno $self next}Test/ecn_drop_newreno instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 1 $self ecnsetup Newreno 3.0 $self drop_pkt 243 $ns_ run}# ECN preceded by packet loss.# NO.Class Test/ecn_drop1_newreno -superclass TestSuiteTest/ecn_drop1_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_drop1_newreno $self next}Test/ecn_drop1_newreno instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 1 $self ecnsetup Newreno 3.0 $self drop_pkt 241 $ns_ run}# Packet loss only.Class Test/ecn_noecn_newreno -superclass TestSuiteTest/ecn_noecn_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true Queue/RED set thresh_ 1000 Queue/RED set maxthresh_ 1000 set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_noecn_newreno Test/ecn_noecn_newreno instproc run {} [Test/ecn_drop_newreno info instbody run ] $self next}# Multiple dup acks with bugFix_Class Test/ecn_bursty_newreno -superclass TestSuiteTest/ecn_bursty_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true Queue/RED set thresh_ 100 Queue/RED set maxthresh_ 100 set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_bursty_newreno $self next}Test/ecn_bursty_newreno instproc run {} { $self instvar ns_ $self ecnsetup Newreno 3.0 set lossmodel [$self setloss] $lossmodel set offset_ 245 $lossmodel set burstlen_ 15 $lossmodel set period_ 10000 $ns_ run}# Multiple dup acks following ECNClass Test/ecn_burstyEcn_newreno -superclass TestSuiteTest/ecn_burstyEcn_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true Agent/TCP set old_ecn_ 1 set test_ ecn_burstyEcn_newreno Test/ecn_burstyEcn_newreno instproc run {} [Test/ecn_bursty_newreno info instbody run ] $self next}# ECN followed by timeout.Class Test/ecn_timeout_newreno -superclass TestSuiteTest/ecn_timeout_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_timeout_newreno $self next}Test/ecn_timeout_newreno instproc run {} { $self instvar ns_ $self ecnsetup Newreno 3.0 1 $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} $ns_ run}# ECN followed by a timeout, followed by an ECN representing a# new instance of congestion.Class Test/ecn_timeout1_newreno -superclass TestSuiteTest/ecn_timeout1_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_timeout1_newreno $self next}Test/ecn_timeout1_newreno instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 1 $self ecnsetup Newreno 3.0 1 Agent/TCP set old_ecn_ 1 $self drop_pkts {245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265} $self second_tcp Tahoe 1.0 $ns_ run}# Packet drops with a window of one packet.Class Test/ecn_smallwin_newreno -superclass TestSuiteTest/ecn_smallwin_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true Agent/TCP set bugFix_ true set net_ net2-lossy set test_ ecn_smallwin_newreno $self next}Test/ecn_smallwin_newreno instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 0 $self ecnsetup Newreno 6.0 1 $self drop_pkts {4 8 9 10 11 100 115 121 124 126 127 128} $ns_ run}# ECN with a window of one packet.Class Test/ecn_smallwinEcn_newreno -superclass TestSuiteTest/ecn_smallwinEcn_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_smallwinEcn_newreno $self next}Test/ecn_smallwinEcn_newreno instproc run {} { $self instvar ns_ errmodel1 Agent/TCP set old_ecn_ 0 $self ecnsetup Newreno 10.0 1 $self drop_pkts {4 8 9 11 12 13 120 135 143 148 150 151 152 153} $errmodel1 set markecn_ true $ns_ run}# Packet drops for the second packet.Class Test/ecn_secondpkt_newreno -superclass TestSuiteTest/ecn_secondpkt_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true Agent/TCP set bugFix_ true set net_ net2-lossy set test_ ecn_secondpkt_newreno $self next}Test/ecn_secondpkt_newreno instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 0 $self ecnsetup Newreno 2.0 1 $self drop_pkts {1 3} $ns_ run}# ECN for the second packet.Class Test/ecn_secondpktEcn_newreno -superclass TestSuiteTest/ecn_secondpktEcn_newreno instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_secondpktEcn_newreno $self next}Test/ecn_secondpktEcn_newreno instproc run {} { $self instvar ns_ errmodel1 Agent/TCP set old_ecn_ 0 $self ecnsetup Newreno 2.0 1 $self drop_pkts {1 3} $errmodel1 set markecn_ true $ns_ run}######################################################################## Delayed Ack Newreno Tests ######################################################################### Plain ECNClass Test/ecn_nodrop_newreno_delack -superclass TestSuiteTest/ecn_nodrop_newreno_delack instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_nodrop_newreno_delack $self next}Test/ecn_nodrop_newreno_delack instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 1 $self ecnsetup Newreno 3.0 0 1 $self drop_pkt 10000 $ns_ run}# Two ECNs close togetherClass Test/ecn_twoecn_newreno_delack -superclass TestSuiteTest/ecn_twoecn_newreno_delack instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_twoecn_newreno_delack $self next}Test/ecn_twoecn_newreno_delack instproc run {} { $self instvar ns_ lossmodel Agent/TCP set old_ecn_ 1 $self ecnsetup Newreno 3.0 0 1 $self drop_pkt 243 $lossmodel set markecn_ true $ns_ run}# ECN followed by packet loss.Class Test/ecn_drop_newreno_delack -superclass TestSuiteTest/ecn_drop_newreno_delack instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_drop_newreno_delack $self next}Test/ecn_drop_newreno_delack instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 1 $self ecnsetup Newreno 3.0 0 1 $self drop_pkt 243 $ns_ run}# ECN preceded by packet loss.# NO.Class Test/ecn_drop1_newreno_delack -superclass TestSuiteTest/ecn_drop1_newreno_delack instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_drop1_newreno_delack $self next}Test/ecn_drop1_newreno_delack instproc run {} { $self instvar ns_ Agent/TCP set old_ecn_ 1 $self ecnsetup Newreno 3.0 0 1 $self drop_pkt 241 $ns_ run}# ECN with a window of one packet.Class Test/ecn_smallwinEcn_newreno_delack -superclass TestSuiteTest/ecn_smallwinEcn_newreno_delack instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_smallwinEcn_newreno_delack $self next}Test/ecn_smallwinEcn_newreno_delack instproc run {} { $self instvar ns_ errmodel1 Agent/TCP set old_ecn_ 0 $self ecnsetup Newreno 10.0 1 1 $self drop_pkts {4 8 9 11 120 135 143 148 150 151 152 153} $errmodel1 set markecn_ true $ns_ run}################################################################################################################################### # Links1 uses 8Mb, 5ms feeders, and a 800Kb 20ms bottleneck.# Queue-limit on bottleneck is 25 packets.# Class Topology/net6 -superclass TopologyTopology/net6 instproc init ns { $self instvar node_ set node_(s1) [$ns node] set node_(s2) [$ns node] set node_(r1) [$ns node] set node_(k1) [$ns node] Queue/RED set setbit_ true $ns duplex-link $node_(s1) $node_(r1) 8Mb 5ms DropTail $ns duplex-link $node_(s2) $node_(r1) 8Mb 5ms DropTail $ns duplex-link $node_(r1) $node_(k1) 800Kb 20ms RED $ns queue-limit $node_(r1) $node_(k1) 25 $ns queue-limit $node_(k1) $node_(r1) 25} # This test shows two TCPs when one is ECN-capable and the other # is not.Class Test/ecn1 -superclass TestSuiteTest/ecn1 instproc init {} { $self instvar net_ test_ set net_ net6 set test_ ecn1_(one_with_ecn1,_one_without) $self next}Test/ecn1 instproc run {} { $self instvar ns_ node_ testName_ $self setTopo Agent/TCP set old_ecn_ 1 # Set up TCP connection set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(k1) 0] $tcp1 set window_ 30 $tcp1 set ecn_ 1 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.0 "$ftp1 start" # Set up TCP connection set tcp2 [$ns_ create-connection TCP $node_(s2) TCPSink $node_(k1) 1] $tcp2 set window_ 20 $tcp2 set ecn_ 0 set ftp2 [$tcp2 attach-app FTP] $ns_ at 3.0 "$ftp2 start" $self tcpDump $tcp1 5.0 $self tcpDump $tcp2 5.0 #$self traceQueues $node_(r1) [$self openTrace 10.0 $testName_] $ns_ at 10.0 "$self cleanupAll $testName_" $ns_ run}TestSuite runTest
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -