| 1 | {{{ |
| 2 | # |
| 3 | # Define a prototype containing a single |
| 4 | # traffic generator (otg). |
| 5 | # |
| 6 | |
| 7 | require 'handler/prototype' |
| 8 | require 'handler/filter' |
| 9 | require 'handler/appDefinition' |
| 10 | |
| 11 | p = Prototype.create("test:proto:sender") |
| 12 | p.name = "Sender" |
| 13 | p.description = "A node which transmit a stream of packets" |
| 14 | # List properties of prototype |
| 15 | p.defProperty('protocol', 'Protocol to use', 'udp') |
| 16 | p.defProperty('generator', 'Generator to use', 'cbr') |
| 17 | p.defProperty('destinationHost', 'Host to send packets to') |
| 18 | p.defProperty('packetSize', 'Size of packets', 1000) |
| 19 | p.defProperty('rate', 'Number of bits per second', 1000) |
| 20 | p.defProperty('broadcast','broadcast or not', 'off') |
| 21 | |
| 22 | # Define applications to be installed on this type of node, |
| 23 | # bind the application properties to the prototype properties, |
| 24 | # and finally, define what measurements should be collected |
| 25 | # for each application. |
| 26 | # |
| 27 | otg = p.addApplication(:otg, "test:app:otg") |
| 28 | otg.bindProperty('protocol') |
| 29 | ptg.bindProperty('generator') |
| 30 | otg.bindProperty('dsthostname', 'destinationHost') |
| 31 | otg.bindProperty('size', 'packetSize') |
| 32 | otg.bindProperty('rate') |
| 33 | otg.bindProperty('broadcast') |
| 34 | |
| 35 | otg.addMeasurement('senderport', Filter::TIME, |
| 36 | {Filter::SAMPLE_SIZE => 1}, |
| 37 | [ |
| 38 | ['pkt_seqno'], |
| 39 | ['pkt_size', Filter::SUM], |
| 40 | ['gen_timestamp'], |
| 41 | ['tx_timestamp'] |
| 42 | ] |
| 43 | ) |
| 44 | |
| 45 | if $0 == __FILE__ |
| 46 | p.to_xml.write($stdout, 2) |
| 47 | puts |
| 48 | end |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | }}} |