| 1 |
# Correlated and Uncorrelated Loss Scenario: |
| 2 |
|
| 3 |
# Topology: |
| 4 |
|
| 5 |
# 0 0 Source |
| 6 |
# | |
| 7 |
# 1 0 |
| 8 |
# / \ |
| 9 |
# / \ |
| 10 |
# 2 0 3 0 |
| 11 |
# / \ \ |
| 12 |
# 4 0 5 0 6 0 |
| 13 |
# R1 R2 R3 |
| 14 |
# |
| 15 |
|
| 16 |
# |
| 17 |
# Simulation A : All links have 1Mbps BW. There is 10% loss in link 0-1 |
| 18 |
# No loss in other links. |
| 19 |
|
| 20 |
# Simulation B: Similar to setup of A except that 10% loss now takes |
| 21 |
# place in links 1-2 and 1-3. No loss in other links. |
| 22 |
|
| 23 |
# Simulation C: 10% loss in link 1-3. and 5% loss in link 1-2. No |
| 24 |
# loss in other links. |
| 25 |
# Flow monitors measure thruput at link 2-4, 2-5 and 3-6. |
| 26 |
|
| 27 |
#usage: ns rmcc-1.tcl -test <#test no> |
| 28 |
#test number options: 1,2, 3 or 4 |
| 29 |
|
| 30 |
|
| 31 |
source ../../mcast/srm-nam.tcl ;#to separate control messages |
| 32 |
source rmcc.tcl |
| 33 |
|
| 34 |
|
| 35 |
ScenLib/RM instproc make_topo1 { at } { |
| 36 |
global ns n prog t |
| 37 |
$self make_nodes 7 |
| 38 |
#color them |
| 39 |
$n(0) color "red" |
| 40 |
$n(4) color "orchid" |
| 41 |
$n(5) color "orchid" |
| 42 |
$n(6) color "orchid" |
| 43 |
|
| 44 |
#now setup topology |
| 45 |
$ns duplex-link $n(0) $n(1) 1Mb 10ms DropTail |
| 46 |
$ns duplex-link $n(1) $n(2) 1Mb 10ms DropTail |
| 47 |
$ns duplex-link $n(1) $n(3) 1Mb 10ms DropTail |
| 48 |
$ns duplex-link $n(2) $n(4) 1Mb 10ms DropTail |
| 49 |
$ns duplex-link $n(2) $n(5) 1Mb 10ms DropTail |
| 50 |
$ns duplex-link $n(3) $n(6) 1Mb 10ms DropTail |
| 51 |
|
| 52 |
$ns duplex-link-op $n(0) $n(1) orient down |
| 53 |
$ns duplex-link-op $n(1) $n(2) orient left-down |
| 54 |
$ns duplex-link-op $n(1) $n(3) orient right-down |
| 55 |
$ns duplex-link-op $n(2) $n(4) orient left-down |
| 56 |
$ns duplex-link-op $n(2) $n(5) orient right-down |
| 57 |
$ns duplex-link-op $n(3) $n(6) orient right-down |
| 58 |
|
| 59 |
$self make_flowmon $at $n(2) $n(4) flowStats_2_4.$t \ |
| 60 |
$n(2) $n(5) flowStats_2_5.$t \ |
| 61 |
$n(3) $n(6) flowStats_3_6.$t |
| 62 |
# $self make_flowmon $n(2) $n(5) flowStats_2_5.$t |
| 63 |
# $self make_flowmon $n(3) $n(6) flowStats_3_6.$t |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
#ScenLib/RM instproc setup_mcast {} { |
| 69 |
# global ns n opts srmStats srmEvents |
| 70 |
|
| 71 |
# mproto options : 5 |
| 72 |
# CtrMcast, DM, detailedDM, dynamicDM, pimDM |
| 73 |
# set mrthandle [$ns mrtproto $opts(routingProto) {}] |
| 74 |
|
| 75 |
# set fid 0 |
| 76 |
# set dest [Node allocaddr] |
| 77 |
# $ns at 0.3 "$mrthandle switch-treetype $dest" |
| 78 |
|
| 79 |
# set src [new Agent/$opts(srmSimType)] |
| 80 |
# $src set dst_ $dest |
| 81 |
# $src set fid_ [incr fid] |
| 82 |
# $src trace $srmEvents |
| 83 |
# $src log $srmStats |
| 84 |
# $ns at 1.0 "$src start" |
| 85 |
# $ns attach-agent $n(0) $src |
| 86 |
|
| 87 |
# for {set i 4} {$i < 7} {incr i} { |
| 88 |
# set rcvr($i) [new Agent/$opts(srmSimType)] |
| 89 |
# $rcvr($i) set dst_ $dest |
| 90 |
# $rcvr($i) set fid_ [incr fid] |
| 91 |
# $rcvr($i) trace $srmEvents |
| 92 |
# $rcvr($i) log $srmStats |
| 93 |
# $ns attach-agent $n($i) $rcvr($i) |
| 94 |
# $ns at 1.0 "$rcvr($i) start" |
| 95 |
# } |
| 96 |
|
| 97 |
#setup source |
| 98 |
# set cbr [new Agent/CBR] |
| 99 |
# $cbr set packetSize_ 1000 |
| 100 |
# $src traffic-source $cbr |
| 101 |
# $src set packetSize_ 1000 ;#so repairs are correct |
| 102 |
# $cbr set fid_ 0 |
| 103 |
# $ns at 3.0 "$src start-source" |
| 104 |
#} |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
#ScenLib/RM instproc attach-tcp {} { |
| 109 |
# global ns n |
| 110 |
#Attach a TCP flow between src and recvr1 |
| 111 |
# set tcp [new Agent/TCP] |
| 112 |
# $tcp set fid_ 2 |
| 113 |
# $tcp set packetSize_ 1000 |
| 114 |
# $ns attach-agent $n(0) $tcp |
| 115 |
|
| 116 |
# set sink [new Agent/TCPSink] |
| 117 |
# $ns attach-agent $n(4) $sink |
| 118 |
# $ns connect $tcp $sink |
| 119 |
|
| 120 |
# set ftp [new Application/FTP] |
| 121 |
# $ftp attach-agent $tcp |
| 122 |
# $ns at 1.5 "$ftp start" |
| 123 |
|
| 124 |
#} |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
proc test {num } { |
| 129 |
global ns n prog |
| 130 |
puts "running test$num" |
| 131 |
set test_scen [new ScenLib/RM] |
| 132 |
switch $num { |
| 133 |
"1" { |
| 134 |
$test_scen make_topo1 6.0 |
| 135 |
$test_scen create_mcast 0 0.3 1.0 3.0 4 5 6 |
| 136 |
$test_scen loss-model-case1 2.52 0 1 |
| 137 |
#$ns at 6.0 "$flowmon dump" |
| 138 |
$ns at 6.0 "finish" |
| 139 |
} |
| 140 |
"2" { |
| 141 |
$test_scen make_topo1 12.0 |
| 142 |
$test_scen create_mcast 0 0.3 1.0 3.0 4 5 6 |
| 143 |
$test_scen loss-model-case2 2.52 2.52 1 2 1 3 |
| 144 |
#$ns at 12.0 "$flowmon dump" |
| 145 |
$ns at 12.0 "finish" |
| 146 |
} |
| 147 |
"3" { |
| 148 |
$test_scen make_topo1 18.0 |
| 149 |
$test_scen create_mcast 0 0.3 1.0 3.0 4 5 6 |
| 150 |
$test_scen loss-model-case3 2.52 2.52 1 2 1 3 |
| 151 |
#$ns at 18.0 "$flowmon dump" |
| 152 |
$ns at 18.0 "finish" |
| 153 |
} |
| 154 |
default { |
| 155 |
puts "Unknown test number $num" |
| 156 |
usage $prog |
| 157 |
} |
| 158 |
} |
| 159 |
$test_scen create_tcp 0 4 1.5 |
| 160 |
$ns run |
| 161 |
} |
| 162 |
|
| 163 |
global argv prog mflag |
| 164 |
set mflag 0 |
| 165 |
if [string match {*.tcl} $argv0] { |
| 166 |
set prog [string range $argv0 0 [expr [string length $argv0] - 5]] |
| 167 |
} else { |
| 168 |
set prog $argv0 |
| 169 |
} |
| 170 |
|
| 171 |
if {[llength $argv] < 1} { |
| 172 |
puts "Insufficient number of arguments" |
| 173 |
usage $prog |
| 174 |
} |
| 175 |
|
| 176 |
global opts t |
| 177 |
process_args $argv |
| 178 |
set t $prog.$opts(test) |
| 179 |
test $opts(test) |
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|