wiki:Documentation/OtherApps/Iperf/IperfSender

Version 1 (modified by Surya Satyavolu, 18 years ago) ( diff )

# Create an application representation from scratch
#
require 'handler/appDefinition'

a = AppDefinition.create('test:app:iperfs')
a.name = "iperfs"
a.version(0, 0, 1)
a.shortDescription = "Iperf traffic generator"
a.description = <<TEXT
Iperf is a traffic generator for TCP and UDP traffic. It contains generators 
producing various forms of packet streams and port for sending
these packets via various transports, such as TCP and UDP.
TEXT

# addProperty(name, description, mnemonic, type, isDynamic = false, constraints = nil)
a.addProperty('udp', 'Use UDP, otherwise TCP by default', nil, String, false)
a.addProperty('client', 'Run as client', nil, String, false)
a.addProperty('port', 'Sender port number', nil, Integer, false)
a.addProperty('window', 'TCP Send Window Size', nil, Integer, false)
a.addProperty('len', "Payload length (bytes)", nil, Integer, false)
a.addProperty('bandwidth', "Offered load for UDP", nil, Integer, false)
a.addProperty('time', "Duration of traffic generation(secs)", nil, Integer, false)
a.addProperty('parallel', "Number of parallel flows", nil, Integer, false)

a.path = "/usr/bin/iperf"

if $0 == __FILE__
  require 'stringio'
  require 'rexml/document'
  include REXML
    
  sio = StringIO.new()
  a.to_xml.write(sio, 2)
  sio.rewind
  puts sio.read
  
  sio.rewind
  doc = Document.new(sio)
  t = AppDefinition.from_xml(doc.root)


Note: See TracWiki for help on using the wiki.