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


Ignore:
Timestamp:
Oct 8, 2014, 5:46:32 PM (10 years ago)
Author:
nilanjan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/c0WiFi/Tutorial3

    v2 v3  
    1313     2  # Tutorial experiment
    1414     3  #
    15      4  defProperty('master', 'node15-1', "node ID for access point")
     15     4  defProperty('accesspoint', 'node15-1', "node ID for access point")
    1616     5  defProperty('client', 'node16-1,node17-1', "node ID for client nodes")
    1717     6  defProperty('duration', 60, "Seconds to run the application.")
    1818     7
    19      8  defApplication('oml:app:iperf', 'iperf') do |app|
     19     8  defApplication('iperf', 'iperf-oml2') do |app|
    2020     9
    2121    10    app.version(2, 10, 0)
     
    159159   148
    160160   149
    161    150  defGroup('AP', property.master) do |node|
    162    151    node.addApplication("oml:app:iperf") do |app|
     161   150  defGroup('AP', property.accesspoint) do |node|
     162   151    node.addApplication("iperf") do |app|
    163163   152      app.setProperty('server', true)
    164164   153    end
     
    171171   160
    172172   161  defGroup('client', property.client) do |node|
    173    162    node.addApplication("oml:app:iperf") do |app|
     173   162    node.addApplication("iperf") do |app|
    174174   163      app.setProperty('client', "192.168.0.254")
    175175   164      app.setProperty('time', 20)
     
    201201Here's brief run down with some details from top to bottom.
    202202
    203 In 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 
    205 From Lines 8 - 146 we use ''defApplication'' to define the application header for iperf.
    206 
    207 
    208 
     203* In 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
     205* From Lines 8 - 146 we use ''defApplication'' to define the application header for iperf.
     206
     207 Here we defined a reference name ''iperf'' that can be used later in the script.
     208{{{
     209defApplication('iperf', 'iperf-oml2') do |app|
     210}}}
     211
     212 The actual path to the iperf application in the node is defined.
     213{{{
     214app.path = "/usr/bin/iperf-oml2"
     215}}}
     216
     217 The numerous ''defProperty'' that follows defines a reference to the various arguments for the application. In the following definition the reference name ''interval'' is mapped to the application argument specified with the ''-i'' flag. The default value and the other properties can also be specified.
     218{{{
     219app.defProperty('interval', 'pause n seconds between periodic bandwidth reports', '-i',
     220                  :type => :double, :unit => "seconds", :default => '1.')
     221}}}
     222
     223* We define a reference name ''AP'' for the access point node using ''defGroup''
     224{{{
     225defGroup('AP', property.accespoint) do |node|
     226  node.addApplication("iperf") do |app|
     227    app.setProperty('server', true)
     228  end
     229  node.net.w0.mode = "master"
     230  node.net.w0.type = 'g'
     231  node.net.w0.channel = "6"
     232  node.net.w0.essid = "TEST1234"
     233  node.net.w0.ip = "192.168.0.254"
     234end
     235}}}
     236 Several things are happening here:
     237 1. The group name ''AP'' references the node specified in ''property.master''. This group only consists of a single node.
     238 2. ''node.addApplication'' connect the previous defined ''iperf'' application to this node with the specified arguments and values using ''setProperty''
     239 3. The wireless card properties are set using with the ''node.net.w0'' parameters. Here we set ''node.net.w0.mode'' to ''master'' to configure the wireless card as an access point. Other relevant parameters are also set here as well.
     240
     241* Likewise we use ''defGroup'' again to define a reference name ''client'' for the client node(s).
     242{{{
     243defGroup('client', property.client) do |node|
     244  node.addApplication("iperf") do |app|
     245    app.setProperty('client', "192.168.0.254")
     246    app.setProperty('time', 20)
     247    app.setProperty('interval', 5)
     248  end
     249  node.net.w0.mode = "managed"
     250  node.net.w0.type = 'g'
     251  node.net.w0.channel = "6"
     252  node.net.w0.essid = "TEST1234"
     253  node.net.w0.ip = "192.168.0.%index%"
     254end
     255}}}