Changes between Initial Version and Version 1 of Tutorials/c0WiFi/Tutorial4


Ignore:
Timestamp:
Oct 15, 2014, 3:52:12 PM (10 years ago)
Author:
nilanjan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/c0WiFi/Tutorial4

    v1 v1  
     1== Wifi Tutorial: ==
     2
     3This tutorial shows how to use the OMF feature to collect data into an OML database. The OEDL script used here is built on top of the script used for ''Access point with multiple clients'' with slight changes that allow each wifi client to initiate an iperf session on a staggered first-in first-out schedule.
     4
     5=== Experiment Script ===
     6
     7A brief description of the modify sections is described below.
     8
     9{{{
     10#
     11# Tutorial experiment
     12#
     13# omf exec wifi-ap-exercise3.rb -- --accesspoint node15-1 --client node17-1,node19-1 --interval 60
     14#
     15defProperty('accesspoint', 'node1-1', "node ID for access point")
     16defProperty('client', 'node1-2,node1-3,node1-4', "node ID for client nodes")
     17defProperty('interval', 60, "Time before starting next client")
     18
     19defApplication('iperf', 'iperf-oml2') do |app|
     20
     21  app.version(2, 10, 0)
     22  app.shortDescription = 'Iperf traffic generator and bandwidth measurement tool'
     23  app.description = %{Iperf is a traffic generator and bandwidth measurement
     24tool. It provides generators producing various forms of packet streams and port
     25for sending these packets via various transports, such as TCP and UDP.
     26}
     27  app.path = "/usr/bin/iperf-oml2"
     28
     29  app.defProperty('interval', 'pause n seconds between periodic bandwidth reports', '-i',
     30                  :type => :double, :unit => "seconds", :default => '1.')
     31  app.defProperty('len', 'set length read/write buffer to n (default 8 KB)', '-l',
     32                  :type => :integer, :unit => "KiBytes")
     33  app.defProperty('print_mss', 'print TCP maximum segment size (MTU - TCP/IP header)', '-m',
     34                  :type => :boolean)
     35  app.defProperty('output', 'output the report or error message to this specified file', '-o',
     36                  :type => :string)
     37  app.defProperty('port', 'set server port to listen on/connect to to n (default 5001)', '-p',
     38                  :type => :integer)
     39  app.defProperty('udp', 'use UDP rather than TCP', '-u',
     40                  :type => :boolean,
     41                  :order => 2)
     42  app.defProperty('window', 'TCP window size (socket buffer size)', '-w',
     43                  :type => :integer, :unit => "Bytes")
     44  app.defProperty('bind', 'bind to <host>, an interface or multicast address', '-B',
     45                  :type => :string)
     46  app.defProperty('compatibility', 'for use with older versions does not sent extra msgs', '-C',
     47                  :type => :boolean)
     48  app.defProperty('mss', 'set TCP maximum segment size (MTU - 40 bytes)', '-M',
     49                  :type => :integer, :unit => "Bytes")
     50  app.defProperty('nodelay', 'set TCP no delay, disabling Nagle\'s Algorithm', '-N',
     51                  :type => :boolean)
     52  app.defProperty('IPv6Version', 'set the domain to IPv6', '-V',
     53                  :type => :boolean)
     54  app.defProperty('reportexclude', 'exclude C(connection) D(data) M(multicast) S(settings) V(server) reports', '-x',
     55                  :type => :string, :unit => "[CDMSV]")
     56  app.defProperty('reportstyle', 'C or c for CSV report, O or o for OML', '-y',
     57                  :type => :string, :unit => "[CcOo]", :default => "o") # Use OML reporting by default
     58
     59  app.defProperty('oml-server', 'OML server for collecting data','--oml-server')
     60  app.defProperty('oml-id', 'ID for this oml client','--oml-id')
     61  app.defProperty('oml-exp-id', 'ID for this experiment','--oml-exp-id')
     62
     63  app.defProperty('server', 'run in server mode', '-s',
     64                  :type => :boolean)
     65
     66  app.defProperty('bandwidth', 'set target bandwidth to n bits/sec (default 1 Mbit/sec)', '-b',
     67                  :type => :string, :unit => "Mbps")
     68  app.defProperty('client', 'run in client mode, connecting to <host>', '-c',
     69                  :type => :string,
     70                  :order => 1)
     71  app.defProperty('dualtest', 'do a bidirectional test simultaneously', '-d',
     72                  :type => :boolean)
     73  app.defProperty('num', 'number of bytes to transmit (instead of -t)', '-n',
     74                  :type => :integer, :unit => "Bytes")
     75  app.defProperty('tradeoff', 'do a bidirectional test individually', '-r',
     76                  :type => :boolean)
     77  app.defProperty('time', 'time in seconds to transmit for (default 10 secs)', '-t',
     78                  :type => :integer, :unit => "seconds")
     79  app.defProperty('fileinput', 'input the data to be transmitted from a file', '-F',
     80                  :type => :string)
     81  app.defProperty('stdin', 'input the data to be transmitted from stdin', '-I',
     82                  :type => :boolean)
     83  app.defProperty('listenport', 'port to recieve bidirectional tests back on', '-L',
     84                  :type => :integer)
     85  app.defProperty('parallel', 'number of parallel client threads to run', '-P',
     86                  :type => :integer)
     87  app.defProperty('ttl', 'time-to-live, for multicast (default 1)', '-T',
     88                  :type => :integer,
     89                  :default => 1)
     90  app.defProperty('linux-congestion', 'set TCP congestion control algorithm (Linux only)', '-Z',
     91                  :type => :boolean)
     92
     93  app.defMeasurement("application"){ |m|
     94      m.defMetric('pid', :integer, 'Main process identifier')
     95      m.defMetric('version', :string, 'Iperf version')
     96      m.defMetric('cmdline', :string, 'Iperf invocation command line')
     97      m.defMetric('starttime_s', :integer, 'Time the application was received (s)')
     98      m.defMetric('starttime_us', :integer, 'Time the application was received (us)')
     99  }
     100
     101  app.defMeasurement("settings"){ |m|
     102      m.defMetric('pid', :integer, 'Main process identifier')
     103      m.defMetric('server_mode', :integer, '1 if in server mode, 0 otherwise')
     104      m.defMetric('bind_address', :string, 'Address to bind')
     105      m.defMetric('multicast', :integer, '1 if listening to a Multicast group')
     106      m.defMetric('multicast_ttl', :integer, 'Multicast TTL if relevant')
     107      m.defMetric('transport_protocol', :integer, 'Transport protocol (IANA number)')
     108      m.defMetric('window_size', :integer, 'TCP window size')
     109      m.defMetric('buffer_size', :integer, 'UDP buffer size')
     110  }
     111
     112  app.defMeasurement("connection"){ |m|
     113      m.defMetric('pid', :integer, 'Main process identifier')
     114      m.defMetric('connection_id', :integer, 'Connection identifier (socket)')
     115      m.defMetric('local_address', :string, 'Local network address')
     116      m.defMetric('local_port', :integer, 'Local port')
     117      m.defMetric('remote_address', :string, 'Remote network address')
     118      m.defMetric('remote_port', :integer, 'Remote port')
     119  }
     120
     121  app.defMeasurement("transfer"){ |m|
     122      m.defMetric('pid', :integer, 'Main process identifier')
     123      m.defMetric('connection_id', :integer, 'Connection identifier (socket)')
     124      m.defMetric('begin_interval', :double, 'Start of the averaging interval (Iperf timestamp)')
     125      m.defMetric('end_interval', :double, 'End of the averaging interval (Iperf timestamp)')
     126      m.defMetric('size', :uint64, 'Amount of transmitted data [Bytes]')
     127  }
     128
     129  app.defMeasurement("losses"){ |m|
     130      m.defMetric('pid', :integer, 'Main process identifier')
     131      m.defMetric('connection_id', :integer, 'Connection identifier (socket)')
     132      m.defMetric('begin_interval', :double, 'Start of the averaging interval (Iperf timestamp)')
     133      m.defMetric('end_interval', :double, 'End of the averaging interval (Iperf timestamp)')
     134      m.defMetric('total_datagrams', :integer, 'Total number of datagrams')
     135      m.defMetric('lost_datagrams', :integer, 'Number of lost datagrams')
     136  }
     137
     138  app.defMeasurement("jitter"){ |m|
     139      m.defMetric('pid', :integer, 'Main process identifier')
     140      m.defMetric('connection_id', :integer, 'Connection identifier (socket)')
     141      m.defMetric('begin_interval', :double, 'Start of the averaging interval (Iperf timestamp)')
     142      m.defMetric('end_interval', :double, 'End of the averaging interval (Iperf timestamp)')
     143      m.defMetric('jitter', :double, 'Average jitter [ms]')
     144}
     145
     146app.defMeasurement("packets"){ |m|
     147    m.defMetric('pid', :integer, 'Main process identifier')
     148    m.defMetric('connection_id', :integer, 'Connection identifier (socket)')
     149    m.defMetric('packet_id', :integer, 'Packet sequence number for datagram-oriented protocols')
     150    m.defMetric('packet_size', :integer, 'Packet size')
     151    m.defMetric('packet_time_s', :integer, 'Time the packet was processed (s)')
     152    m.defMetric('packet_time_us', :integer, 'Time the packet was processed (us)')
     153    m.defMetric('packet_sent_time_s', :integer, 'Time the packet was sent (s) for datagram-oriented protocols')
     154    m.defMetric('packet_sent_time_us', :integer, 'Time the packet was sent (us) for datagram-oriented protocols')
     155}
     156
     157end
     158
     159defGroup('AP', property.accesspoint) do |node|
     160  node.addApplication("iperf") do |app|
     161    app.setProperty('server', true)
     162  end
     163  node.net.w0.mode = "master"
     164  node.net.w0.type = 'g'
     165  node.net.w0.channel = "7"
     166  node.net.w0.essid = "TEST1234"
     167  node.net.w0.ip = "192.168.0.254"
     168end
     169
     170
     171res = property.client.value.split(',')
     172res.each_with_index do |v,i|
     173  defGroup("client#{i+1}", v) do |node|
     174    node.addApplication("iperf") do |app|
     175      app.setProperty('client', "192.168.0.254")
     176      app.setProperty('time', 99999)
     177      app.setProperty('interval', 5)
     178      app.setProperty('reportstyle','O')
     179      app.setProperty('oml-server', "oml:3003")
     180      app.setProperty('oml-id', "#{Experiment.ID}")
     181      app.setProperty('oml-exp-id', "#{Experiment.ID}")
     182    end
     183    node.net.w0.mode = "managed"
     184    node.net.w0.type = 'g'
     185    node.net.w0.channel = "7"
     186    node.net.w0.essid = "TEST1234"
     187    node.net.w0.ip = "192.168.0.#{i+1}"
     188  end
     189end
     190
     191
     192onEvent(:ALL_UP_AND_INSTALLED) do |event|
     193  info "Wifi Multi Client Iperf Experiment"
     194  wait 10
     195
     196  info "Start access point"
     197  group('AP').startApplications
     198
     199
     200  res.each_with_index do |v,i|
     201  info "Start client #{i+1} ==> #{v}"
     202    group("client#{i+1}").startApplications
     203    wait property.interval
     204  end
     205
     206  res.each_with_index do |v,i|
     207  info "Stop client #{i+1} ==> #{v}"
     208    group("client#{i+1}").stopApplications
     209    wait property.interval
     210  end
     211
     212  info "Stop access point"
     213  group('AP').stopApplications
     214
     215  info "All my Applications are stopped now."
     216  Experiment.done
     217end
     218}}}
     219
     220 * In the ''defApplication'' block we define several measurement points (''defMeasurement'') along with the relevant metrics (''defMetric'') that the iperf application measures. These measurement points and metrics are already defined.
     221{{{
     222app.defMeasurement("packets"){ |m|
     223    m.defMetric('pid', :integer, 'Main process identifier')
     224    m.defMetric('connection_id', :integer, 'Connection identifier (socket)')
     225    m.defMetric('packet_id', :integer, 'Packet sequence number for datagram-oriented protocols')
     226    m.defMetric('packet_size', :integer, 'Packet size')
     227    m.defMetric('packet_time_s', :integer, 'Time the packet was processed (s)')
     228    m.defMetric('packet_time_us', :integer, 'Time the packet was processed (us)')
     229    m.defMetric('packet_sent_time_s', :integer, 'Time the packet was sent (s) for datagram-oriented protocols')
     230    m.defMetric('packet_sent_time_us', :integer, 'Time the packet was sent (us) for datagram-oriented protocols')
     231}
     232}}}
     233 In the above measurement point definition, ''packets'' is a measurement point that's already defined in the iperf application. Next the metrics are defined with a name (already defined in the iperf app) along with it's object type.
     234
     235 * Since each client starts an iperf session at staggered time intervals, we define multiple client groups with only one node associated in each group.
     236{{{
     237res = property.client.value.split(',')
     238res.each_with_index do |v,i|
     239  defGroup("client#{i+1}", v) do |node|
     240    node.addApplication("iperf") do |app|
     241      app.setProperty('client', "192.168.0.254")
     242      app.setProperty('time', 99999)
     243      app.setProperty('interval', 5)
     244      app.setProperty('reportstyle','O')
     245      app.setProperty('oml-server', "oml:3003")
     246      app.setProperty('oml-id', "#{Experiment.ID}")
     247      app.setProperty('oml-exp-id', "#{Experiment.ID}")
     248    end
     249    node.net.w0.mode = "managed"
     250    node.net.w0.type = 'g'
     251    node.net.w0.channel = "7"
     252    node.net.w0.essid = "TEST1234"
     253    node.net.w0.ip = "192.168.0.#{i+1}"
     254  end
     255end
     256}}}
     257