Changes between Version 1 and Version 2 of Tutorials/c0WiFi/Tutorial3


Ignore:
Timestamp:
Oct 8, 2014, 4:49:26 PM (10 years ago)
Author:
nilanjan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/c0WiFi/Tutorial3

    v1 v2  
    55This tutorial shows how an experiment script configures an access point  (AP) and multiple clients for performance testing with iperf. In this experiment script we'll use an OMF feature to define an application header for iperf and run this application on the AP and access points.
    66
    7 == Experiment Script ==
     7=== Experiment Script ===
     8
     9The experiment script is shown below. Near the top of the script we define an application header for iperf.  After which we define two groups - the first group (AP) consists of a single node to be configured as an access point. The second group (client) can be single or multiple node(s) to be configured as wifi clients. Both groups add the iperf application and configure the wireless interfaces accordingly. At the bottom of the script, the nodes in the all the groups are brought up and the applications are executed.
     10
     11{{{
     12     1  #
     13     2  # Tutorial experiment
     14     3  #
     15     4  defProperty('master', 'node15-1', "node ID for access point")
     16     5  defProperty('client', 'node16-1,node17-1', "node ID for client nodes")
     17     6  defProperty('duration', 60, "Seconds to run the application.")
     18     7
     19     8  defApplication('oml:app:iperf', 'iperf') do |app|
     20     9
     21    10    app.version(2, 10, 0)
     22    11    app.shortDescription = 'Iperf traffic generator and bandwidth measurement tool'
     23    12    app.description = %{Iperf is a traffic generator and bandwidth measurement
     24    13  tool. It provides generators producing various forms of packet streams and port
     25    14  for sending these packets via various transports, such as TCP and UDP.
     26    15  }
     27    16    app.path = "/usr/bin/iperf-oml2"
     28    17
     29    18    app.defProperty('interval', 'pause n seconds between periodic bandwidth reports', '-i',
     30    19                    :type => :double, :unit => "seconds", :default => '1.')
     31    20    app.defProperty('len', 'set length read/write buffer to n (default 8 KB)', '-l',
     32    21                    :type => :integer, :unit => "KiBytes")
     33    22    app.defProperty('print_mss', 'print TCP maximum segment size (MTU - TCP/IP header)', '-m',
     34    23                    :type => :boolean)
     35    24    app.defProperty('output', 'output the report or error message to this specified file', '-o',
     36    25                    :type => :string)
     37    26    app.defProperty('port', 'set server port to listen on/connect to to n (default 5001)', '-p',
     38    27                    :type => :integer)
     39    28    app.defProperty('udp', 'use UDP rather than TCP', '-u',
     40    29                    :type => :boolean,
     41    30                    :order => 2)
     42    31    app.defProperty('window', 'TCP window size (socket buffer size)', '-w',
     43    32                    :type => :integer, :unit => "Bytes")
     44    33    app.defProperty('bind', 'bind to <host>, an interface or multicast address', '-B',
     45    34                    :type => :string)
     46    35    app.defProperty('compatibility', 'for use with older versions does not sent extra msgs', '-C',
     47    36                    :type => :boolean)
     48    37    app.defProperty('mss', 'set TCP maximum segment size (MTU - 40 bytes)', '-M',
     49    38                    :type => :integer, :unit => "Bytes")
     50    39    app.defProperty('nodelay', 'set TCP no delay, disabling Nagle\'s Algorithm', '-N',
     51    40                    :type => :boolean)
     52    41    app.defProperty('IPv6Version', 'set the domain to IPv6', '-V',
     53    42                    :type => :boolean)
     54    43    app.defProperty('reportexclude', 'exclude C(connection) D(data) M(multicast) S(settings) V(server) reports', '-x',
     55    44                    :type => :string, :unit => "[CDMSV]")
     56    45    app.defProperty('reportstyle', 'C or c for CSV report, O or o for OML', '-y',
     57    46                    :type => :string, :unit => "[CcOo]", :default => "o") # Use OML reporting by default
     58    47
     59    48    app.defProperty('oml-server', 'OML server for collecting data','--oml-server')
     60    49    app.defProperty('oml-id', 'ID for this oml client','--oml-id')
     61    50    app.defProperty('oml-exp-id', 'ID for this experiment','--oml-exp-id')
     62    51
     63    52    app.defProperty('server', 'run in server mode', '-s',
     64    53                    :type => :boolean)
     65    54
     66    55    app.defProperty('bandwidth', 'set target bandwidth to n bits/sec (default 1 Mbit/sec)', '-b',
     67    56                    :type => :string, :unit => "Mbps")
     68    57    app.defProperty('client', 'run in client mode, connecting to <host>', '-c',
     69    58                    :type => :string,
     70    59                    :order => 1)
     71    60    app.defProperty('dualtest', 'do a bidirectional test simultaneously', '-d',
     72    61                    :type => :boolean)
     73    62    app.defProperty('num', 'number of bytes to transmit (instead of -t)', '-n',
     74    63                    :type => :integer, :unit => "Bytes")
     75    64    app.defProperty('tradeoff', 'do a bidirectional test individually', '-r',
     76    65                    :type => :boolean)
     77    66    app.defProperty('time', 'time in seconds to transmit for (default 10 secs)', '-t',
     78    67                    :type => :integer, :unit => "seconds")
     79    68    app.defProperty('fileinput', 'input the data to be transmitted from a file', '-F',
     80    69                    :type => :string)
     81    70    app.defProperty('stdin', 'input the data to be transmitted from stdin', '-I',
     82    71                    :type => :boolean)
     83    72    app.defProperty('listenport', 'port to recieve bidirectional tests back on', '-L',
     84    73                    :type => :integer)
     85    74    app.defProperty('parallel', 'number of parallel client threads to run', '-P',
     86    75                    :type => :integer)
     87    76    app.defProperty('ttl', 'time-to-live, for multicast (default 1)', '-T',
     88    77                    :type => :integer,
     89    78                    :default => 1)
     90    79    app.defProperty('linux-congestion', 'set TCP congestion control algorithm (Linux only)', '-Z',
     91    80                    :type => :boolean)
     92    81
     93    82  app.defMeasurement("application"){ |m|
     94    83      m.defMetric('pid', :integer, 'Main process identifier')
     95    84      m.defMetric('version', :string, 'Iperf version')
     96    85      m.defMetric('cmdline', :string, 'Iperf invocation command line')
     97    86      m.defMetric('starttime_s', :integer, 'Time the application was received (s)')
     98    87      m.defMetric('starttime_us', :integer, 'Time the application was received (us)')
     99    88  }
     100    89
     101    90  app.defMeasurement("settings"){ |m|
     102    91      m.defMetric('pid', :integer, 'Main process identifier')
     103    92      m.defMetric('server_mode', :integer, '1 if in server mode, 0 otherwise')
     104    93      m.defMetric('bind_address', :string, 'Address to bind')
     105    94      m.defMetric('multicast', :integer, '1 if listening to a Multicast group')
     106    95      m.defMetric('multicast_ttl', :integer, 'Multicast TTL if relevant')
     107    96      m.defMetric('transport_protocol', :integer, 'Transport protocol (IANA number)')
     108    97      m.defMetric('window_size', :integer, 'TCP window size')
     109    98      m.defMetric('buffer_size', :integer, 'UDP buffer size')
     110    99  }
     111   100
     112   101  app.defMeasurement("connection"){ |m|
     113   102      m.defMetric('pid', :integer, 'Main process identifier')
     114   103      m.defMetric('connection_id', :integer, 'Connection identifier (socket)')
     115   104      m.defMetric('local_address', :string, 'Local network address')
     116   105      m.defMetric('local_port', :integer, 'Local port')
     117   106      m.defMetric('remote_address', :string, 'Remote network address')
     118   107      m.defMetric('remote_port', :integer, 'Remote port')
     119   108  }
     120   109
     121   110  app.defMeasurement("transfer"){ |m|
     122   111      m.defMetric('pid', :integer, 'Main process identifier')
     123   112      m.defMetric('connection_id', :integer, 'Connection identifier (socket)')
     124   113      m.defMetric('begin_interval', :double, 'Start of the averaging interval (Iperf timestamp)')
     125   114      m.defMetric('end_interval', :double, 'End of the averaging interval (Iperf timestamp)')
     126   115      m.defMetric('size', :uint64, 'Amount of transmitted data [Bytes]')
     127   116  }
     128   117
     129   118  app.defMeasurement("losses"){ |m|
     130   119      m.defMetric('pid', :integer, 'Main process identifier')
     131   120      m.defMetric('connection_id', :integer, 'Connection identifier (socket)')
     132   121      m.defMetric('begin_interval', :double, 'Start of the averaging interval (Iperf timestamp)')
     133   122      m.defMetric('end_interval', :double, 'End of the averaging interval (Iperf timestamp)')
     134   123      m.defMetric('total_datagrams', :integer, 'Total number of datagrams')
     135   124      m.defMetric('lost_datagrams', :integer, 'Number of lost datagrams')
     136   125  }
     137   126
     138   127  app.defMeasurement("jitter"){ |m|
     139   128      m.defMetric('pid', :integer, 'Main process identifier')
     140   129      m.defMetric('connection_id', :integer, 'Connection identifier (socket)')
     141   130      m.defMetric('begin_interval', :double, 'Start of the averaging interval (Iperf timestamp)')
     142   131      m.defMetric('end_interval', :double, 'End of the averaging interval (Iperf timestamp)')
     143   132      m.defMetric('jitter', :double, 'Average jitter [ms]')
     144   133  }
     145   134
     146   135  app.defMeasurement("packets"){ |m|
     147   136      m.defMetric('pid', :integer, 'Main process identifier')
     148   137      m.defMetric('connection_id', :integer, 'Connection identifier (socket)')
     149   138      m.defMetric('packet_id', :integer, 'Packet sequence number for datagram-oriented protocols')
     150   139      m.defMetric('packet_size', :integer, 'Packet size')
     151   140      m.defMetric('packet_time_s', :integer, 'Time the packet was processed (s)')
     152   141      m.defMetric('packet_time_us', :integer, 'Time the packet was processed (us)')
     153   142      m.defMetric('packet_sent_time_s', :integer, 'Time the packet was sent (s) for datagram-oriented protocols')
     154   143      m.defMetric('packet_sent_time_us', :integer, 'Time the packet was sent (us) for datagram-oriented protocols')
     155   144  }
     156   145
     157   146  end
     158   147
     159   148
     160   149
     161   150  defGroup('AP', property.master) do |node|
     162   151    node.addApplication("oml:app:iperf") do |app|
     163   152      app.setProperty('server', true)
     164   153    end
     165   154    node.net.w0.mode = "master"
     166   155    node.net.w0.type = 'g'
     167   156    node.net.w0.channel = "6"
     168   157    node.net.w0.essid = "TEST1234"
     169   158    node.net.w0.ip = "192.168.0.254"
     170   159  end
     171   160
     172   161  defGroup('client', property.client) do |node|
     173   162    node.addApplication("oml:app:iperf") do |app|
     174   163      app.setProperty('client', "192.168.0.254")
     175   164      app.setProperty('time', 20)
     176   165      app.setProperty('interval', 5)
     177   166      #app.setProperty('reportstyle','O')
     178   167      #app.setProperty('oml-server', "oml:3003")
     179   168      #app.setProperty('oml-id', "#{Experiment.ID}")
     180   169      #app.setProperty('oml-exp-id', "#{Experiment.ID}")
     181   170    end
     182   171    node.net.w0.mode = "managed"
     183   172    node.net.w0.type = 'g'
     184   173    node.net.w0.channel = "6"
     185   174    node.net.w0.essid = "TEST1234"
     186   175    node.net.w0.ip = "192.168.0.%index%"
     187   176  end
     188   177
     189   178  onEvent(:ALL_UP_AND_INSTALLED) do |event|
     190   179    info "Wifi Multi Client Iperf Experiment"
     191   180    wait 10
     192   181    allGroups.startApplications
     193   182    info "All my Applications are started now..."
     194   183    wait property.duration
     195   184    allGroups.stopApplications
     196   185    info "All my Applications are stopped now."
     197   186    Experiment.done
     198   187  end
     199}}}
     200
     201Here's brief run down with some details from top to bottom.
     202
     203In Lines 4-6 we use ''defProperty'' to define a few experiment properties along with default values which allows the script to be executed with arguments passed from the command line.
     204
     205From Lines 8 - 146 we use ''defApplication'' to define the application header for iperf.
     206
     207
     208