wiki:Documentation/OtherApps/Iperf/IperfReceiver
#
# Create an application representation from scratch
#
require 'handler/appDefinition'

a = AppDefinition.create('test:app:iperfr')
a.name = "iperfr"
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('server', 'Client/Server', nil, String, false)
a.addProperty('port', 'Receiver port number', nil, Integer, false)
a.addProperty('window', 'TCP Receiver Window Size', nil, Integer, false)
a.addProperty('time', "Duration for traffic generation(seconds)", nil, Integer, 
false)
a.addProperty('len', "Payload Length(bytes)", nil, Integer, false)
a.addProperty('interval', "Interval between reports (sec)", nil, Integer, false)

a.addMeasurement("receiverport", nil, [
  ['flow_no','int'],
  ['throughput',Float],
  ['jitter',Float],
  ['packet_loss',Float]
 ])
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)
  
  puts
  puts "-------------------------"
  puts
  t.to_xml.write($stdout, 2)
  
end



Last modified 18 years ago Last modified on Sep 5, 2006, 9:41:15 PM
Note: See TracWiki for help on using the wiki.