Old/Documentation/OTG/ScriptsRepository: ExpUDPOfferloadSwitch.rb

File ExpUDPOfferloadSwitch.rb, 2.2 KB (added by zhibinwu, 14 years ago)
Line 
1##############################################
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 varying offer load
6############################################################
7
8require 'net/http'
9require 'uri'
10
11Experiment.name = "rateudp"
12Experiment.project = "orbit:tutorial"
13
14rates = [8000, 9000, 10000, 11000, 12000]
15
16Experiment.defProperty('offerload', 500, 'offered load of flow')
17Experiment.defProperty('packetsize',1024, 'size of flow')
18
19#
20# Define nodes used in experiment
21#
22###########################################
23# Sender definition and configuration
24###########################################
25defNodes('sender', [1,2]) {|node|
26  node.image = nil  # assume the right image to be on disk
27  # use prototype "sender"
28  # and set it's property "destinationHost" to
29  # the receiver node
30  # and bind the remaining properties to the
31  # experiment property space
32  node.prototype("test:proto:sender", {
33     'destinationHost' => '192.168.1.1',
34     'packetSize' => prop.packetsize,
35     'rate' => prop.offerload,
36  'protocol'=> 'udp'
37    })
38  node.net.w0.ip = "%192.168.%x.%y"
39  node.net.w0.mode = "Master"
40  node.net.w0.type = 'b'
41  node.net.w0.essid = "helloworld"
42  node.net.w0.channel = 1
43  node.net.w0.rate= '11M'
44}
45###########################################
46# Receiver definition and configuration
47###########################################
48
49defNodes('receiver', [1,1]) {|node|
50  node.net.w0.ip = "%192.168.%x.%y"
51  node.image = nil  # assume the right image to be on disk
52  node.prototype("test:proto:receiver" , {
53   'protocol' => 'udp_libmac',
54   'hostname' => '192.168.1.1'
55  })
56  node.net.w0.mode = "Managed"
57  node.net.w0.type = 'b'
58  node.net.w0.essid = "helloworld"
59}
60
61###########################################
62# When nodeAgents have reported "OK" to
63# the nodeHandler start the application
64###########################################
65whenAllInstalled() {|node|
66
67  nodes('receiver').startApplications
68  nodes('sender').startApplications
69
70 rates.each {|rate_level|
71wait 20
72  prop.packetsize= 52
73  prop.offerload =50
74  wait 30
75  prop.packetsize= 1024
76  prop.offerload= rate_level
77 }
78
79  allNodes.stopApplications
80
81  Experiment.done
82
83}