| 1 | [wiki:WikiStart Orbit] > Tutorial-1: Hello World Example |
| 2 | |
| 3 | The "Hello World" Experiment is simple. The script for this experiment is shown below. |
| 4 | |
| 5 | {{{ |
| 6 | Experiment.name = "tutorial-1a" |
| 7 | Experiment.project = "orbit:tutorial" |
| 8 | |
| 9 | # |
| 10 | # Define nodes used in experiment |
| 11 | # |
| 12 | defNodes('sender', [1,1]) {|node| |
| 13 | node.image = nil # assume the right image to be on disk |
| 14 | |
| 15 | node.prototype("test:proto:sender", { |
| 16 | 'destinationHost' => '192.168.1.2', |
| 17 | 'packetSize' => 1024, |
| 18 | 'rate' => 300, |
| 19 | 'protocol' => 'udp' |
| 20 | }) |
| 21 | node.net.w0.mode = "managed" |
| 22 | } |
| 23 | |
| 24 | defNodes('receiver', [1,2]) {|node| |
| 25 | node.image = nil # assume the right image to be on disk |
| 26 | node.prototype("test:proto:receiver" , { |
| 27 | 'protocol' => 'udp' |
| 28 | }) |
| 29 | node.net.w0.mode = "master" |
| 30 | } |
| 31 | |
| 32 | allNodes.net.w0 { |w| |
| 33 | w.type = 'b' |
| 34 | w.essid = "helloworld" |
| 35 | w.ip = "%192.168.%x.%y" |
| 36 | } |
| 37 | |
| 38 | # |
| 39 | # Now, start the application |
| 40 | # |
| 41 | whenAllInstalled() {|node| |
| 42 | wait 30 |
| 43 | |
| 44 | allNodes.startApplications |
| 45 | wait 40 |
| 46 | |
| 47 | Experiment.done |
| 48 | } |
| 49 | }}} |
| 50 | |
| 51 | Figure 1. Script for "Hello World" Experiment |
| 52 | |
| 53 | |
| 54 | To understand the details of the script, go [wiki:Tutorial/UnderstandingHelloWorld Understanding the Hello World Script] |