WirelessVT2016/WifiOrbit: wifi-ap-iperf.rb

File wifi-ap-iperf.rb, 5.3 KB (added by agosain@bbn.com, 8 years ago)
Line 
1#
2# Tutorial Experiment - WiFi AP & iperf
3#
4defProperty('accesspoint', 'node1-1', "node ID for access point")
5defProperty('client', 'node1-2', "node ID for client nodes")
6defProperty('duration', 60, "Seconds to run the application.")
7
8defApplication('iperf', 'iperf-oml2') do |app|
9
10  app.version(2, 10, 0)
11  app.shortDescription = 'Iperf traffic generator and bandwidth measurement tool'
12  app.description = %{Iperf is a traffic generator and bandwidth measurement
13tool. It provides generators producing various forms of packet streams and port
14for sending these packets via various transports, such as TCP and UDP.
15}
16  app.path = "/usr/bin/iperf-oml2"
17
18  app.defProperty('interval', 'pause n seconds between periodic bandwidth reports', '-i',
19                  :type => :double, :unit => "seconds", :default => '1.')
20  app.defProperty('len', 'set length read/write buffer to n (default 8 KB)', '-l',
21                  :type => :integer, :unit => "KiBytes")
22  app.defProperty('print_mss', 'print TCP maximum segment size (MTU - TCP/IP header)', '-m',
23                  :type => :boolean)
24  app.defProperty('output', 'output the report or error message to this specified file', '-o',
25                  :type => :string)
26  app.defProperty('port', 'set server port to listen on/connect to to n (default 5001)', '-p',
27                  :type => :integer)
28  app.defProperty('udp', 'use UDP rather than TCP', '-u',
29                  :type => :boolean,
30                  :order => 2)
31  app.defProperty('window', 'TCP window size (socket buffer size)', '-w',
32                  :type => :integer, :unit => "Bytes")
33  app.defProperty('bind', 'bind to <host>, an interface or multicast address', '-B',
34                  :type => :string)
35  app.defProperty('compatibility', 'for use with older versions does not sent extra msgs', '-C',
36                  :type => :boolean)
37  app.defProperty('mss', 'set TCP maximum segment size (MTU - 40 bytes)', '-M',
38                  :type => :integer, :unit => "Bytes")
39  app.defProperty('nodelay', 'set TCP no delay, disabling Nagle\'s Algorithm', '-N',
40                  :type => :boolean)
41  app.defProperty('IPv6Version', 'set the domain to IPv6', '-V',
42                  :type => :boolean)
43  app.defProperty('reportexclude', 'exclude C(connection) D(data) M(multicast) S(settings) V(server) reports', '-x',
44                  :type => :string, :unit => "[CDMSV]")
45  app.defProperty('reportstyle', 'C or c for CSV report, O or o for OML', '-y',
46                  :type => :string, :unit => "[CcOo]", :default => "o") # Use OML reporting by default
47
48  app.defProperty('oml-server', 'OML server for collecting data','--oml-server')
49  app.defProperty('oml-id', 'ID for this oml client','--oml-id')
50  app.defProperty('oml-exp-id', 'ID for this experiment','--oml-exp-id')
51
52  app.defProperty('server', 'run in server mode', '-s',
53                  :type => :boolean)
54
55  app.defProperty('bandwidth', 'set target bandwidth to n bits/sec (default 1 Mbit/sec)', '-b',
56                  :type => :string, :unit => "Mbps")
57  app.defProperty('client', 'run in client mode, connecting to <host>', '-c',
58                  :type => :string,
59                  :order => 1)
60  app.defProperty('dualtest', 'do a bidirectional test simultaneously', '-d',
61                  :type => :boolean)
62  app.defProperty('num', 'number of bytes to transmit (instead of -t)', '-n',
63                  :type => :integer, :unit => "Bytes")
64  app.defProperty('tradeoff', 'do a bidirectional test individually', '-r',
65                  :type => :boolean)
66  app.defProperty('time', 'time in seconds to transmit for (default 10 secs)', '-t',
67                  :type => :integer, :unit => "seconds")
68  app.defProperty('fileinput', 'input the data to be transmitted from a file', '-F',
69                  :type => :string)
70  app.defProperty('stdin', 'input the data to be transmitted from stdin', '-I',
71                  :type => :boolean)
72  app.defProperty('listenport', 'port to recieve bidirectional tests back on', '-L',
73                  :type => :integer)
74  app.defProperty('parallel', 'number of parallel client threads to run', '-P',
75                  :type => :integer)
76  app.defProperty('ttl', 'time-to-live, for multicast (default 1)', '-T',
77                  :type => :integer,
78                  :default => 1)
79  app.defProperty('linux-congestion', 'set TCP congestion control algorithm (Linux only)', '-Z',
80                  :type => :boolean)
81end
82
83defGroup('AP', property.accesspoint) do |node|
84  node.addApplication("iperf") do |app|
85    app.setProperty('server', true)
86  end
87  node.net.w0.mode = "master"
88  node.net.w0.type = 'g'
89  node.net.w0.channel = "6"
90  node.net.w0.essid = "TEST1234"
91  node.net.w0.ip = "192.168.0.254"
92end
93
94defGroup('client', property.client) do |node|
95  node.addApplication("iperf") do |app|
96    app.setProperty('client', "192.168.0.254")
97    app.setProperty('time', 20)
98    app.setProperty('interval', 5)
99  end
100  node.net.w0.mode = "managed"
101  node.net.w0.type = 'g'
102  node.net.w0.channel = "6"
103  node.net.w0.essid = "TEST1234"
104  node.net.w0.ip = "192.168.0.%index%"
105end
106
107onEvent(:ALL_UP_AND_INSTALLED) do |event|
108  info "Wifi Multi Client Iperf Experiment"
109  wait 10
110  allGroups.startApplications
111  info "All my Applications are started now..."
112  wait property.duration
113  allGroups.stopApplications
114  info "All my Applications are stopped now."
115  Experiment.done
116end