HowTo/Bluetooth/UsingNH: btwifi.rb

File btwifi.rb, 1.8 KB (added by harisk, 17 years ago)

Experiment script that runs Bluetooth and 802.11

Line 
1#
2# Define nodes used in experiment
3#
4defNodes('senderwifi', [1,1]) {|node|
5 node.prototype("test:proto:sender", {
6 'destinationHost' => '192.168.1.2',
7 'packetSize' => 1024,
8 'rate' => 10000,
9 'protocol' => 'udp'
10 })
11 node.net.w0.mode = "managed"
12}
13
14defNodes('receiverwifi', [1,2]) {|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('senderbt', [1,1]) {|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.169.1.2', #Send to
40 'use_udp' => nil, #UDP client
41 'sender_rate' => 1000000, #Input offered load (bits per sec)
42 'len' => 1024, #Payload length (bytes)
43 'time' => 300
44 })
45 #node.net.w1.ip = "%192.169.%x.%y"
46 #node.net.w1.mode = "Managed"
47 #node.net.w1.type = 'b'
48 #node.net.w1.essid = "iperf"
49}
50
51#
52# Receiver definition and configuration
53#
54defNodes('receiverbt', [1,2]) {|node|
55 node.image = nil # assume the right image to be on disk
56 node.prototype("test:proto:iperfudpreceiver" , {
57 'server' => nil, # Server
58 'use_udp' => nil, # Use UDP
59 'len' => 1024, #Payload length (bytes)
60 'report_interval' => 1 #Report interval(seconds)
61 })
62 #node.net.w1.ip = "%192.169.%x.%y"
63 #node.net.w1.mode = "Master"
64 #node.net.w1.type = 'b'
65 #node.net.w1.essid = "iperf"
66}
67
68#
69# Now, start the application
70#
71whenAllInstalled() {|node|
72 wait 30
73 allNodes.startApplications
74 wait 300
75
76 Experiment.done
77}