Changes between Version 6 and Version 7 of Tutorials/a0Basic/Tutorial2


Ignore:
Timestamp:
Apr 13, 2006, 11:17:34 AM (18 years ago)
Author:
max
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/a0Basic/Tutorial2

    v6 v7  
    33[[TOC(heading=Tutorial TOC, Tutorial, Tutorial/Testbed, Tutorial/HowtoWriteScripts, Tutorial/HelloWorld,   Tutorial/CollectMeasurements, Tutorial/AnalyzeResults, depth=2)]]
    44
    5 The "Hello World" Experiment is simple.  The script for this experiment is shown below.
     5In the "Hello World" experiment, a ''sender'' node sends a data stream to a ''receiver'' node.  The script for this experiment is shown below.
    66
    77{{{
     
    1111#
    1212defNodes('sender', [1,1]) {|node|
    13   node.image = nil  # assume the right image to be on disk
    14 
    1513  node.prototype("test:proto:sender", {
    1614    'destinationHost' => '192.168.1.2',
     
    2321
    2422defNodes('receiver', [1,2]) {|node|
    25   node.image = nil  # assume the right image to be on disk
    2623  node.prototype("test:proto:receiver" , {
    2724    'protocol' => 'udp'
     
    5451
    5552The first part of the script creates a group called ''sender'' and assigns node1-1 to it.
    56 Next, we instruct nodehandler to assign the prototype to node1-1 using ''test:proto:sender''
    57 Note that the ''sender'' prototype is defined using a corresponding ''sender.rb'' file
    58 and launches an underlying application on the node. In this case, the application is ''otg'' [wiki:OTG ORBIT Traffic Generator]
    59 
    60 Next, we pass command line options that will be used by nodehandler when it launches the application on the node.
    61 for e.g, the following description will launch
    62 ''otg –-destinationHost 192.168.1.2 --packetsize 1024  --rate 300 -- protocol udp''
     53Next, we instruct nodehandler to assign the prototype ''test:proto:sender'' to node1-1. A prototype is similar to a function or macro in conventional programming languages and defines in this case a re-usable configuration. The prototypes are normally defined in separate files .  In this case, the prototype contains instructions to install a traffic generator, but we will learn about this later. What is important here is that a prototype can define properties which allows us to customize it for the specific experiment. In this experiment, we can set the address of the sender, and various properties of the traffic generator itself, such as packet size, rate, and the protocol over which to send the traffic.
    6354
    6455{{{
    6556defNodes('sender', [1,1]) {|node|                   
    66 node.image = nil   #Default image on the node to be used for the experiment
    67 node.prototype("test:proto:sender", {
    68    'destinationHost' => '192.168.1.2',
     57  node.prototype("test:proto:sender", {
     58    'destinationHost' => '192.168.1.2',
    6959    'packetSize' => 1024,
    7060    'rate' => 300,
    7161    'protocol' => 'udp'
    7262  })
    73 node.net.w0.mode = "managed"
     63  node.net.w0.mode = "managed"
    7464}
    7565}}}
    76 Create a group called ''receiver'' and assign node1-2 to it.
    77 Next, we instruct nodehandler to assign the prototype to node1-2 using ''test:proto:receiver''
    78 Note that the ''receiver'' prototype is defined using a corresponding ''receiver.rb'' file
    79 and launches an underlying application on the node.In this case, the application is ''otr''.
     66The last line 'node.net.w0.mode' configures the first wireless interface ''w0'' to be used in ''managed'' mode.
    8067
    81 Next, we pass command line options that will be used by nodehandler when it launches the application on the node.
    82 for e.g, the following description will launch for e.g, the following will
    83 description will cause nodeagent to launch ''otr –- protocol udp''
     68The next block of code defines the receiver in similar fashion. We are using the ''receiver'' prototype here which installs a traffic sink. In addition, we are setting the receiver's first wireless interface to ''master'' mode.
    8469
    8570{{{
    8671defNodes('receiver', [1,2]) {|node|
    87   node.image = nil 
    8872  node.prototype("test:proto:receiver" , {
    8973    'protocol' => 'udp'
    9074  })
    91   node.net.w0.mode = "Master"
     75  node.net.w0.mode = "master"
    9276}
    9377}}}
     78
     79
    9480Configures the first wireless card on all nodes to 802.11b, essid ‘helloworld’ with ip
    9581addresses 192.168.x.y where x.y are the grid co-ordinates of the repsective nodes.