auto-pelab.ns 8.1 KB
Newer Older
1 2 3 4 5
source tb_compat.tcl

set ns [new Simulator]
$ns rtproto Static

6 7 8
##########
# Beginning of user-settable options

9
#
10 11
# This control how many _pairs_ of PCs there are. ie. 2 gets you 2 monitors,
# plus matching stubs
12 13 14 15
#
set num_pcs 2

#
16
# If set to 1, we create a fake PlanetLab inside Emulab
17 18 19
#
set fake_plab 1

20 21 22 23
#
# If set to 1, we grab real PlanetLab nodes. Both this and fake_plab can be
# set at the same time
#
24
set real_plab 1
25

26 27 28 29
#
# If set to 1, we run tcpdump on all end nodes (in addition to all delay
# nodes) and transfer that data back.
#
30
set trace_end_nodes 1
31 32
set tcpdump_args ""

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#
# If you want to get specific real planetlab nodes, ask for them here by site
# or by emulab node ID. 
# NOTES:
#   An empty list for either selection method turns it off
#   Do not use both site and node selection at the same time!
#   The list must be at least as long as num_pcs above, It can be longer, but
#     extra elements will be ignored
#   I recommend using the sites option, rather than the nodes option, since that
#     may get you less-loaded nodes and is more robust to crashed nodes
#   You can get a list of node IDs and sites at:
#     https://www.emulab.net/nodecontrol_list.php3?showtype=widearea
#   Site names are case-sensitive!
#

# Empty list
set plabsites {}
# Example site list
#set plabsites {UCB Stanford Cornell Jerusalem Taiwan}

# Empty list
set plabnodes {}
# Example node list
#set plabnodes {plab179 pab614 plab588 plab305 plab259}
57

58 59 60 61
#
# Where to grab your tarball of pelab software from. To make this tarball:
#   Go to your testbed source tree
#   Run 'cvs up'!!!
62
#   Run 'gmake' in pelab/stub and pelab/libnetmon (on a DEVBOX node)
63 64 65 66 67 68 69
#   From the root of your source tree, run:
#       tar czvf /proj/tbres/my-pelab.tar.gz pelab
#   Of course, don't name it 'my-plab.tar.gz'! You can put this file in
#       a subdirectory if you want, but it must be somewhere in
#       /proj/tbres/
#   Put the path to your tarball in this variable
#
70
set pelab_tar "/proj/tbres/CHANGEME.tar.gz"
71

72

73 74 75 76 77 78 79
#
# When using a fake plab, these are the parameters for the fake Internet
# 'cloud' connecting the plab nodes. For now, all nodes have the same
# parameters - hopefully this will change in a later version
#
set cloud_delay "30ms"
set cloud_bw "1.5Mbps"
80 81 82 83 84 85 86 87

#
# When using a fake plab, these are the parameters for the 'control'
# delay (ie. the latency for the elab nodes to reach the plab nodes
#
set control_delay "0ms"
set control_bw "100Mbps"

88 89 90
#
# These are the initial conditions for the 'elabc' cloud, the Emulab side of
# a pelab experiment
91
# NOTE: Currently ignored!
92
#
93 94
set ecloud_delay "0ms"
set ecloud_bw "100Mbps"
95

96 97 98 99 100
#
# Hardare type to use for PCs inside of emulab
#
set hwtype "pc"

101 102 103 104 105 106 107 108 109 110 111
#
# Server and client to use for automated testing. If set, will automatically
# be started by the 'start-experiment' script
#
set serverprog "/usr/bin/iperf -s "
# NOTE: No client support for now, you'll have to run the client yourself
set clientprog "/usr/bin/iperf -t 60 -c "

# End of user-settable options
##########

112 113 114
#
# -DNODE has fixes but is not as heavily tested
#
115 116
#set delay_os FBSD54-FUTURE
set delay_os FBSD54-DNODE
117 118 119 120 121 122 123 124 125

tb-set-delay-os $delay_os

#
# XXX temporary: cannot delay plab and elab nodes with the same delay node
#
if {$fake_plab && $delay_os != "FBSD54-DNODE"} {
    tb-set-delay-capacity 1
}
126

127 128 129 130 131 132
#
# Tarballs and RPMs we install on all nodes
#
set tarfiles "/local $pelab_tar"
set rpms "/proj/tbres/auto-pelab/libpcap-0.8.3-3.i386.rpm /proj/tbres/auto-pelab/iperf-2.0.2-1.1.fc2.rf.i386.rpm"

133 134
set elan_string ""
set plan_string ""
135
set inet_string ""
136 137

set stublist {}
138 139
set planetstublist {}
set plabstublist {}
140
set monitorlist {}
141 142 143
set planetservers {}
set serverlist {}
set clientlist {}
Mike Hibler's avatar
Mike Hibler committed
144
set tflist {}
145
set tdlist {}
146 147 148 149

#
# Create all of the nodes
#
Mike Hibler's avatar
Mike Hibler committed
150
set tfix 1
151
set tdix 1
152 153
for {set i 1} {$i <= $num_pcs} {incr i} {

154 155
    if {$real_plab} {
        set planet($i) [$ns node]
156
        tb-set-hardware $planet($i) pcplab
157
        append inet_string "$planet(${i}) "
158 159 160
        set planetstub($i) [$planet($i) program-agent -command "/bin/sh /local/pelab/stub/auto-stub.sh"]
        lappend stublist $planetstub($i)
        lappend planetstublist $planetstub($i)
161

162 163
        tb-set-node-tarfiles $planet($i) $tarfiles
        tb-set-node-rpms $planet($i) $rpms
Mike Hibler's avatar
Mike Hibler committed
164 165 166
        set tfupdate($tfix) [$planet($i) program-agent -command "sudo /usr/local/etc/emulab/update -t"]
	lappend tflist $tfupdate($tfix)
	incr tfix
167 168 169 170 171 172 173 174

        if {[llength $plabsites] > 0} {
            set why_doesnt_tcl_have_concat "*&"
            append why_doesnt_tcl_have_concat [lindex $plabsites [expr $i - 1]]
            $planet($i) add-desire $why_doesnt_tcl_have_concat 1.0
        } elseif {[llength $plabnodes] > 0} {
            tb-fix-node $planet($i) [lindex $plabnodes [expr $i - 1]]
        }
175
    }
176

177 178 179 180 181 182 183 184 185 186 187
    if {$fake_plab} {
        set plab($i) [$ns node]
        tb-set-node-os $plab($i) PLAB-DEVBOX
        tb-set-hardware $plab($i) $hwtype
        append plan_string "$plab(${i}) "
        set plabstub($i) [$plab($i) program-agent -command "/bin/sh /local/pelab/stub/auto-stub.sh"]
        lappend stublist $plabstub($i)
        lappend plabstublist $plabstub($i)

        tb-set-node-tarfiles $plab($i) $tarfiles
        tb-set-node-rpms $plab($i) $rpms
Mike Hibler's avatar
Mike Hibler committed
188 189 190
        set tfupdate($tfix) [$plab($i) program-agent -command "sudo /usr/local/etc/emulab/update -t"]
	lappend tflist $tfupdate($tfix)
	incr tfix
191 192 193 194 195 196

        if {$trace_end_nodes} {
	    set tcpdump($tdix) [$plab($i) program-agent -command "/bin/sh /local/pelab/run-tcpdump.sh plab $i $tcpdump_args"]
	    lappend tdlist $tcpdump($tdix)
	    incr tdix
        }
197
    }
198 199 200 201 202 203 204 205

    set elab($i) [$ns node]
    tb-set-node-os $elab($i) PLAB-DEVBOX
    tb-set-hardware $elab($i) $hwtype
    append elan_string "$elab(${i}) "
    set monitor($i) [$elab($i) program-agent -command "/bin/sh /local/pelab/monitor/auto-monitor.sh"]
    lappend monitorlist $monitor($i)

206 207 208 209 210 211 212
    set server($i) [$elab($i) program-agent -command $serverprog]
    set client($i) [$elab($i) program-agent -command $clientprog]
    lappend serverlist $server($i)
    lappend clientlist $client($i)

    tb-set-node-tarfiles $elab($i) $tarfiles
    tb-set-node-rpms $elab($i) $rpms
Mike Hibler's avatar
Mike Hibler committed
213 214 215
    set tfupdate($tfix) [$elab($i) program-agent -command "sudo /usr/local/etc/emulab/update -t"]
    lappend tflist $tfupdate($tfix)
    incr tfix
216 217 218 219 220 221

    if {$trace_end_nodes} {
	set tcpdump($tdix) [$elab($i) program-agent -command "/bin/sh /local/pelab/run-tcpdump.sh elab $i $tcpdump_args"]
	lappend tdlist $tcpdump($tdix)
	incr tdix
    }
222 223 224 225 226 227
}

#
# Set up groups to make it easy for us to start/stop program agents
#
set stubgroup [$ns event-group $stublist]
228 229 230 231 232 233
if {$real_plab} {
    set planetstubs [$ns event-group $planetstublist]
}
if {$fake_plab} {
    set plabstubs [$ns event-group $plabstublist]
}
234
set monitorgroup [$ns event-group $monitorlist]
235 236 237

set allservers [$ns event-group $serverlist]
set allclients [$ns event-group $clientlist]
238

Mike Hibler's avatar
Mike Hibler committed
239
set tfhosts [$ns event-group $tflist]
240 241 242
if {$trace_end_nodes} {
    set tdhosts [$ns event-group $tdlist]
}
Mike Hibler's avatar
Mike Hibler committed
243

244 245 246 247
#
# Real Internet cloud for real plab nodes
#
if {$real_plab} {
248 249
    set realinternet [$ns make-lan "$inet_string" 100Mbps 0ms]
    $realinternet trace
250 251
}

252
#
253
# Fake 'Internet' cloud for fake plab nodes
254 255
#
if {$fake_plab} {
Robert Ricci's avatar
Robert Ricci committed
256
    set plabc [$ns make-cloud "$plan_string" $cloud_bw $cloud_delay]
257 258
    tb-set-ip-lan $plab(1) $plabc 10.1.0.1
    $plabc trace
259 260 261 262 263
}

#
# Lan which will be controlled by the monitor
#
264
set elabc [$ns make-cloud "$elan_string" $ecloud_bw $ecloud_delay]
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
tb-set-ip-lan $elab(1) $elabc 10.0.0.1
$elabc trace

#
# We don't want the sync server to end up out there on some plab node
#
tb-set-sync-server $elab(1)

#
# Set up a fake Internet link between the PlanetLab and Emulab sides
# when using fake plab nodes
#
if {$fake_plab} {
    set erouter [$ns node]
    set prouter [$ns node]

    set elabcontrol [$ns make-lan "$elan_string $erouter" 100Mbps 0ms]
282
    set plabcontrol [$ns make-lan "$plan_string $prouter" 100Mbps 0ms]
283 284 285 286 287

    set internet [$ns duplex-link $erouter $prouter $control_bw $control_delay DropTail]
    $internet trace

    tb-set-ip-lan $elab(1) $elabcontrol 192.168.0.1
288
    tb-set-ip-lan $plab(1) $plabcontrol 192.168.1.1
289 290 291 292 293 294

    tb-set-ip-link $erouter $internet 192.168.254.1
    tb-set-ip-link $prouter $internet 192.168.254.2
}

$ns run