| 1 | [wiki:WikiStart Orbit] > [wiki:OTG OTG] > [wiki:OTG/ScriptsRepository Scripts Repository] > UDP/TCP Unicast with Expoo generator |
| 2 | |
| 3 | {{{ |
| 4 | |
| 5 | Experiment.name = "tutorial-1f" |
| 6 | Experiment.project = "orbit:tutorial" |
| 7 | # |
| 8 | # Define nodes used in experiment |
| 9 | # |
| 10 | defNodes('sender', [1,2]) {|node| |
| 11 | node.image = nil # assume the right image to be on disk |
| 12 | |
| 13 | node.prototype("test:proto:expoo_sender", { |
| 14 | 'destinationHost' => '192.168.1.1', |
| 15 | 'packetSize' => 1024, |
| 16 | 'rate' => 300, |
| 17 | 'ontime' => 0.2, |
| 18 | 'offtime' => 0.2, |
| 19 | 'protocol' => 'udp' |
| 20 | }) |
| 21 | node.net.w0.mode = "master" |
| 22 | } |
| 23 | |
| 24 | defNodes('receiver', [1,1]) {|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 = "managed" |
| 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 | }}} |