HowTo/Bluetooth/UsingNH: btwifi_grid.rb

File btwifi_grid.rb, 5.9 kB (added by harisk, 20 months ago)

Experiment script with 5 p2p BT connections and 11 wifi sending to an AP

Line 
1#
2# Define nodes used in experiment
3#
4defNodes('senderwifi', [[12,1],[19,2],[13,8],[15,9],[1,10],[7,10],[10,11],[5,16],[10,18],[18,18],[13,20]]) {|node|
5  node.prototype("test:proto:sender", {
6    'destinationHost' => '192.168.14.10',
7    'packetSize' => 512,
8    'rate' => 100,
9    'protocol' => 'udp'
10  })
11  node.net.w0.mode = "managed"
12}
13
14defNodes('receiverwifi', [14,10]) {|node|
15  node.prototype("test:proto:receiver" , {
16    'protocol' => 'udp'
17  })
18  node.net.w0.mode = "master"
19}
20
21allNodes.net.w0 { |w|
22  w.type = 'b'
23  w.essid = "wifi"
24  w.ip = "%192.168.%x.%y"
25  w.channel = 6
26}
27
28#
29# Iperf sender definition and configuration
30#
31defNodes('senderbt1', [10,11]) {|node|
32  node.image = nil  # assume the right image to be on disk
33  # use prototype "sender"
34  # and set it's property "destinationHost" to
35  # the receiver node
36  # and bind the remaining properties to the
37  # experiment property space
38  node.prototype("test:proto:iperfudpsender", {
39    'client' => '192.170.7.10',  #Send to
40    'use_udp' => nil,           #UDP client
41    'sender_rate' => 102400,   #Input offered load (bits per sec)
42    'len' => 64,               #Payload length (bytes)
43    'time' => 120
44  })
45}
46
47#
48# Receiver definition and configuration
49#
50defNodes('receiverbt1', [7,10]) {|node|
51  node.image = nil  # assume the right image to be on disk
52  node.prototype("test:proto:iperfudpreceiver" , {
53  'server' => nil,         # Server
54  'use_udp' => nil,        # Use UDP
55  'len' => 64,           #Payload length (bytes)
56  'report_interval' => 1   #Report interval(seconds)
57  })
58}
59
60#
61# Iperf sender definition and configuration
62#
63defNodes('senderbt2', [14,15]) {|node|
64  node.image = nil  # assume the right image to be on disk
65  # use prototype "sender"
66  # and set it's property "destinationHost" to
67  # the receiver node
68  # and bind the remaining properties to the
69  # experiment property space
70  node.prototype("test:proto:iperfudpsender", {
71    'client' => '192.171.18.18',  #Send to
72    'use_udp' => nil,           #UDP client
73    'sender_rate' => 102400,   #Input offered load (bits per sec)
74    'len' => 64,               #Payload length (bytes)
75    'time' => 120
76  })
77}
78
79#
80# Receiver definition and configuration
81#
82defNodes('receiverbt2', [18,18]) {|node|
83  node.image = nil  # assume the right image to be on disk
84  node.prototype("test:proto:iperfudpreceiver" , {
85  'server' => nil,         # Server
86  'use_udp' => nil,        # Use UDP
87  'len' => 64,           #Payload length (bytes)
88  'report_interval' => 1   #Report interval(seconds)
89  })
90}
91
92#
93# Iperf sender definition and configuration
94#
95defNodes('senderbt3', [13,8]) {|node|
96  node.image = nil  # assume the right image to be on disk
97  # use prototype "sender"
98  # and set it's property "destinationHost" to
99  # the receiver node
100  # and bind the remaining properties to the
101  # experiment property space
102  node.prototype("test:proto:iperfudpsender", {
103    'client' => '192.172.14.10',  #Send to
104    'use_udp' => nil,           #UDP client
105    'sender_rate' => 102400,   #Input offered load (bits per sec)
106    'len' => 64,               #Payload length (bytes)
107    'time' => 120
108  })
109}
110
111#
112# Receiver definition and configuration
113#
114defNodes('receiverbt3', [14,10]) {|node|
115  node.image = nil  # assume the right image to be on disk
116  node.prototype("test:proto:iperfudpreceiver" , {
117  'server' => nil,         # Server
118  'use_udp' => nil,        # Use UDP
119  'len' => 64,           #Payload length (bytes)
120  'report_interval' => 1   #Report interval(seconds)
121  })
122}
123
124#
125# Iperf sender definition and configuration
126#
127defNodes('senderbt4', [13,10]) {|node|
128  node.image = nil  # assume the right image to be on disk
129  # use prototype "sender"
130  # and set it's property "destinationHost" to
131  # the receiver node
132  # and bind the remaining properties to the
133  # experiment property space
134  node.prototype("test:proto:iperfudpsender", {
135    'client' => '192.173.15.9',  #Send to
136    'use_udp' => nil,           #UDP client
137    'sender_rate' => 102400,   #Input offered load (bits per sec)
138    'len' => 64,               #Payload length (bytes)
139    'time' => 120
140  })
141}
142
143#
144# Receiver definition and configuration
145#
146defNodes('receiverbt4', [15,9]) {|node|
147  node.image = nil  # assume the right image to be on disk
148  node.prototype("test:proto:iperfudpreceiver" , {
149  'server' => nil,         # Server
150  'use_udp' => nil,        # Use UDP
151  'len' => 64,           #Payload length (bytes)
152  'report_interval' => 1   #Report interval(seconds)
153  })
154}
155
156#
157# Iperf sender definition and configuration
158#
159defNodes('senderbt5', [1,10]) {|node|
160  node.image = nil  # assume the right image to be on disk
161  # use prototype "sender"
162  # and set it's property "destinationHost" to
163  # the receiver node
164  # and bind the remaining properties to the
165  # experiment property space
166  node.prototype("test:proto:iperfudpsender", {
167    'client' => '192.174.4.10',  #Send to
168    'use_udp' => nil,           #UDP client
169    'sender_rate' => 102400,   #Input offered load (bits per sec)
170    'len' => 64,               #Payload length (bytes)
171    'time' => 120
172  })
173}
174
175#
176# Receiver definition and configuration
177#
178defNodes('receiverbt5', [4,10]) {|node|
179  node.image = nil  # assume the right image to be on disk
180  node.prototype("test:proto:iperfudpreceiver" , {
181  'server' => nil,         # Server
182  'use_udp' => nil,        # Use UDP
183  'len' => 64,           #Payload length (bytes)
184  'report_interval' => 1   #Report interval(seconds)
185  })
186}
187
188#
189# Now, start the application
190#
191whenAllInstalled() {|node|
192  wait 10
193  nodes('receiverbt1').startApplications
194  nodes('receiverbt2').startApplications
195  nodes('receiverbt3').startApplications
196  nodes('receiverbt4').startApplications
197  nodes('receiverbt5').startApplications
198  wait 20
199  nodes('senderbt1').startApplications
200  nodes('senderbt2').startApplications
201  nodes('senderbt3').startApplications
202  nodes('senderbt4').startApplications
203  nodes('senderbt5').startApplications
204  nodes('receiverwifi').startApplications
205  nodes('senderwifi').startApplications
206  wait 120
207
208  Experiment.done
209}