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 | {{{ |
| 209 | defApplication('iperf', 'iperf-oml2') do |app| |
| 210 | }}} |
| 211 | |
| 212 | The actual path to the iperf application in the node is defined. |
| 213 | {{{ |
| 214 | app.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 | {{{ |
| 219 | app.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 | {{{ |
| 225 | defGroup('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" |
| 234 | end |
| 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 | {{{ |
| 243 | defGroup('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%" |
| 254 | end |
| 255 | }}} |