elabinelab.ns 1.45 KB
Newer Older
1
2
3
4
#
# This file is intended to be included into another NS file. It is not
# a stand alone file.
# 
5
6
7
8
set myboss [$ns node]
set myops  [$ns node]

tb-set-hardware $myboss pc2000
Leigh B. Stoller's avatar
Leigh B. Stoller committed
9
tb-set-hardware $myops  pc2000
10
11
12
13

tb-set-node-inner-elab-role $myboss boss
tb-set-node-inner-elab-role $myops  ops

14
15
16
17
18
19
20
21
22
23
24
#
# 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
}

25
26
27
28
29
30
31
set lanstr "myboss myops "
for {set i 1} {$i <= $maxpcs} {incr i} {
	set name "mypc${i}"
	set $name [$ns node]
	append lanstr "[set $name] "
	tb-set-node-os [set $name] FBSD-STD
	tb-set-node-inner-elab-role [set $name] node
Leigh B. Stoller's avatar
Leigh B. Stoller committed
32
        tb-set-hardware [set $name] pc2000
33
34
35
36
37
38
39
40
41
42
43
44
45
46
}
set publiclan [$ns make-lan $lanstr 100Mb 0ms]

tb-set-ip-lan $myboss $publiclan 10.200.1.70
tb-set-ip-lan $myops  $publiclan 10.200.1.74
for {set i 1} {$i <= $maxpcs} {incr i} {
	set name "mypc${i}"
	tb-set-ip-lan [set $name] $publiclan 10.200.1.$i
}

tb-set-node-os $myboss FBSD410-UPDATE
tb-set-node-cmdline $myboss /kernel.linkdelay
tb-set-node-os $myops  FBSD410-UPDATE

47
if {${::GLOBALS::security_level} >= 2} {
48
49
50
	# Set up a firewall
	set fw [new Firewall $ns]
	$fw set-type ipfw2-vlan
51
52
53
54
55
56
        
        if {${::GLOBALS::security_level} == 2} {
	    $fw set-style open
	} else {
	    $fw set-style closed
	}
57
}