| 1 | describe OTG/ScriptsRepository/ProtoDefColocateSender here |
| 2 | |
| 3 | {{{ |
| 4 | |
| 5 | # |
| 6 | # Define a prototype containing a single |
| 7 | # traffic generator (otg). |
| 8 | # |
| 9 | |
| 10 | require 'handler/prototype' |
| 11 | require 'handler/filter' |
| 12 | require 'handler/appDefinition' |
| 13 | |
| 14 | p = Prototype.create("test:proto:colocate_sender") |
| 15 | p.name = "Colocate Sender" |
| 16 | p.description = "A node which transmit several streams of packets" |
| 17 | # List properties of prototype |
| 18 | p.defProperty('protocol', 'Protocol to use', 'udp') |
| 19 | p.defProperty('port1', 'port to bind by sender', 3001) |
| 20 | p.defProperty('port2', 'port to bind by sender', 3002) |
| 21 | p.defProperty('port3', 'port to bind by sender', 3003) |
| 22 | p.defProperty('generator', 'Generator to use', 'cbr') |
| 23 | p.defProperty('destinationHost', 'Host to send packets to') |
| 24 | p.defProperty('packetSize', 'Size of packets', 1000) |
| 25 | p.defProperty('rate', 'Number of bits per second', 1000) |
| 26 | p.defProperty('broadcast','broadcast or not', 'off') |
| 27 | |
| 28 | # Define applications to be installed on this type of node, |
| 29 | # bind the application properties to the prototype properties, |
| 30 | # and finally, define what measurements should be collected |
| 31 | # for each application. |
| 32 | # |
| 33 | otg1 = p.addApplication(:otg, "test:app:otg") |
| 34 | otg1.bindProperty('protocol') |
| 35 | otg1.bindProperty('port') |
| 36 | otg1.bindProperty('generator') |
| 37 | otg1.bindProperty('dsthostname', 'destinationHost') |
| 38 | otg1.bindProperty('size', 'packetSize') |
| 39 | otg1.bindProperty('rate') |
| 40 | otg1.bindProperty('broadcast') |
| 41 | |
| 42 | otg1.addMeasurement('senderport', Filter::TIME, |
| 43 | {Filter::SAMPLE_SIZE => 1}, |
| 44 | [ |
| 45 | ['pkt_seqno'], |
| 46 | ['pkt_size', Filter::SUM], |
| 47 | ['gen_timestamp'], |
| 48 | ['tx_timestamp'] |
| 49 | ] |
| 50 | ) |
| 51 | |
| 52 | otg3 = p.addApplication(:otg, "test:app:otg") |
| 53 | otg3.bindProperty('protocol') |
| 54 | otg3.bindProperty('port') |
| 55 | otg3.bindProperty('generator') |
| 56 | otg3.bindProperty('dsthostname', 'destinationHost') |
| 57 | otg3.bindProperty('size', 'packetSize') |
| 58 | otg3.bindProperty('rate') |
| 59 | otg3.bindProperty('broadcast') |
| 60 | |
| 61 | otg3.addMeasurement('senderport', Filter::TIME, |
| 62 | {Filter::SAMPLE_SIZE => 1}, |
| 63 | [ |
| 64 | ['pkt_seqno'], |
| 65 | ['pkt_size', Filter::SUM], |
| 66 | ['gen_timestamp'], |
| 67 | ['tx_timestamp'] |
| 68 | ] |
| 69 | ) |
| 70 | |
| 71 | |
| 72 | if $0 == __FILE__ |
| 73 | p. |
| 74 | |
| 75 | |
| 76 | |
| 77 | if $0 == __FILE__ |
| 78 | p.to_xml.write($stdout, 2) |
| 79 | puts |
| 80 | end |
| 81 | |
| 82 | |
| 83 | |
| 84 | }}} |