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