Debian Codegraph @

tcl/scenario-generation/scen-lib/rmcc-3.tcl

raw
1 # rmcc-3.tcl
2 # Multiple RM flows scenario
3 #
4 # RM sender1
5 # topology: 2 o o 6 RM recv 1
6 # \ 0 1 /
7 # RM send2 3o---o-----------o--o 7 RM recv 2
8 # /| B/N link |\
9 # / | | \
10 # o o o o 8 RM recv 3
11 # RM send3 4 5 9
12 # CBR receiver1
13 # CBR sender1
14
15
16 # RM sender 1 starts to send at t=0s
17 # RM sender 2 starts to send at t=5s
18 # RM sender 3 starts to send at t=10
19 # CBR sender 1 starts to send at t=20s at 500Kbps
20 # CBR reduces its rate to 200Kbps at t=40s
21 # comparison of flow bandwidth for RM flows by flow monitors attached on
22 # links 1-6, 1-7, 1-8 and 1-9
23
24 # usage : ns rmcc-3.tcl
25 #
26
27
28 source rmcc.tcl
29
30 ScenLib/RM instproc make_topo3 { time } {
31 global ns n t opts
32 $self make_nodes 10
33 #color them
34 $n(0) color "red"
35 $n(1) color "red"
36 $n(2) color "orchid"
37 $n(3) color "orchid"
38 $n(4) color "orchid"
39 $n(6) color "green"
40 $n(7) color "green"
41 $n(8) color "green"
42 $n(4) color "black"
43 $n(9) color "black"
44
45 #now setup topology
46 # bottleneck link
47 $ns duplex-link $n(0) $n(1) $opts(bottleneckBW) \
48 $opts(bottleneckDelay) DropTail
49 $ns duplex-link-op $n(0) $n(1) queuePos 0.5
50 $ns duplex-link $n(0) $n(2) 10Mb 5ms DropTail
51 $ns duplex-link $n(0) $n(3) 10Mb 5ms DropTail
52 $ns duplex-link $n(0) $n(4) 10Mb 5ms DropTail
53 $ns duplex-link $n(0) $n(5) 10Mb 5ms DropTail
54 $ns duplex-link $n(1) $n(6) 10Mb 5ms DropTail
55 $ns duplex-link-op $n(1) $n(6) queuePos 0.5
56 $ns duplex-link $n(1) $n(7) 10Mb 5ms DropTail
57 $ns duplex-link-op $n(1) $n(7) queuePos 0.5
58 $ns duplex-link $n(1) $n(8) 10Mb 5ms DropTail
59 $ns duplex-link $n(1) $n(9) 10Mb 5ms DropTail
60
61 $ns duplex-link-op $n(0) $n(1) orient right
62 $ns duplex-link-op $n(0) $n(2) orient left-up
63 $ns duplex-link-op $n(0) $n(3) orient left
64 $ns duplex-link-op $n(0) $n(4) orient left-down
65 $ns duplex-link-op $n(0) $n(5) orient down
66 $ns duplex-link-op $n(1) $n(6) orient up
67 $ns duplex-link-op $n(1) $n(7) orient right
68 $ns duplex-link-op $n(1) $n(8) orient right-down
69 $ns duplex-link-op $n(1) $n(9) orient down
70
71 $ns queue-limit $n(0) $n(1) $opts(bottleneckQSize)
72 $ns queue-limit $n(1) $n(0) $opts(bottleneckQSize)
73
74 $self make_flowmon $time $n(1) $n(6) flowStats_1_6.$t \
75 $n(1) $n(7) flowStats_1_7.$t \
76 $n(1) $n(8) flowStats_1_8.$t \
77 $n(1) $n(9) flowStats_1_9.$t
78 }
79
80 proc run {} {
81 global ns n
82 set test_scen [new ScenLib/RM]
83 $test_scen make_topo3 40.0
84 $test_scen create_mcast 2 0.1 0.4 1.0 6
85 $test_scen create_mcast 3 8.3 9.0 10.0 7
86 $test_scen create_mcast 4 18.3 19.0 20.0 8
87 $test_scen create_cbr 5 2.0 9 40.0 60.0 5 5.0 9 60.0 80.0
88 $test_scen dump_flowmon $n(1) $n(6) 10.0
89 $test_scen dump_flowmon $n(1) $n(6) 20.0
90 $test_scen dump_flowmon $n(1) $n(7) 20.0
91 $test_scen dump_flowmon $n(1) $n(6) 40.0
92 $test_scen dump_flowmon $n(1) $n(7) 40.0
93 $test_scen dump_flowmon $n(1) $n(8) 40.0
94 $test_scen dump_flowmon $n(1) $n(6) 60.0
95 $test_scen dump_flowmon $n(1) $n(9) 60.0
96 $test_scen dump_flowmon $n(1) $n(6) 80.0
97 $test_scen dump_flowmon $n(1) $n(9) 80.0
98 $ns at 80.0 "finish"
99 $ns run
100 }
101
102 global argv prog opts t mflag
103 set mflag 0
104 if [string match {*.tcl} $argv0] {
105 set prog [string range $argv0 0 [expr [string length $argv0] - 5]]
106 } else {
107 set prog $argv0
108 }
109
110 process_args $argv
111 set t $prog
112 run
113