Changes between Initial Version and Version 1 of Old/OtherApps/ScriptsRepository


Ignore:
Timestamp:
Oct 8, 2005, 6:35:26 PM (19 years ago)
Author:
Surya Satyavolu
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Old/OtherApps/ScriptsRepository

    v1 v1  
     1[wiki:WikiStart Orbit] > [wiki:OtherApps Other Applications] > Iperf Scripts
     2
     3= Application Definition Schema =
     4The application definition schema for the Iperf application is as follows
     5{{{
     6<?xml version="1.0" encoding="UTF-8"?>
     7<orbit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     8        <application id="orbit_winlab_iperf">
     9                <name>iperf</name>
     10                <id>iperf</id>
     11                <version major="0" minor="1" revision="0"/>
     12                <organization>
     13                        <name>WINLAB, Rutgers University</name>
     14                        <url>http://www.winlab.rutgers.edu/</url>
     15                </organization>
     16                <shortDescription>Traffic Generator</shortDescription>
     17                <description>Receive network traffic on the specified interface
     18                    </description>
     19                <url>http://apps.orbit-lab.org/otr</url>
     20                <measurement-points>
     21                        <measurement-point id="receiverport">
     22                                <metric id="flow_no" type="int">
     23                                        <description>id of the flow</description>
     24                                </metric>
     25                                <metric id="throughput" type="float">
     26                                        <description> Flow Throughput</description>
     27                                </metric>
     28                                <metric id="jitter" type="float">
     29                                        <description>Flow jitter</description>
     30                                </metric>
     31                                <metric id="packet_loss" type="float"/>
     32                                <description>Flow Packet loss</description>
     33                        </measurement-point>
     34                </measurement-points>
     35                <issueTrackingUrl>http://apps.orbit-lab.org/issues/winlab/iperf
     36                     </issueTrackingUrl>
     37                <repository>
     38                        <development>scm:cvs:pserver:anoncvs@cvs.orbit-lab.org:/trafficgenerator/iperf</development>
     39                        <binary>apt:repository.orbit-lab.org/orbit/binary:???</binary>
     40                </repository>
     41                <mailingLists/>
     42                <developers>
     43                        <developer>
     44                                <name>John Doe</name>
     45                                <id>jdoe</id>
     46                                <email>jdoe@winlab.rutgers.edu</email>
     47                                <organization>
     48                                        <name>WINLAB, Rutgers University</name>
     49                                </organization>
     50                        </developer>
     51                </developers>
     52                <dependencies>
     53                        <dependency>
     54                                <id>libmac</id>
     55                                <version>&gt;= 0.4</version>
     56                                <url>apt:repository.orbit-lab.org/debian/binary:libmac
     57                                        </url>
     58                        </dependency>
     59                </dependencies>
     60        </application>
     61</orbit>
     62
     63}}}
     64
     65= Application definition script for Iperf sender and Receiver =
     66
     67== Iperf Sender ==
     68{{{
     69#
     70# Create an application representation from scratch
     71#
     72require 'appDefinition'
     73
     74a = AppDefinition.create('test:app:iperfs')
     75a.name = "iperfs"
     76a.version(0, 0, 1)
     77a.shortDescription = "Iperf traffic generator"
     78a.description = <<TEXT
     79Iperf is a traffic generator for TCP and UDP traffic. It contains generators
     80producing various forms of packet streams and port for sending
     81these packets via various transports, such as TCP and UDP.
     82TEXT
     83
     84# addProperty(name, description, mnemonic, type, isDynamic = false, constraints = nil)
     85a.addProperty('udp', 'Use UDP, otherwise TCP by default', nil, String, false)
     86a.addProperty('client', 'Run as client', nil, String, false)
     87a.addProperty('port', 'Sender port number', nil, Integer, false)
     88a.addProperty('window', 'TCP Send Window Size', nil, Integer, false)
     89a.addProperty('len', "Payload length (bytes)", nil, Integer, false)
     90a.addProperty('bandwidth', "Offered load for UDP", nil, Integer, false)
     91a.addProperty('time', "Duration of traffic generation(secs)", nil, Integer, false)
     92a.addProperty('parallel', "Number of parallel flows", nil, Integer, false)
     93
     94a.addMeasurement("senderport", nil, [
     95    ['stream_no', 'int'],
     96    ['pkt_seqno', 'long'],
     97    ['pkt_size', 'long'],
     98    ['gen_timestamp', 'long'],
     99    ['tx_timestamp', 'long']
     100 ])
     101
     102a.path = "/usr/local/bin/iperf"
     103
     104if $0 == __FILE__
     105  require 'stringio'
     106  require 'rexml/document'
     107  include REXML
     108   
     109  sio = StringIO.new()
     110  a.to_xml.write(sio, 2)
     111  sio.rewind
     112  puts sio.read
     113 
     114  sio.rewind
     115  doc = Document.new(sio)
     116  t = AppDefinition.from_xml(doc.root)
     117 
     118  puts
     119  puts "-------------------------"
     120  puts
     121  t.to_xml.write($stdout, 2)
     122 
     123end
     124
     125}}}
     126== Iperf Receiver ==
     127{{{
     128#
     129# Create an application representation from scratch
     130#
     131require 'appDefinition'
     132
     133a = AppDefinition.create('test:app:iperfr')
     134a.name = "iperfr"
     135a.version(0, 0, 1)
     136a.shortDescription = "Iperf traffic generator"
     137a.description = <<TEXT
     138Iperf is a traffic generator for TCP and UDP traffic. It contains generators
     139producing various forms of packet streams and port for sending
     140these packets via various transports, such as TCP and UDP.
     141TEXT
     142
     143# addProperty(name, description, mnemonic, type, isDynamic = false, constraints = nil)
     144a.addProperty('udp', 'Use UDP, otherwise TCP by default', nil, String, false)
     145a.addProperty('server', 'Client/Server', nil, String, false)
     146a.addProperty('port', 'Receiver port number', nil, Integer, false)
     147a.addProperty('window', 'TCP Receiver Window Size', nil, Integer, false)
     148a.addProperty('time', "Duration for traffic generation(seconds)", nil, Integer, false)
     149a.addProperty('len', "Payload Length(bytes)", nil, Integer, false)
     150a.addProperty('interval', "Interval between reports (sec)", nil, Integer, false)
     151
     152a.addMeasurement("receiverport", nil, [
     153  ['flow_no', 'int', 'id of the flow'],
     154  ['throughput', Float, 'Flow Throughput'],
     155  ['jitter', Float,'Average Jitter'],
     156  ['packet_loss',Float,'Packet loss']
     157 ])
     158a.path = "/usr/local/bin/iperf"
     159
     160if $0 == __FILE__
     161  require 'stringio'
     162  require 'rexml/document'
     163  include REXML
     164   
     165  sio = StringIO.new()
     166  a.to_xml.write(sio, 2)
     167  sio.rewind
     168  puts sio.read
     169 
     170  sio.rewind
     171  doc = Document.new(sio)
     172  t = AppDefinition.from_xml(doc.root)
     173 
     174  puts
     175  puts "-------------------------"
     176  puts
     177  t.to_xml.write($stdout, 2)
     178 
     179end
     180
     181}}}
     182= Sample prototype definitions script for Iperf UDP and TCP (sender and Receiver) =
     183
     184== Iperf UDP Sender ==
     185{{{
     186#
     187# Define a prototype
     188#
     189require 'prototype'
     190require 'filter'
     191require 'appDefinition'
     192
     193p = Prototype.create("test:proto:iperfudpsender")
     194p.name = "Iperf UDP Sender"
     195p.description = "Nodes which send a stream of packets"
     196p.defProperty('use_udp', 'Protocol to use')
     197p.defProperty('client', 'Host to send packets to')
     198p.defProperty('sender_rate', 'Number of bits per second', 100000)
     199p.defProperty('len', 'Size of packets')
     200p.defProperty('time', 'Experiment duration (sec)', 10)
     201
     202iperfs = p.addApplication(:iperfs, "test:app:iperfs")
     203iperfs.bindProperty('udp','use_udp')
     204iperfs.bindProperty('client')
     205iperfs.bindProperty('bandwidth','sender_rate')
     206iperfs.bindProperty('len')
     207iperfs.bindProperty('time')
     208
     209iperfs.addMeasurement('senderport',  Filter::TIME,
     210  {Filter::SAMPLE_SIZE => 1},
     211  [
     212    ['stream_no'],
     213    ['pkt_seqno'],
     214    ['pkt_size', Filter::SUM],
     215    ['gen_timestamp'],
     216    ['tx_timestamp']
     217  ]
     218)
     219if $0 == __FILE__
     220  p.to_xml.write($stdout, 2)
     221  puts
     222end
     223
     224}}}
     225== Iperf UDP Receiver ==
     226{{{
     227#
     228# Define a prototype
     229#
     230
     231require 'prototype'
     232require 'filter'
     233require 'appDefinition'
     234
     235p = Prototype.create("test:proto:iperfudpreceiver")
     236p.name = "Iperf UDP Receiver"
     237p.description = "Nodes which receive packets"
     238p.defProperty('use_udp', 'Protocol to use')
     239p.defProperty('server', 'Client/Server')
     240p.defProperty('time', 'Duration of experiment (seconds)', 10)
     241p.defProperty('len', 'Payload length', 512)
     242p.defProperty('report_interval', 'Interval between bandwidth reports', 1)
     243
     244iperfr = p.addApplication('iperfr', "test:app:iperfr")
     245iperfr.bindProperty('udp')
     246iperfr.bindProperty('server')
     247iperfr.bindProperty('time')
     248iperfr.bindProperty('len')
     249iperfr.bindProperty('interval','report_interval')
     250
     251iperfr.addMeasurement('receiverport',  Filter::TIME,
     252  {Filter::SAMPLE_SIZE => 1},
     253  [
     254    ['flow_no'],
     255    ['throughput'],
     256    ['jitter'],     
     257    ['packet_loss']
     258  ]
     259)
     260if $0 == __FILE__
     261  p.to_xml.write($stdout, 2)
     262  puts
     263end
     264
     265}}}
     266== Iperf TCP Sender ==
     267{{{
     268#
     269# Define a prototype
     270#
     271require 'prototype'
     272require 'filter'
     273require 'appDefinition'
     274
     275p = Prototype.create("test:proto:iperftcpsender")
     276p.name = "Iperf TCP Sender"
     277p.description = "Nodes which send a stream of packets"
     278p.defProperty('client', 'Host to send packets to')
     279#p.defProperty('port', 'Port to send packets to')
     280p.defProperty('len', 'Size of packets')
     281p.defProperty('window', 'TCP window Size (bytes)', 64000)
     282p.defProperty('time', 'Experiment duration (sec)', 10)
     283
     284iperfs = p.addApplication(:iperfs, "test:app:iperfs")
     285iperfs.bindProperty('client')
     286iperfs.bindProperty('len')
     287iperfs.bindProperty('time')
     288iperfs.bindProperty('window')
     289
     290iperfs.addMeasurement('senderport',  Filter::TIME,
     291  {Filter::SAMPLE_SIZE => 1},
     292  [
     293    ['stream_no'],
     294    ['pkt_seqno'],
     295    ['pkt_size', Filter::SUM],
     296    ['gen_timestamp'],
     297    ['tx_timestamp']
     298  ]
     299)
     300#
     301if $0 == __FILE__
     302  p.to_xml.write($stdout, 2)
     303  puts
     304end
     305
     306}}}
     307== Iperf TCP Receiver ==
     308{{{
     309#
     310# Define a prototype
     311#
     312
     313require 'prototype'
     314require 'filter'
     315require 'appDefinition'
     316
     317p = Prototype.create("test:proto:iperftcpreceiver")
     318p.name = "Iperf TCP Receiver"
     319p.description = "Nodes which receive packets"
     320p.defProperty('server', 'Client/Server')
     321p.defProperty('time', 'Duration of experiment (seconds)', 10)
     322p.defProperty('window', 'Receiver Window Size', 64000)
     323p.defProperty('report_interval', 'Interval beween reports', 1)
     324
     325
     326iperfr = p.addApplication('iperfr', "test:app:iperfr")
     327iperfr.bindProperty('server')
     328iperfr.bindProperty('time')
     329iperfr.bindProperty('window')
     330iperfr.bindProperty('interval', 'report_interval')
     331
     332iperfr.addMeasurement('receiverport',  Filter::TIME,
     333  {Filter::SAMPLE_SIZE => 1},
     334    [
     335      ['flow_no'],
     336      ['throughput'],
     337    ] )
     338
     339if $0 == __FILE__
     340  p.to_xml.write($stdout, 2)
     341  puts
     342end
     343
     344}}}
     345
     346= Experiment script for Iperf =
     347{{{
     348############# Tutorial1 ##################################
     349# This script defines the experiment
     350# that has one sender and one receiver using Iperf
     351# Sender, Receiver - 802.11a channel 36
     352# UDP flow at 1 Mbps
     353# Receiver reports throughput, packet loss and jitter
     354############################################################
     355
     356require 'net/http'
     357require 'uri'
     358
     359Experiment.name = "tutorial-iperf"
     360Experiment.project = "orbit:tutorial"
     361
     362###########################################
     363# Sender definition and configuration
     364###########################################
     365defNodes('sender',[1,1]) {|node|
     366  node.image = nil  # assume the right image to be on disk
     367  # use prototype "iperfudpsender"
     368  # and set it's property "destinationHost" to
     369  # the receiver node
     370  # and bind the remaining properties to the
     371  # experiment property space
     372  node.prototype("test:proto:iperfudpsender", {
     373    'client' => '192.168.1.2',
     374    'use_udp' => nil,         #UDP client - nil argument means use UDP, For TCP, we dont use this option
     375    'time' => 60,             #Duration of traffic gen
     376    'sender_rate' => 1000000, #Sender rate = 1 Mbps
     377    'len' => 1024             #Payload length (bytes)
     378  })
     379  node.net.w0.ip = "%192.168.%x.%y"
     380  node.net.w0.mode = "master"
     381  node.net.w0.type = 'a'
     382  node.net.w0.essid = "helloworld"
     383}
     384###########################################
     385# Receiver definition and configuration
     386###########################################
     387defNodes('receiver', [1,2]) {|node|
     388  node.image = nil  # assume the right image to be on disk
     389  node.prototype("test:proto:iperfudpreceiver" , {
     390  'server' => nil,         # Server
     391  'use_udp' => nil,        # Use UDP nil means no argument required
     392  'len' => 1024,           # Payload length (bytes)
     393  'time' => 60,            # Duration = 60 seconds
     394  'report_interval' => 1   # Report interval = 1 sec
     395  })
     396  node.net.w0.ip = "%192.168.%x.%y"
     397  node.net.w0.mode = "managed"
     398  node.net.w0.type = 'a'
     399  node.net.w0.essid = "helloworld"     
     400}
     401###########################################
     402#  When nodeAgents have reported "OK" to
     403# the nodeHandler start the application
     404###########################################
     405whenAllInstalled {|node|
     406  NodeSet['receiver'].startApplications
     407  NodeSet['sender'].startApplications
     408
     409###########################################
     410# Run for 60 seconds
     411###########################################
     412wait 60
     413
     414###########################################
     415# Shutdown nodes
     416###########################################
     417 Experiment.done
     418}
     419
     420}}}