wiki:Old/Documentation/OTG/ScriptsRepository/ProtoDefExpooSender

Version 1 (modified by zhibinwu, 19 years ago) ( diff )

Orbit > OTG > Scripts Repository > expoo_sender.rb

#
# Define a prototype containing a single
# traffic generator (otg).
#

require 'handler/prototype'
require 'handler/filter'
require 'handler/appDefinition'

p = Prototype.create("test:proto:expoo_sender")
p.name = "Exponential on off Sender"
p.description = "A node which transmit a stream of packets with expoo geneator"
# List properties of prototype
p.defProperty('protocol', 'Protocol to use', 'udp')
p.defProperty('port', 'port to bind by sender', 3000)
p.defProperty('generator', 'Generator to use', 'expoo')
p.defProperty('destinationHost', 'Host to send packets to')
p.defProperty('packetSize', 'Size of packets', 1000)
p.defProperty('rate', 'Number of bits per second', 1000)
p.defProperty('ontime', 'burst length')
p.defProperty('offtime','average idle time duration')
p.defProperty('broadcast','broadcast or not', 'off')

# Define applications to be installed on this type of node,
# bind the application properties to the prototype properties,
# and finally, define what measurements should be collected
# for each application
#
otg = p.addApplication(:otg, "test:app:otg")
otg.bindProperty('protocol')
otg.bindProperty('port')
otg.bindProperty('generator')
otg.bindProperty('dsthostname', 'destinationHost')
otg.bindProperty('size', 'packetSize')
otg.bindProperty('rate')
otg.bindProperty('ontime')
otg.bindProperty('offtime')
otg.bindProperty('broadcast')

otg.addMeasurement('senderport',  Filter::TIME, 
  {Filter::SAMPLE_SIZE => 1},
  [  
    ['pkt_seqno'],
    ['pkt_size', Filter::SUM],
    ['gen_timestamp'],
    ['tx_timestamp']
  ]
)

if $0 == __FILE__
  p.to_xml.write($stdout, 2)
  puts
end

Note: See TracWiki for help on using the wiki.