| 1 | ############# Tutorial1 ################################## |
| 2 | # This script defines the experiment |
| 3 | # that has one sender and one receiver |
| 4 | # Sender, Receiver - 802.11a channel 36 |
| 5 | # UDP flow at 1 Mbps |
| 6 | # Receiver reports throughput, jitter and packet loss per second |
| 7 | # Iperf traffic generator |
| 8 | ############################################################ |
| 9 | |
| 10 | require 'net/http' |
| 11 | require 'uri' |
| 12 | |
| 13 | Experiment.name = "iperf-udp" |
| 14 | Experiment.project = "orbit:tutorial" |
| 15 | |
| 16 | # |
| 17 | # Define nodes used in experiment |
| 18 | # |
| 19 | ########################################### |
| 20 | # Sender definition and configuration |
| 21 | ########################################### |
| 22 | defNodes('sender', [1,1]) {|node| |
| 23 | node.image = nil # assume the right image to be on disk |
| 24 | # use prototype "sender" |
| 25 | # and set it's property "destinationHost" to |
| 26 | # the receiver node |
| 27 | # and bind the remaining properties to the |
| 28 | # experiment property space |
| 29 | node.prototype("test:proto:iperfudpsender", { |
| 30 | 'client' => '192.168.1.2', #Send to |
| 31 | 'use_udp' => nil, #UDP client |
| 32 | 'sender_rate' => 7000, #Input offered load (bits per sec) |
| 33 | 'len' => 1024 #Payload length (bytes) |
| 34 | }) |
| 35 | node.net.w0.ip = "%192.168.%x.%y" |
| 36 | node.net.w0.mode = "Managed" |
| 37 | node.net.w0.type = 'b' |
| 38 | node.net.w0.essid = "cwmin" |
| 39 | |
| 40 | } |
| 41 | ########################################### |
| 42 | # Receiver definition and configuration |
| 43 | ########################################### |
| 44 | |
| 45 | defNodes('receiver', [1,2]) {|node| |
| 46 | node.net.w0.ip = "%192.168.%x.%y" |
| 47 | node.image = nil # assume the right image to be on disk |
| 48 | node.prototype("test:proto:iperfudpreceiver" , { |
| 49 | 'server' => nil, # Server |
| 50 | 'use_udp' => nil, # Use UDP |
| 51 | 'len' => 1024, #Payload length (bytes) |
| 52 | 'report_interval' => 10 #Report interval(seconds) |
| 53 | }) |
| 54 | node.net.w0.mode = "Master" |
| 55 | node.net.w0.type = 'b' |
| 56 | node.net.w0.essid = "cwmin" |
| 57 | } |
| 58 | |
| 59 | ########################################### |
| 60 | # When nodeAgents have reported "OK" to |
| 61 | # the nodeHandler start the application |
| 62 | ########################################### |
| 63 | whenAllInstalled() {|node| |
| 64 | |
| 65 | wait 10 |
| 66 | nodes('receiver').startApplications |
| 67 | |
| 68 | wait 10 |
| 69 | nodes('sender').startApplications |
| 70 | wait 30 |
| 71 | |
| 72 | allNodes.stopApplications |
| 73 | |
| 74 | |
| 75 | Experiment.done |
| 76 | |
| 77 | } |