Changes between Version 4 and Version 5 of Tutorials/a0Basic/Tutorial2


Ignore:
Timestamp:
Feb 27, 2006, 5:19:12 AM (19 years ago)
Author:
seskar
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/a0Basic/Tutorial2

    v4 v5  
    11= Tutorial 1: Hello World Example =
    22
    3 [[TOC(heading=Tutorial TOC, Tutorial, Tutorial/Testbed, Tutorial/HelloWorld, Tutorial/UnderstandingHelloWorld, Tutorial/HowtoWriteScripts, Tutorial/CollectMeasurements, Tutorial/AnalyzeResults, depth=2)]]
     3[[TOC(heading=Tutorial TOC, Tutorial, Tutorial/Testbed, Tutorial/HowtoWriteScripts, Tutorial/HelloWorld,  Tutorial/CollectMeasurements, Tutorial/AnalyzeResults, depth=2)]]
    44
    55The "Hello World" Experiment is simple.  The script for this experiment is shown below.
     
    5151Figure 1.  Script for "Hello World" Experiment
    5252
     53= Understanding the Hello World =
    5354
    54 To understand the details of the script, go to [wiki:Tutorial/UnderstandingHelloWorld Understanding the Hello World Script]
     55The first part of the script creates a group called ''sender'' and assigns node1-1 to it.
     56Next, we instruct nodehandler to assign the prototype to node1-1 using ''test:proto:sender''
     57Note that the ''sender'' prototype is defined using a corresponding ''sender.rb'' file
     58and launches an underlying application on the node. In this case, the application is ''otg'' [wiki:OTG ORBIT Traffic Generator]
     59
     60Next, we pass command line options that will be used by nodehandler when it launches the application on the node.
     61for e.g, the following description will launch
     62''otg –-destinationHost 192.168.1.2 --packetsize 1024  --rate 300 -- protocol udp''
     63
     64{{{
     65defNodes('sender', [1,1]) {|node|                   
     66node.image = nil   #Default image on the node to be used for the experiment
     67node.prototype("test:proto:sender", {
     68   'destinationHost' => '192.168.1.2',
     69    'packetSize' => 1024,
     70    'rate' => 300,
     71    'protocol' => 'udp'
     72  })
     73node.net.w0.mode = "managed"
     74}
     75}}}
     76Create a group called ''receiver'' and assign node1-2 to it.
     77Next, we instruct nodehandler to assign the prototype to node1-2 using ''test:proto:receiver''
     78Note that the ''receiver'' prototype is defined using a corresponding ''receiver.rb'' file
     79and launches an underlying application on the node.In this case, the application is ''otr''.
     80
     81Next, we pass command line options that will be used by nodehandler when it launches the application on the node.
     82for e.g, the following description will launch for e.g, the following will
     83description will cause nodeagent to launch ''otr –- protocol udp''
     84
     85{{{
     86defNodes('receiver', [1,2]) {|node|
     87  node.image = nil 
     88  node.prototype("test:proto:receiver" , {
     89    'protocol' => 'udp'
     90  })
     91  node.net.w0.mode = "Master"
     92}
     93}}}
     94Configures the first wireless card on all nodes to 802.11b, essid ‘helloworld’ with ip
     95addresses 192.168.x.y where x.y are the grid co-ordinates of the repsective nodes.
     96{{{
     97allNodes.net.w0 { |w|
     98  w.type = 'b'
     99  w.essid = "helloworld"
     100  w.ip = "%192.168.%x.%y"
     101}
     102}}}
     103Now, we start the application. This is like a barrier implementation where nodehandler waits to receive an OK message from each of
     104the nodeagents, and only proceeds when initial configurations are OK.
     105{{{
     106whenAllInstalled() {|node|
     107}}}
     108This command will request nodeagents to launch the application corresponding
     109to the role that the node is playing, e.g sender will launch the application ''otg'' and
     110the receiver will launch the application ''otr'' with the command line options
     111as specified before
     112{{{
     113allNodes.startApplications
     114}}}
     115Conduct experiment for 60 seconds
     116{{{
     117  wait 60
     118}}}
     119End of experiment – Shut down all nodes
     120{{{
     121Experiment.done
     122}}}