| 1 | {{{ |
| 2 | # |
| 3 | # Create an application representation from scratch |
| 4 | # |
| 5 | require 'handler/appDefinition' |
| 6 | |
| 7 | a = AppDefinition.create('test:app:itgr') |
| 8 | a.name = "itgr" |
| 9 | a.version(0, 0, 1) |
| 10 | a.shortDescription = "D-ITG Receiver" |
| 11 | a.description = <<TEXT |
| 12 | D-ITG is a traffic generator for TCP and UDP traffic. It contains generators |
| 13 | producing various forms of packet streams and port for sending |
| 14 | these packets via various transports, such as TCP and UDP. |
| 15 | TEXT |
| 16 | |
| 17 | # addProperty(name, description, mnemonic, type, isDynamic = false, constraints = nil) |
| 18 | #Flow options |
| 19 | a.addProperty('l', 'Log file', ?l, String, false) |
| 20 | |
| 21 | a.addMeasurement("receiverport", nil, [ |
| 22 | ['flow_no', 'int'], |
| 23 | ['min_delay', Float], |
| 24 | ['max_delay', Float], |
| 25 | ['avg_delay', Float], |
| 26 | ['avg_jitter', Float], |
| 27 | ['delay_stdev', Float], |
| 28 | ['avg_throughput', Float], |
| 29 | ['packet_loss', Float] |
| 30 | ]) |
| 31 | |
| 32 | a.path = "/usr/local/bin/ITGRecv" |
| 33 | |
| 34 | if $0 == __FILE__ |
| 35 | require 'stringio' |
| 36 | require 'rexml/document' |
| 37 | include REXML |
| 38 | |
| 39 | sio = StringIO.new() |
| 40 | a.to_xml.write(sio, 2) |
| 41 | sio.rewind |
| 42 | puts sio.read |
| 43 | |
| 44 | sio.rewind |
| 45 | doc = Document.new(sio) |
| 46 | t = AppDefinition.from_xml(doc.root) |
| 47 | puts |
| 48 | puts "-------------------------" |
| 49 | puts |
| 50 | t.to_xml.write($stdout, 2) |
| 51 | |
| 52 | end |
| 53 | |
| 54 | |
| 55 | }}} |