| 1 | [wiki:WikiStart Orbit] > [wiki:NodeHandler NodeHandler] > [wiki:NodeHandler/Tutorial Tutorial] > Understanding Hello World Experiment Script |
| 2 | |
| 3 | = Understanding the tutorial script = |
| 4 | An experiment name is used to create the corresponding database to store results and to create a unique log for the same |
| 5 | {{{ |
| 6 | Experiment.name = "tutorial-1a" |
| 7 | Experiment.project = "orbit:tutorial" |
| 8 | }}} |
| 9 | Create a group of nodes called ‘sender’ and assign node1-1 to it |
| 10 | To the group sender, we assign a role that all nodes belonging to this group will |
| 11 | play. Here, we instruct nodehandler to assign the prototype sender to node1-1 |
| 12 | Note that the ‘sender’ prototype is defined using a corresponding ‘sender.rb’ file |
| 13 | and is tied to an actual underlying application that will actual get launched on the |
| 14 | node (In this case, the application is ‘otg’ (ORBIT Traffic Generator) |
| 15 | |
| 16 | These are the command line arguments that will be used by nodehandler when it |
| 17 | asks the nodeagent to launch the application, for e.g, the following will |
| 18 | description will cause nodeagent to launch ‘otg –destinationHost 192.168.1.3 -- |
| 19 | packetsize 1024 --rate 300 -- protocol udp |
| 20 | {{{ |
| 21 | defNodes('sender', [1,1]) {|node| |
| 22 | node.image = nil #Default image on the node to be used for the experiment |
| 23 | node.prototype("test:proto:sender", { |
| 24 | 'destinationHost' => '192.168.1.3', |
| 25 | 'packetSize' => 1024, |
| 26 | 'rate' => 300, |
| 27 | 'protocol' => 'udp' |
| 28 | }) |
| 29 | node.net.w0.mode = "ad-hoc" |
| 30 | } |
| 31 | }}} |
| 32 | Create a group of nodes called ‘receiver’ and assign node1-3 to it |
| 33 | To the group receiver, we assign a role that all nodes belonging to this group will |
| 34 | play. Here, we instruct nodehandler to assign the prototype receiver to node1-3 |
| 35 | Note that the ‘sender’ prototype is defined using a corresponding ‘receiver.rb’ file |
| 36 | and is tied to an actual underlying application that will actual get launched on the |
| 37 | node (In this case, the application is ‘otr’ (ORBIT Traffic Receiver) |
| 38 | |
| 39 | These are the command line arguments that will be used by nodehandler when it |
| 40 | asks the nodeagent to launch the application, for e.g, the following will |
| 41 | description will cause nodeagent to launch ‘otr -- hostname 192.168.1.3 –- protocol udp |
| 42 | {{{ |
| 43 | defNodes('receiver', [1,3]) {|node| |
| 44 | node.image = nil |
| 45 | node.prototype("test:proto:receiver" , { |
| 46 | 'hostname' => '192.168.1.3', |
| 47 | 'protocol' => 'udp' |
| 48 | }) |
| 49 | node.net.w0.mode = "ad-hoc" |
| 50 | } |
| 51 | }}} |
| 52 | Configures the first wireless card on all nodes to 802.11b, essid ‘helloworld’ with ip |
| 53 | addresses 192.168.x.y where x.y are the co-ordinates of the nodes |
| 54 | {{{ |
| 55 | allNodes.net.w0 { |w| |
| 56 | w.type = 'b' |
| 57 | w.essid = "helloworld" |
| 58 | w.ip = "%192.168.%x.%y" |
| 59 | } |
| 60 | }}} |
| 61 | Now, start the application, |
| 62 | This is a barrier where nodehandler waits to receive an OK message from each of |
| 63 | the nodeagents, only proceeds when initial configurations are OK. |
| 64 | {{{ |
| 65 | whenAllInstalled() {|node| |
| 66 | }}} |
| 67 | This command will request nodeagents to launch the application corresponding |
| 68 | to the role that the node is playing, e.g sender will launch the application ‘otg’ and |
| 69 | the receiver will launch the application ‘otr’ with the command line options |
| 70 | as specified before |
| 71 | {{{ |
| 72 | allNodes.startApplications |
| 73 | }}} |
| 74 | Conduct experiment for 60 seconds |
| 75 | {{{ |
| 76 | wait 60 |
| 77 | }}} |
| 78 | End of experiment – Shut down all nodes |
| 79 | {{{ |
| 80 | Experiment.done |
| 81 | }}} |