nstb_compat.tcl 6.43 KB
Newer Older
1
# -*- tcl -*-
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2
3
#
# EMULAB-COPYRIGHT
Timothy Stack's avatar
   
Timothy Stack committed
4
# Copyright (c) 2000-2004, 2006 University of Utah and the Flux Group.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
5
6
7
# All rights reserved.
#

8
9
10
# This is a nop tb_compact.tcl file that should be used when running scripts
# under ns.

11
12
namespace eval GLOBALS {
    variable security_level 0
13
14
15
    variable pid {}
    variable gid {}
    variable eid {}
16
17
}

18
19
20
21
proc tb-set-ip {node ip} {}
proc tb-set-ip-interface {src dst ip} {}
proc tb-set-ip-link {src link ip} {}
proc tb-set-ip-lan {src lan ip} {}
22
proc tb-set-netmask {lanlink netmask} {}
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
proc tb-set-hardware {node type args} {}
proc tb-set-node-os {node os} {}
proc tb-set-link-loss {src args} {}
proc tb-set-lan-loss {lan rate} {}
proc tb-set-node-rpms {node args} {}
proc tb-set-node-startup {node cmd} {}
proc tb-set-node-cmdline {node cmd} {}
proc tb-set-node-tarfiles {node args} {}
proc tb-set-node-lan-delay {node lan delay} {}
proc tb-set-node-lan-bandwidth {node lan bw} {}
proc tb-set-node-lan-loss {node lan loss} {}
proc tb-set-node-lan-params {node lan delay bw loss} {}
proc tb-set-node-failure-action {node type} {}
proc tb-set-ip-routing {type} {}
proc tb-fix-node {v p} {}
proc tb-make-weighted-vtype {name weight types} {}
proc tb-make-soft-vtype {name types} {}
proc tb-make-hard-vtype {name types} {}
proc tb-set-lan-simplex-params {lan node todelay tobw toloss fromdelay frombw fromloss} {}
proc tb-set-link-simplex-params {link src delay bw loss} {}
43
proc tb-set-uselatestwadata {onoff} {}
44
proc tb-set-usewatunnels {onoff} {}
45
proc tb-set-wasolver-weights {delay bw plr} {}
46
47
48
49
50
proc tb-use-endnodeshaping {onoff} {}
proc tb-force-endnodeshaping {onoff} {}
proc tb-set-multiplexed {link onoff} {}
proc tb-set-endnodeshaping {link onoff} {}
proc tb-set-noshaping {link onoff} {}
51
proc tb-set-useveth {link onoff} {}
52
proc tb-set-link-encap {link style} {}
53
54
proc tb-set-allowcolocate {lanlink onoff} {}
proc tb-set-colocate-factor {factor} {}
55
56
57
58
59
proc tb-set-sync-server {node} {}
proc tb-set-mem-usage {usage} {}
proc tb-set-cpu-usage {usage} {}
proc tb-bind-parent {sub phys} {}
proc tb-fix-current-resources {onoff} {}
60
proc tb-set-encapsulate {onoff} {}
61
proc tb-set-vlink-emulation {style} {}
62
proc tb-set-sim-os {os} {}
63
64
proc tb-set-jail-os {os} {}
proc tb-set-delay-os {os} {}
65
proc tb-set-delay-capacity {cap} {}
66
67
proc tb-use-ipassign {onoff} {}
proc tb-set-ipassign-args {args} {}
68
69
70
71
proc tb-set-lan-protocol {lanlink protocol} {}
proc tb-set-lan-accesspoint {lanlink node} {}
proc tb-set-lan-setting {lanlink capkey capval} {}
proc tb-set-node-lan-setting {lanlink node capkey capval} {}
72
73
74
75
proc tb-use-physnaming {onoff} {}
proc tb-feedback-vnode {vnode hardware args} {}
proc tb-feedback-vlan {vnode lan args} {}
proc tb-feedback-vlink {link args} {}
Timothy Stack's avatar
   
Timothy Stack committed
76
proc tb-elab-in-elab {onoff} {}
77
78
79
proc tb-elab-in-elab-topology {topo} {}
proc tb-set-inner-elab-eid {eid} {}
proc tb-set-elabinelab-cvstag {cvstag} {}
80
proc tb-elabinelab-singlenet {} {}
81
82
83
84
85
proc tb-set-node-inner-elab-role {node role} {}
proc tb-set-node-id {vnode myid} {}
proc tb-set-link-est-bandwidth {srclink args} {}
proc tb-set-lan-est-bandwidth {lan bw} {}
proc tb-set-node-lan-est-bandwidth {node lan bw} {}
86
proc tb-set-node-plab-role {node role} {}
87
proc tb-set-node-plab-plcnet {node lanlink} {}
88
proc tb-set-dpdb {onoff} {}
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
proc tb-set-security-level {level} {

    switch -- $level {
	"Green" {
	    set level 0
	}
	"Blue" {
	    set level 1
	}
	"Yellow" {
	    set level 2
	}
	"Orange" {
	    set level 3
	}
	"Red" {
	    perror "\[tb-set-security-level] Red security not implemented yet"
	    return
	}
	unknown {
	    perror "\[tb-set-security-level] $level is not a valid level"
	    return
	}
    }
    set ::GLOBALS::security_level $level
}

Timothy Stack's avatar
   
Timothy Stack committed
117
118
119
120
121
122
123
124
125
126
#
# Set the startup command for a node. Replaces the tb-set-node-startup
# command above, but we have to keep that one around for a while. This
# new version dispatched to the node object, which uses a program object.
# 
proc tb-set-node-startcmd {node command} {
    if {[$node info class] != "Node"} {
	perror "\[tb-set-node-startcmd] $node is not a node."
	return
    }
127
    set command "($command ; /usr/local/etc/emulab/startcmddone \$?)"
Timothy Stack's avatar
   
Timothy Stack committed
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
    set newprog [$node start-command $command]

    return $newprog
}

#
# Create a program object to run on the node when the experiment starts.
#
Node instproc start-command {command} {
    global hosts

    $self instvar sim
    set newname "$hosts($self)_startcmd"

    set newprog [uplevel 2 "set $newname [new Program]"]
    $newprog set node $self
    $newprog set command $command

    return $newprog
}

149
150
Class Program

151
152
153
Program instproc init {args} {
}

154
155
156
Program instproc unknown {m args} {
}

Timothy Stack's avatar
   
Timothy Stack committed
157
158
Class Firewall

159
Firewall instproc init {sim args} {
Timothy Stack's avatar
   
Timothy Stack committed
160
    global last_fw
161
162
163
164
    global last_fw_node
    real_set tmp [$sim node]
    real_set last_fw $self
    real_set last_fw_node $tmp
Timothy Stack's avatar
   
Timothy Stack committed
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
}

Firewall instproc unknown {m args} {
}

Class EventSequence

EventSequence instproc init {args} {
}

EventSequence instproc unknown {m args} {
}

Class EventTimeline

EventTimeline instproc init {args} {
}

EventTimeline instproc unknown {m args} {
}

Class EventGroup

EventGroup instproc init {args} {
}

EventGroup instproc unknown {m args} {
}

Class Console -superclass Agent

Console instproc init {args} {
}

Console instproc unknown {m args} {
}

Topography instproc load_area {args} {
}

Topography instproc checkdest {args} {
    return 1
}

209
210
211
212
213
214
215
216
217
218
219
220
221
Class NSENode -superclass Node

NSENode instproc make-simulated {args} {
    uplevel 1 eval $args
}

# We are just syntax checking the NS file
Simulator instproc run {args} {
}

Simulator instproc nsenode {args} {
    return [new NSENode]
}
Shashi Guruprasad's avatar
Shashi Guruprasad committed
222
223
224
225

Simulator instproc make-simulated {args} {
    uplevel 1 eval $args
}
Timothy Stack's avatar
   
Timothy Stack committed
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244

Simulator instproc event-sequence {args} {
    $self instvar id_counter

    incr id_counter
    return [new EventSequence]
}

Simulator instproc event-timeline {args} {
    $self instvar id_counter

    incr id_counter
    return [new EventTimeline]
}

Simulator instproc event-group {args} {
    return [new EventGroup]
}

245
246
Simulator instproc make-cloud {nodes bw delay args} {
    return [$self make-lan $nodes $bw $delay]
Timothy Stack's avatar
   
Timothy Stack committed
247
248
249
250
251
252
253
254
255
256
257
258
}

Node instproc program-agent {args} {
}

Node instproc topography {args} {
}

Node instproc console {} {
    return [new Console]
}

259
260
261
Node instproc unknown {m args} {
}

Timothy Stack's avatar
   
Timothy Stack committed
262
263
264
Simulator instproc connect {src dst} {
}

265
Simulator instproc define-template-parameter {name args} {
266
    # install the name/value in the outer environment.
267
    set value [lindex $args 0]    
268
    uplevel 1 set \{$name\} \{$value\}
269
270
}

Timothy Stack's avatar
   
Timothy Stack committed
271
272
273
274
275
LanNode instproc trace {args} {
}

LanNode instproc trace_endnode {args} {
}
Timothy Stack's avatar
   
Timothy Stack committed
276
277
278

LanNode instproc unknown {m args} {
}