📄 test-suite-sack-v1a.tcl
字号:
proc test_sack1c {} { global s1 s2 r1 k1 create_testnet set tcp1 [ns_create_connection tcp-sack1 $s1 sack1-tcp-sink $k1 0] $tcp1 set window 27 set ftp1 [$tcp1 source ftp] ns at 0.0 "$ftp1 start" tcpDump $tcp1 1.0 # trace only the bottleneck link openTraces 5.0 test_sack1c_window_27 out $r1 $k1 ns run}# this does not seem rightproc test_sack3 {} { global s1 s2 r1 k1 create_testnet [ns link $r1 $k1] set queue-limit 8 [ns link $k1 $r1] set queue-limit 8 set tcp1 [ns_create_connection tcp-sack1 $s1 sack1-tcp-sink $k1 0] $tcp1 set window 100 $tcp1 set bug-fix false set tcp2 [ns_create_connection tcp-sack1 $s2 sack1-tcp-sink $k1 1] $tcp2 set window 16 $tcp2 set bug-fix false set ftp1 [$tcp1 source ftp] set ftp2 [$tcp2 source ftp] ns at 1.0 "$ftp1 start" ns at 0.5 "$ftp2 start" tcpDump $tcp1 1.0 # trace only the bottleneck link openTraces 8.0 test_sack3 out $r1 $k1 ns run}proc test_sack4 {} { global s1 s2 r1 k1 create_testnet [ns link $s2 $r1] set delay 200ms [ns link $r1 $s2] set delay 200ms [ns link $r1 $k1] set queue-limit 11 [ns link $k1 $r1] set queue-limit 11 set tcp1 [ns_create_connection tcp-sack1 $s1 sack1-tcp-sink $k1 0] $tcp1 set window 30 set tcp2 [ns_create_connection tcp-sack1 $s2 sack1-tcp-sink $k1 1] $tcp2 set window 30 set ftp1 [$tcp1 source ftp] ## $ftp1 set maxpkts 10 set ftp2 [$tcp2 source ftp] ## $ftp2 set maxpkts 30 ns at 0.0 "$ftp1 start" ns at 0.0 "$ftp2 start" tcpDump $tcp1 5.0 # trace only the bottleneck link openTraces 25.0 test_sack4 out $r1 $k1 ns run}proc test_sack5 {} { global s1 s2 r1 k1 create_testnet1 [ns link $s1 $r1] set delay 3ms [ns link $r1 $s1] set delay 3ms set tcp1 [ns_create_connection tcp-sack1 $s1 sack1-tcp-sink $k1 0] $tcp1 set window 50 $tcp1 set bug-fix false set tcp2 [ns_create_connection tcp-sack1 $s2 sack1-tcp-sink $k1 1] $tcp2 set window 50 $tcp2 set bug-fix false set ftp1 [$tcp1 source ftp] set ftp2 [$tcp2 source ftp] ns at 1.0 "$ftp1 start" ns at 1.75 "$ftp2 produce 100" tcpDump $tcp1 1.0 # trace only the bottleneck link openTraces 6.0 test_sack5 out $r1 $k1 ns run}# shows a long recovery from sack.proc test_sackB2 {} { global s1 s2 r1 k1 create_testnet [ns link $r1 $k1] set queue-limit 9 set tcp1 [ns_create_connection tcp-sack1 $s1 sack1-tcp-sink $k1 0] $tcp1 set window 50 set tcp2 [ns_create_connection tcp-sack1 $s2 sack1-tcp-sink $k1 1] $tcp2 set window 20 set ftp1 [$tcp1 source ftp] set ftp2 [$tcp2 source ftp] ns at 1.0 "$ftp1 start" ns at 1.0 "$ftp2 start" tcpDump $tcp1 1.0 # trace only the bottleneck link openTraces 10.0 test_sackB2 out $r1 $k1 ns run}# two packets droppedproc test_sackB4 {} { global s1 s2 r1 r2 s3 s4 create_testnet2 [ns link $r1 $r2] set queue-limit 29 set tcp1 [ns_create_connection tcp-sack1 $s1 sack1-tcp-sink $r2 0] $tcp1 set window 40 set ftp1 [$tcp1 source ftp] ns at 0.0 "$ftp1 start" tcpDump $tcp1 1.0 # trace only the bottleneck link openTraces 2.0 test_sackB4 out $r1 $r2 ns run}# delayed ack not implemented yet# proc test_delayedSack {} {# global s1 s2 r1 k1# create_testnet# set tcp1 [ns_create_connection tcp-sack1 $s1 sack1-tcp-sink $k1 0]# $tcp1 set window 50# # # lookup up the sink and set it's delay interval# [$k1 agent [$tcp1 dst-port]] set interval 100ms# # set ftp1 [$tcp1 source ftp]# ns at 1.0 "$ftp1 start"# # tcpDump $tcp1 1.0# # # trace only the bottleneck link# [ns link $r1 $k1] trace [openTraces 4.0 test_delayedSack]# # ns run# }# segregationproc test_phaseSack {} { global s1 s2 r1 k1 create_testnet [ns link $s2 $r1] set delay 3ms [ns link $r1 $s2] set delay 3ms [ns link $r1 $k1] set queue-limit 16 [ns link $k1 $r1] set queue-limit 100 set tcp1 [ns_create_connection tcp-sack1 $s1 sack1-tcp-sink $k1 0] $tcp1 set window 32 set tcp2 [ns_create_connection tcp-sack1 $s2 sack1-tcp-sink $k1 1] $tcp2 set window 32 set ftp1 [$tcp1 source ftp] set ftp2 [$tcp2 source ftp] ns at 5.0 "$ftp1 start" ns at 1.0 "$ftp2 start" tcpDump $tcp1 5.0 # trace only the bottleneck link openTraces 25.0 test_phaseSack out $r1 $k1 ns run}# random overhead, but segregation remains # This is because of the phase of the "tcp1" connection, where# packets arrive at the router right after a slot is freed in the buffer.proc test_phaseSack2 {} { global s1 s2 r1 k1 create_testnet [ns link $s2 $r1] set delay 3ms [ns link $r1 $s2] set delay 3ms [ns link $r1 $k1] set queue-limit 16 [ns link $k1 $r1] set queue-limit 100 set tcp1 [ns_create_connection tcp-sack1 $s1 sack1-tcp-sink $k1 0] $tcp1 set window 32 $tcp1 set overhead 0.01 set tcp2 [ns_create_connection tcp-sack1 $s2 sack1-tcp-sink $k1 1] $tcp2 set window 32 $tcp2 set overhead 0.01 set ftp1 [$tcp1 source ftp] set ftp2 [$tcp2 source ftp] ns at 5.0 "$ftp1 start" ns at 1.0 "$ftp2 start" tcpDump $tcp1 5.0 # trace only the bottleneck link openTraces 25.0 test_phaseSack2_random_overhead? out $r1 $k1 ns run}# no segregation, because of random overheadproc test_phaseSack3 {} { global s1 s2 r1 k1 create_testnet [ns link $s2 $r1] set delay 9.5ms [ns link $r1 $s2] set delay 9.5ms [ns link $r1 $k1] set queue-limit 16 [ns link $k1 $r1] set queue-limit 100 set tcp1 [ns_create_connection tcp-sack1 $s1 sack1-tcp-sink $k1 0] $tcp1 set window 32 $tcp1 set overhead 0.01 set tcp2 [ns_create_connection tcp-sack1 $s2 sack1-tcp-sink $k1 1] $tcp2 set window 32 $tcp2 set overhead 0.01 set ftp1 [$tcp1 source ftp] set ftp2 [$tcp2 source ftp] ns at 5.0 "$ftp1 start" ns at 1.0 "$ftp2 start" tcpDump $tcp1 5.0 # trace only the bottleneck link openTraces 25.0 test_phaseSack3_random_overhead out $r1 $k1 ns run}# proc test_timersSack {} {# global s1 s2 r1 k1# create_testnet# [ns link $r1 $k1] set queue-limit 2# [ns link $k1 $r1] set queue-limit 100# # set tcp1 [ns_create_connection tcp-sack1 $s1 sack1-tcp-sink $k1 0]# $tcp1 set window 4# # lookup up the sink and set it's delay interval# [$k1 agent [$tcp1 dst-port]] set interval 100ms# # set tcp2 [ns_create_connection tcp-sack1 $s2 sack1-tcp-sink $k1 1]# $tcp2 set window 4# # lookup up the sink and set it's delay interval# [$k1 agent [$tcp2 dst-port]] set interval 100ms# # set ftp1 [$tcp1 source ftp]# set ftp2 [$tcp2 source ftp]# # ns at 1.0 "$ftp1 start"# ns at 1.3225 "$ftp2 start"# # tcpDump $tcp1 5.0# # # trace only the bottleneck link# [ns link $r1 $k1] trace [openTraces 10.0 test_timersSack]# # ns run# }if { $argc != 1 && $argc != 2 } { puts stderr {usage: ns test-suite-cbq.tcl testname} exit 1} if { $argc == 2 } { global quiet set second [lindex $argv 1] set argv [lindex $argv 0] if { $second == "QUIET" || $second == "quiet" } { set quiet true }} if { "[info procs test_$argv]" != "test_$argv" } { puts stderr "test-suite.tcl: no such test: $argv"}test_$argv
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -