1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 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 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
|
#
# Copyright (C) 2001 by USC/ISI
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation, advertising
# materials, and other materials related to such distribution and use
# acknowledge that the software was developed by the University of
# Southern California, Information Sciences Institute. The name of the
# University may not be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
#
# Maintainer: Kun-chan Lan <kclan@isi.edu>
# Version Date: $Date: 2002/01/29 01:03:01 $
#
#
# Unbalanced dumbell topology
# Used by isigen.tcl
#
# ISI hosts remote hosts
#
# [ISI clients]
#
# s+11 s+10 2 3 4 [2,3,4,5: web servers]
# \ | \|/
# 1 ---9------------X---0 --6-[web clients]
# / | [isi svr] /|\
# s+8 s+9 5 7 8
# | \
# | [ftp clients]
# [ftp server]
#
proc my-duplex-link {ns n1 n2 bw delay queue_method queue_length} {
$ns duplex-link $n1 $n2 $bw $delay $queue_method
$ns queue-limit $n1 $n2 $queue_length
$ns queue-limit $n2 $n1 $queue_length
}
proc create_topology {} {
global ns n verbose num_node num_nonisi_web_client num_isi_server num_ftp_client
set num_web_server 40
set num_web_client 960
set num_isi_client 160
set num_isi_server 1
set num_isi_lan 4
set num_ftp_server 10
set num_ftp_client 100
set queue_method RED
set queue_length 50
set num_nonisi_web_client [expr $num_web_client - $num_isi_client]
set num_node [expr 15 + [expr $num_web_client + $num_web_server + $num_ftp_server + $num_ftp_client]]
set num_isi_client_per_lan [expr $num_isi_client/$num_isi_lan]
set wwwInDelay [new RandomVariable/Empirical]
$wwwInDelay loadCDF cdf/2pm.dump.www.inbound.delay.cdf
set wwwOutDelay [new RandomVariable/Empirical]
$wwwOutDelay loadCDF cdf/2pm.dump.www.outbound.delay.cdf
set WWWinBW [new RandomVariable/Empirical]
$WWWinBW loadCDF cdf/2pm.dump.www.inbound.BW.cdf
set WWWoutBW [new RandomVariable/Empirical]
$WWWoutBW loadCDF cdf/2pm.dump.www.outbound.BW.cdf
set ftpInDelay [new RandomVariable/Empirical]
$ftpInDelay loadCDF cdf/2pm.dump.ftp.inbound.delay.cdf
set ftpOutDelay [new RandomVariable/Empirical]
$ftpOutDelay loadCDF cdf/2pm.dump.ftp.outbound.delay.cdf
set FTPinBW [new RandomVariable/Empirical]
$FTPinBW loadCDF cdf/2pm.dump.ftp.inbound.BW.cdf
set FTPoutBW [new RandomVariable/Empirical]
$FTPoutBW loadCDF cdf/2pm.dump.ftp.outbound.BW.cdf
if {$verbose} { puts "Creating dumbell topology..." }
for {set i 0} {$i < $num_node} {incr i} {
set n($i) [$ns node]
}
# EDGES (from-node to-node length a b):
# node 0 connects to the non-isi server and client pools
# node 9 is the isi web/ftp server
# node 1 connects to the isi client pool
my-duplex-link $ns $n(0) $n([expr $num_node - 1]) 100Mb 1ms $queue_method $queue_length
my-duplex-link $ns $n([expr $num_node - 1]) $n(9) 100Mb 1ms $queue_method $queue_length
my-duplex-link $ns $n(9) $n(1) 100Mb 0.5ms $queue_method $queue_length
my-duplex-link $ns $n(0) $n(2) 50Mb 2ms $queue_method $queue_length
my-duplex-link $ns $n(0) $n(3) 50Mb 2ms $queue_method $queue_length
my-duplex-link $ns $n(0) $n(4) 50Mb 2ms $queue_method $queue_length
my-duplex-link $ns $n(0) $n(5) 50Mb 2ms $queue_method $queue_length
my-duplex-link $ns $n(0) $n(6) 2Mb 10ms $queue_method $queue_length
my-duplex-link $ns $n(0) $n(7) 100Mb 2ms $queue_method $queue_length
my-duplex-link $ns $n(0) $n(8) 2Mb 10ms $queue_method $queue_length
set remote_host [expr $num_web_server + $num_nonisi_web_client + $num_ftp_server + $num_ftp_client]
my-duplex-link $ns $n(1) $n([expr $remote_host + 10]) 100Mb 500us $queue_method $queue_length
my-duplex-link $ns $n(1) $n([expr $remote_host + 11]) 100Mb 500us $queue_method $queue_length
my-duplex-link $ns $n(1) $n([expr $remote_host + 12]) 100Mb 500us $queue_method $queue_length
my-duplex-link $ns $n(1) $n([expr $remote_host + 13]) 100Mb 500us $queue_method $queue_length
for {set i 0} {$i < $num_web_server} {incr i} {
set base [expr $i / 10]
set delay [$wwwInDelay value]
set bandwidth [$WWWinBW value]
my-duplex-link $ns $n([expr $base + 2]) $n([expr $i + 10]) [expr $bandwidth * 1000000] [expr $delay * 0.001] $queue_method $queue_length
if {$verbose} {puts "\$ns duplex-link \$n([expr $base + 2]) \$n([expr $i + 10]) [expr $bandwidth * 1000000] [expr $delay * 0.001] $queue_method"}
#setup manual routes
[$n([expr $i + 10]) get-module "Manual"] add-route-to-adj-node -default $n([expr $base + 2])
[$n([expr $remote_host + 10]) get-module "Manual"] add-route [$n([expr $i + 10]) set address_] [[$ns link $n([expr $remote_host + 10]) $n(1)] head]
[$n([expr $remote_host + 11]) get-module "Manual"] add-route [$n([expr $i + 10]) set address_] [[$ns link $n([expr $remote_host + 11]) $n(1)] head]
[$n([expr $remote_host + 12]) get-module "Manual"] add-route [$n([expr $i + 10]) set address_] [[$ns link $n([expr $remote_host + 12]) $n(1)] head]
[$n([expr $remote_host + 13]) get-module "Manual"] add-route [$n([expr $i + 10]) set address_] [[$ns link $n([expr $remote_host + 13]) $n(1)] head]
[$n(1) get-module "Manual"] add-route [$n([expr $i + 10]) set address_] [[$ns link $n(1) $n(9)] head]
[$n(9) get-module "Manual"] add-route [$n([expr $i + 10]) set address_] [[$ns link $n(9) $n([expr $num_node - 1])] head]
[$n([expr $num_node - 1]) get-module "Manual"] add-route [$n([expr $i + 10]) set address_] [[$ns link $n([expr $num_node - 1]) $n(0)] head]
[$n(0) get-module "Manual"] add-route [$n([expr $i + 10]) set address_] [[$ns link $n(0) $n([expr $base + 2])] head]
[$n([expr $base + 2]) get-module "Manual"] add-route [$n([expr $i + 10]) set address_] [[$ns link $n([expr $base + 2]) $n([expr $i + 10])] head]
}
if {$verbose} {puts "done creating web server"}
for {set i 0} {$i < $num_nonisi_web_client} {incr i} {
set delay [$wwwOutDelay value]
set bandwidth [$WWWoutBW value]
set c [expr $i + $num_web_server + 10]
my-duplex-link $ns $n(6) $n($c) [expr $bandwidth * 1000000 ] [expr $delay * 0.001] $queue_method $queue_length
if {$verbose} {puts "\$ns duplex-link \$n(6) \$n($c) [expr $bandwidth * 1000000] [expr $delay * 0.001] $queue_method"}
#setup manual routes
[$n($c) get-module "Manual"] add-route-to-adj-node -default $n(6)
[$n(9) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(9) $n([expr $num_node - 1])] head]
[$n([expr $num_node - 1]) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n([expr $num_node - 1]) $n(0)] head]
[$n(0) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(0) $n(6)] head]
[$n(6) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(6) $n($c)] head]
}
if {$verbose} {puts "done creating non-isi web clients"}
for {set i 0} {$i < $num_ftp_server} {incr i} {
set delay [$ftpInDelay value]
set bandwidth [$FTPinBW value]
set s [expr $i + $num_web_server + $num_nonisi_web_client + 10]
my-duplex-link $ns $n(7) $n($s) [expr $bandwidth * 1000000 ] [expr $delay * 0.001] $queue_method $queue_length
if {$verbose} {puts "\$ns duplex-link \$n(7) \$n($s) [expr $bandwidth * 1000000] [expr $delay * 0.001] $queue_method"}
#setup manual routes
[$n($s) get-module "Manual"] add-route-to-adj-node -default $n(7)
[$n([expr $remote_host + 10]) get-module "Manual"] add-route [$n($s) set address_] [[$ns link $n([expr $remote_host + 10]) $n(1)] head]
[$n([expr $remote_host + 11]) get-module "Manual"] add-route [$n($s) set address_] [[$ns link $n([expr $remote_host + 11]) $n(1)] head]
[$n([expr $remote_host + 12]) get-module "Manual"] add-route [$n($s) set address_] [[$ns link $n([expr $remote_host + 12]) $n(1)] head]
[$n([expr $remote_host + 13]) get-module "Manual"] add-route [$n($s) set address_] [[$ns link $n([expr $remote_host + 13]) $n(1)] head]
[$n(1) get-module "Manual"] add-route [$n($s) set address_] [[$ns link $n(1) $n(9)] head]
[$n(9) get-module "Manual"] add-route [$n($s) set address_] [[$ns link $n(9) $n([expr $num_node - 1])] head]
[$n([expr $num_node - 1]) get-module "Manual"] add-route [$n($s) set address_] [[$ns link $n([expr $num_node - 1]) $n(0)] head]
[$n(0) get-module "Manual"] add-route [$n($s) set address_] [[$ns link $n(0) $n(7)] head]
[$n(7) get-module "Manual"] add-route [$n($s) set address_] [[$ns link $n(7) $n($s)] head]
}
if {$verbose} {puts "done creating ftp servers"}
for {set i 0} {$i < $num_ftp_client} {incr i} {
set delay [$ftpOutDelay value]
set bandwidth [$FTPoutBW value]
set c [expr $i + $num_web_server + $num_nonisi_web_client + $num_ftp_server + 10]
my-duplex-link $ns $n(8) $n($c) [expr $bandwidth * 1000000 ] [expr $delay * 0.001] $queue_method $queue_length
if {$verbose} {puts "\$ns duplex-link \$n(8) \$n($c) [expr $bandwidth * 1000000] [expr $delay * 0.001] $queue_method"}
#setup manual routes
[$n($c) get-module "Manual"] add-route-to-adj-node -default $n(8)
[$n(9) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(9) $n([expr $num_node - 1])] head]
[$n([expr $num_node - 1]) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n([expr $num_node - 1]) $n(0)] head]
[$n(0) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(0) $n(8)] head]
[$n(8) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(8) $n($c)] head]
}
if {$verbose} {puts "done creating ftp clients"}
for {set i 0} {$i < $num_isi_client} {incr i} {
# set base [expr $i / 10]
set base [expr $i / $num_isi_client_per_lan]
set delay [uniform 0.5 1.0]
set bandwidth 10.0
set b [expr $base + [expr $num_web_server + $num_nonisi_web_client + $num_ftp_server + $num_ftp_client + 10]]
set c [expr [expr $i + $num_web_server + $num_nonisi_web_client + $num_ftp_server + $num_ftp_client] + 14]
my-duplex-link $ns $n($b) $n($c) [expr $bandwidth * 1000000] [expr $delay * 0.001] $queue_method $queue_length
if {$verbose} {puts "\$ns duplex-link \$n($b) \$n($c) [expr $bandwidth * 1000000] [expr $delay * 0.001] $queue_method"}
#setup manual routes
[$n($c) get-module "Manual"] add-route-to-adj-node -default $n($b)
[$n(2) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(2) $n(0)] head]
[$n(3) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(3) $n(0)] head]
[$n(4) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(4) $n(0)] head]
[$n(5) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(5) $n(0)] head]
[$n(7) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(7) $n(0)] head]
[$n(0) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(0) $n([expr $num_node - 1])] head]
[$n([expr $num_node - 1]) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n([expr $num_node - 1]) $n(9)] head]
[$n(9) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(9) $n(1)] head]
[$n(1) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n(1) $n($b)] head]
[$n($b) get-module "Manual"] add-route [$n($c) set address_] [[$ns link $n($b) $n($c)] head]
}
if {$verbose} {puts "done creating isi clients"}
#route to ISI server
[$n(6) get-module "Manual"] add-route [$n(9) set address_] [[$ns link $n(6) $n(0)] head]
[$n(8) get-module "Manual"] add-route [$n(9) set address_] [[$ns link $n(8) $n(0)] head]
[$n(0) get-module "Manual"] add-route [$n(9) set address_] [[$ns link $n(0) $n([expr $num_node - 1])] head]
[$n([expr $num_node - 1]) get-module "Manual"] add-route [$n(9) set address_] [[$ns link $n([expr $num_node - 1]) $n(9)] head]
$ns set dstW_ ""; #define list of web servers
for {set i 0} {$i <= $num_web_server} {incr i} {
$ns set dstW_ "[$ns set dstW_] [list [expr $i + 9]]"
}
if {$verbose} {puts "WWW server set: [$ns set dstW_]"}
$ns set srcW_ ""; #define list of web clients
for {set i 0} {$i < $num_nonisi_web_client} {incr i} {
$ns set srcW_ "[$ns set srcW_] [list [expr [expr $i + $num_web_server ] + 10]]"
}
for {set i 0} {$i < $num_isi_client} {incr i} {
$ns set srcW_ "[$ns set srcW_] [list [expr [expr $i + $num_web_server + $num_nonisi_web_client + $num_ftp_server + $num_ftp_client] + 14]]"
}
if {$verbose} {puts "WWW client set: [$ns set srcW_]"}
$ns set dstF_ ""; #define list of ftp servers
for {set i 0} {$i < 1} {incr i} {
$ns set dstF_ "[$ns set dstF_] [list [expr $i + 9]]"
}
for {set i 0} {$i < $num_ftp_server} {incr i} {
$ns set dstF_ "[$ns set dstF_] [list [expr [expr $i + $num_web_server + $num_nonisi_web_client ] + 10]]"
}
if {$verbose} {puts "FTP server set: [$ns set dstF_]"}
$ns set srcF_ ""; #define list of ftp clients
for {set i 0} {$i < $num_ftp_client} {incr i} {
$ns set srcF_ "[$ns set srcF_] [list [expr [expr $i + $num_web_server + $num_nonisi_web_client + $num_ftp_server ] + 10]]"
}
for {set i 0} {$i < $num_isi_client} {incr i} {
$ns set srcF_ "[$ns set srcF_] [list [expr [expr $i + $num_web_server + $num_nonisi_web_client + $num_ftp_server + $num_ftp_client] + 14]]"
}
if {$verbose} {puts "FTP client set: [$ns set srcF_]"}
if {$verbose} { puts "Finished creating topology..." }
}
# end of create_topology
|