UsersGuide: example4.tcl

File example4.tcl, 731 bytes (added by Ted Faber, 7 years ago)
Line 
1source tb_compat.tcl
2set ns [new Simulator]
3
4# Create the center node (named by its variable name)
5set center [$ns node]
6# The center node is a process
7tb-add-node-attribute $center containers:node_type process
8
9# Connect 9 satellites
10for { set i 0} { $i < 9 } { incr i} {
11    # Create node n-1 (tcl n($i) becomes n-$i in the experiment)
12    set n($i) [$ns node]
13    # Satellites are qemu nodes - except for n-9 which is physical
14    if { $i < 8 } { 
15        tb-add-node-attribute $n($i) containers:node_type qemu
16    } else {
17        tb-add-node-attribute $n($i) containers:node_type embedded_pnode
18    }
19
20    # Connect center to $n($i)
21    ns duplex-link $center $n($i) 100Mb 10ms DropTail
22}
23
24# Creation boilerplate
25$ns rtptoto Static
26$ns run