| 1 | [wiki:WikiStart Orbit] > [wiki:OTG OTG] > [wiki:OTG/ScriptsRepository Scripts Repository] > Start 3 UDP sessions in the same node |
| 2 | |
| 3 | {{{ |
| 4 | Experiment.name = "tutorial-1d" |
| 5 | Experiment.project = "orbit:tutorial" |
| 6 | |
| 7 | # |
| 8 | # Define nodes used in experiment |
| 9 | # |
| 10 | defNodes('sender1', [1,2]) {|node| |
| 11 | node.image = nil # assume the right image to be on disk |
| 12 | |
| 13 | node.prototype("test:proto:sender", { |
| 14 | 'destinationHost' => '192.168.1.1', |
| 15 | 'packetSize' => 1024, |
| 16 | 'port' => 3001, |
| 17 | 'rate' => 300, |
| 18 | 'protocol' => 'udp' |
| 19 | }) |
| 20 | node.net.w0.mode = "master" |
| 21 | } |
| 22 | |
| 23 | defNodes('sender2', [1,2]) {|node| |
| 24 | node.image = nil # assume the right image to be on disk |
| 25 | |
| 26 | node.prototype("test:proto:sender", { |
| 27 | 'destinationHost' => '192.168.1.1', |
| 28 | 'packetSize' => 1024, |
| 29 | 'port' => 3002, |
| 30 | 'rate' => 300, |
| 31 | 'protocol' => 'udp' |
| 32 | }) |
| 33 | node.net.w0.mode = "master" |
| 34 | } |
| 35 | |
| 36 | defNodes('sender3', [1,2]) {|node| |
| 37 | node.image = nil # assume the right image to be on disk |
| 38 | |
| 39 | node.prototype("test:proto:sender", { |
| 40 | 'destinationHost' => '192.168.1.1', |
| 41 | 'packetSize' => 1024, |
| 42 | 'port' => 3003, |
| 43 | 'rate' => 300, |
| 44 | 'protocol' => 'udp' |
| 45 | }) |
| 46 | node.net.w0.mode = "master" |
| 47 | } |
| 48 | |
| 49 | defNodes('receiver', [1,1]) {|node| |
| 50 | node.image = nil # assume the right image to be on disk |
| 51 | node.prototype("test:proto:receiver" , { |
| 52 | 'protocol' => 'udp' |
| 53 | }) |
| 54 | node.net.w0.mode = "managed" |
| 55 | } |
| 56 | |
| 57 | allNodes.net.w0 { |w| |
| 58 | w.type = 'b' |
| 59 | w.essid = "helloworld" |
| 60 | w.ip = "%192.168.%x.%y" |
| 61 | } |
| 62 | |
| 63 | # |
| 64 | # Now, start the application |
| 65 | # |
| 66 | whenAllInstalled() {|node| |
| 67 | wait 30 |
| 68 | |
| 69 | allNodes.startApplications |
| 70 | wait 40 |
| 71 | |
| 72 | Experiment.done |
| 73 | |
| 74 | |
| 75 | }}} |