File: topo-view.tcl

package info (click to toggle)
ns2 2.35%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,796 kB
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 816; awk: 525; csh: 355
file content (53 lines) | stat: -rw-r--r-- 1,249 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
################ XXX temp to view the topology using nam.. !! ###

proc view-topology { infile outfile hier_flag } {
        source $infile
	global ns node
	set f [open $outfile w]
        set ns [new Simulator]
	
        $ns namtrace-all $f

        # create-topology ... [params]..
	if {$hier_flag} {
		create-hier-topology ns node 1.5Mb
	} else {
		create-topology ns node 1.5Mb
	}

        #... dump the file
        $ns dump-topology $f
        delete $ns
        flush $f
        close $f
        # run nam
        puts "running nam with $outfile ... "
        exec nam $outfile &
}
                
Simulator instproc dump-topology { file } {
        $self instvar topology_dumped started_
	set started_ 1

        # set topology_dumped 1

	# make sure this does not affect anything else later on !
	# $self namtrace-all $file
                
        # Color configuration for nam
        $self dump-namcolors
                
        # Node configuration for nam
        $self dump-namnodes
                
        # Lan and Link configurations for nam
        $self dump-namlans
        $self dump-namlinks

        # nam queue configurations
        $self dump-namqueues
 
        # Traced agents for nam
        $self dump-namagents
}