UsersGuide: example3.tcl

File example3.tcl, 592 bytes (added by faber, 7 years ago)

Example of setting node_types

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
14    tb-add-node-attribute $n($i) containers:node_type qemu
15    # Connect center to $n($i)
16    ns duplex-link $center $n($i) 100Mb 10ms DropTail
17}
18
19# Creation boilerplate
20$ns rtptoto Static
21$ns run