elabinelab-withfsnode.ns 5.85 KB
Newer Older
1
#
2
# Copyright (c) 2004-2013 University of Utah and the Flux Group.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
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
#
# This file is intended to be included into another NS file. It is not
# a stand alone file.
# 
set myboss [$ns node]
set myops  [$ns node]
set myfs   [$ns node]

tb-set-node-inner-elab-role $myboss boss+router
tb-set-node-inner-elab-role $myops  ops
tb-set-node-inner-elab-role $myfs   fs

if {[info exists ::TBCOMPAT::elabinelab_hardware("boss")]} {
    namespace eval TBCOMPAT {
        tb-set-hardware $myboss $elabinelab_hardware("boss")
    }
} else {
    tb-set-hardware $myboss pc850
}
if {[info exists ::TBCOMPAT::elabinelab_hardware("ops")]} {
    namespace eval TBCOMPAT {
        tb-set-hardware $myops $elabinelab_hardware("ops")
    }
} else {
    tb-set-hardware $myops pc850
}
if {[info exists ::TBCOMPAT::elabinelab_hardware("fs")]} {
    namespace eval TBCOMPAT {
        tb-set-hardware $myfs $elabinelab_hardware("fs")
    }
} else {
    tb-set-hardware $myfs pc850
}

if {[info exists ::TBCOMPAT::elabinelab_fixnodes("boss")]} {
    namespace eval TBCOMPAT {
        tb-fix-node $myboss $elabinelab_fixnodes("boss")
    }
}
if {[info exists ::TBCOMPAT::elabinelab_fixnodes("ops")]} {
    namespace eval TBCOMPAT {
        tb-fix-node $myops $elabinelab_fixnodes("ops")
    }
}
if {[info exists ::TBCOMPAT::elabinelab_fixnodes("fs")]} {
    namespace eval TBCOMPAT {
        tb-fix-node $myfs $elabinelab_fixnodes("fs")
    }
}

# Deal with tarfiles
set myboss_tarfiles ""
set myops_tarfiles  ""
set myfs_tarfiles  ""

if {${::TBCOMPAT::elabinelab_source_tarfile} != ""} {
    append myboss_tarfiles "/usr/src ${::TBCOMPAT::elabinelab_source_tarfile}"
    append myops_tarfiles  "/usr/src ${::TBCOMPAT::elabinelab_source_tarfile}"
    append myfs_tarfiles  "/usr/src ${::TBCOMPAT::elabinelab_source_tarfile}"
}

if {[info exists ::TBCOMPAT::elabinelab_tarfiles("boss")]} {
    if {$myboss_tarfiles != ""} {
	append myboss_tarfiles " "
    }
    namespace eval TBCOMPAT {
	append myboss_tarfiles $elabinelab_tarfiles("boss")
    }
}
if {[info exists ::TBCOMPAT::elabinelab_tarfiles("ops")]} {
    if {$myops_tarfiles != ""} {
	append myops_tarfiles " "
    }
    namespace eval TBCOMPAT {
	append myops_tarfiles $elabinelab_tarfiles("ops")
    }
}
if {[info exists ::TBCOMPAT::elabinelab_tarfiles("fs")]} {
    if {$myfs_tarfiles != ""} {
	append myfs_tarfiles " "
    }
    namespace eval TBCOMPAT {
	append myfs_tarfiles $elabinelab_tarfiles("fs")
    }
}
if {$myboss_tarfiles != ""} {
    tb-set-node-tarfiles $myboss $myboss_tarfiles
}
if {$myops_tarfiles != ""} {
    tb-set-node-tarfiles $myops $myops_tarfiles
}
if {$myfs_tarfiles != ""} {
    tb-set-node-tarfiles $myfs $myfs_tarfiles
}

tb-make-soft-vtype pcslow {pc600 pc850}

#
# This is passed in by the parser, when wrapping an existing experiment.
# The parser wrapper gets info about the wrapped experiment and passes it
# along in the TBCOMPAT namespace.
#
if { ${::TBCOMPAT::elabinelab_maxpcs} != 0 } {
    set maxpcs ${::TBCOMPAT::elabinelab_maxpcs}
} else {
    set maxpcs 0
}

set lanstr "myboss myops myfs "
for {set i 1} {$i <= $maxpcs} {incr i} {
	set name "mypc${i}"
	set $name [$ns node]
	append lanstr "[set $name] "
	tb-set-node-inner-elab-role [set $name] node

	if {[info exists ::TBCOMPAT::elabinelab_nodeos($name)]} {
	    namespace eval TBCOMPAT {
        	tb-set-node-os [set $name] $elabinelab_nodeos($name)
	    }
	}

	if {[info exists ::TBCOMPAT::elabinelab_fixnodes($name)]} {
	    namespace eval TBCOMPAT {
        	tb-fix-node [set $name] $elabinelab_fixnodes($name)
	    }
	} else {
	    tb-set-hardware [set $name] pcslow
	}
}

154
if { ${::GLOBALS::elabinelab_singlenet} == 0 } {
155 156 157 158 159 160
    if { ${::TBCOMPAT::elabinelab_cnetspeed} != 0 } {
	set _cnetspeed ${::TBCOMPAT::elabinelab_cnetspeed}
    } else {
	set _cnetspeed 100
    }
    set publiclan [$ns make-lan $lanstr ${_cnetspeed}Mb 0ms]
161 162 163 164 165

    tb-set-ip-lan $myboss $publiclan 10.200.1.252
    tb-set-ip-lan $myops  $publiclan 10.200.1.253
    tb-set-ip-lan $myfs   $publiclan 10.200.1.251
    for {set i 1} {$i <= $maxpcs} {incr i} {
166 167
	set name "mypc${i}"
	tb-set-ip-lan [set $name] $publiclan 10.200.1.$i
168
    }
169 170 171 172 173 174
}

if {[info exists ::TBCOMPAT::elabinelab_nodeos("boss")]} {
    namespace eval TBCOMPAT {
        tb-set-node-os $myboss $elabinelab_nodeos("boss")
    }
175 176 177 178
} elseif {[info exists ::TBCOMPAT::sitevariables(elabinelab/boss_osid)]} {
    namespace eval TBCOMPAT {
	tb-set-node-os $myboss $sitevariables(elabinelab/boss_osid)
    }
179
} else {
180
    tb-set-node-os $myboss FBSD83-STD
181 182 183 184 185 186
}

if {[info exists ::TBCOMPAT::elabinelab_nodeos("ops")]} {
    namespace eval TBCOMPAT {
        tb-set-node-os $myops $elabinelab_nodeos("ops")
    }
187 188 189 190
} elseif {[info exists ::TBCOMPAT::sitevariables(elabinelab/ops_osid)]} {
    namespace eval TBCOMPAT {
	tb-set-node-os $myops $sitevariables(elabinelab/ops_osid)
    }
191
} else {
192
    tb-set-node-os $myops FBSD83-STD
193 194 195 196 197 198
}

if {[info exists ::TBCOMPAT::elabinelab_nodeos("fs")]} {
    namespace eval TBCOMPAT {
        tb-set-node-os $myfs $elabinelab_nodeos("fs")
    }
199 200 201 202
} elseif {[info exists ::TBCOMPAT::sitevariables(elabinelab/fs_osid)]} {
    namespace eval TBCOMPAT {
	tb-set-node-os $myfs $sitevariables(elabinelab/fs_osid)
    }
203
} else {
204
    tb-set-node-os $myfs FBSD83-STD
205
}