planetlab.xml 4.88 KB
Newer Older
1 2
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE nstemplate SYSTEM "nstemplate.dtd">
3 4 5
<!--
    XML NS template based on planetlab.ns - For making PlanetLab experiments
-->
6 7 8 9
<nstemplate name="PlanetLab Slice">
    <description>
      Creates a customized PlanetLab slice.
    </description>
10 11 12
    <variable name="Count" default="10" />
    <variable name="ResUsage" default="3" />
    <variable name="HWType" default="pcplab" />
13
    <variable name="FailOK" default="" />
14 15 16
    <variable name="Tarballs" default="/somedir /proj/yourproj/tarfiles/yourtarball.tar.gz" />
    <variable name="RPMs" default="/proj/yourproj/rpms/yourrpm.rpm" />
    <variable name="Startup" default="/somepath/yourstartupcmd" />
17
    <variable name="NodeVersion" default="Production" />
18
    <variable name="NodeList" default="" />
19 20 21 22 23 24
    <nstext>
	<section><![CDATA[
# planetlab.ns - NS script to allocate PlanetLab nodes on Emulab/Netbed
#
# September 17, 2003
#
25
# Questions and comments to testbed-ops@flux.utah.edu
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

#
# Boilerplate
#
source tb_compat.tcl
set ns [new Simulator]
tb-set-colocate-factor 1

#
# Estimated resource use on each node by this experiment, used to determine
# if there are enough available resources on PlanetLab for this experiment.
# The scale is from 1 to 5, with 1 being negligible usage on a node,
# and 5 an experiment that, ideally, should have nodes to itself.
# If omitted, defaults to 3.
#
tb-set-cpu-usage <ResUsage>
tb-set-mem-usage <ResUsage>

#
# How many nodes to ask for
#
set num_nodes <Count>

49 50 51 52 53 54 55 56
#
# Possibly use a fixed set of nodes (if set, overrides num_nodes setting!)
#
set nodelist {<NodeList>}
if { [llength $nodelist] > 0 } {
    set num_nodes [llength $nodelist]
}

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
#
# Type of PlanetLab nodes to request.  Current choices, with counts:
#    pcplab      Any PlanetLab node (127)
# The following are mutually exclusive sets:
#    pcplabdsl   Plab nodes on DSL lines (3)
#    pcplabinet  Plab nodes on the commodity Internet, in North America (12)
#    pcplabintl  Plab nodes outside North America (24)
#    pcplabinet2 Plab end-hosts (not colo sites) on Internet2 (88)
#
# Can mix and match these types all you want with, say, multiple loops below.
#
# Instead of by type, you could also request specific nodes; for example:
#   tb-fix-node $nodeA plab15
#   tb-fix-node $nodeB plab33
#
set hwtype "<HWType>"
73
set node_version "<NodeVersion>"
74

75 76
set inet_string ""

77 78 79 80 81 82 83 84
#
# Select the N approximately least-loaded nodes of the given type.  Fails if
# insufficient nodes are found due to excessive loads or inadequate disk space.
#
for {set i 1} {$i <= $num_nodes} {incr i} {
    set node($i) [$ns node]
    tb-set-hardware $node($i) $hwtype

Robert Ricci's avatar
Robert Ricci committed
85
    append inet_string "$node(${i}) "
86

87 88 89 90
    if { [llength $nodelist] > 0 } {
        tb-fix-node $node($i) [lindex $nodelist [expr $i - 1]]
    }

91 92 93 94 95 96 97
	]]></section>
    <section depends_on="FailOK" action="comment"><![CDATA[
    # Allow experiment setup to succeed even if setup of some vnodes fails.
    # Your choice, but currently recommended due to flaky Plab nodes.
    tb-set-node-failure-action $node($i) "nonfatal"

	]]></section>
98 99 100 101 102 103 104 105
	<section depends_on="NodeVersion" action="comment"><![CDATA[
    # Select nodes with a specific software status.
    # If you have selected the default, "Production", no desire will be set.
    if { $node_version != "Production" } {
        $node($i) add-desire "plabstatus-$node_version" 1.0
    }

        ]]></section>
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
	<section><![CDATA[
    # Entirely optional stuff; see comments below.
	]]></section>
	<section depends_on="Tarballs" action="comment"><![CDATA[
    tb-set-node-tarfiles $node($i) <Tarballs>
	]]></section>
	<section depends_on="RPMs" action="comment"><![CDATA[
    tb-set-node-rpms     $node($i) <RPMs>
	]]></section>
	<section depends_on="Startup" action="comment"><![CDATA[
    tb-set-node-startup  $node($i) <Startup>
	]]></section>
	<section><![CDATA[
}

# The above loop includes three optional features:
# 1) install tarballs,  2) install rpms,  3) Command execution at boot time.
#
# You can specify tarfiles and/or RPMs to install on the vnodes.
# These files must exist in your /proj directory on ops.emulab.net.
# 1) "tarfiles" syntax is an alternating space-separated list of the
#     dir from which that untar should start, and the path to the tarball.
# 2) "rpms" syntax is simply a space-separated list of paths to RPMs.
# 3) The "startup" command will be executed every time the vnode boots:
#    at experiment startup, swapin, and vnode reboot.  Of course, it needs
#    to exist on the vnode, probably from a tarball or RPM you installed.

133 134
#
# This makes "the Internet" an addressable object in your topology - it will,
135 136
# for example, enable you to set up automatic tcpdump on it.  However, you
# must have more than one node in your experiment!
137
#
138 139 140 141
if { $num_nodes > 1 } {
    set internet [$ns make-lan "$inet_string" 100Mbps 0ms]
    tb-set-lan-protocol $internet "ipv4"
}
142

143 144 145 146 147 148 149
#
# Boilerplate
#
$ns run
	]]></section>
    </nstext>
</nstemplate>