[wiki:WikiStart Orbit] > [wiki:Documentation/OtherApps Other Applications] > Iperf Scripts = Application Definition Schema = The application definition schema for the Iperf application is as follows {{{ iperf iperf WINLAB, Rutgers University http://www.winlab.rutgers.edu/ Traffic Generator Receive network traffic on the specified interface http://apps.orbit-lab.org/otr id of the flow Flow Throughput Flow jitter Flow Packet loss http://apps.orbit-lab.org/issues/winlab/iperf scm:cvs:pserver:anoncvs@cvs.orbit-lab.org:/trafficgenerator/iperf apt:repository.orbit-lab.org/orbit/binary:??? John Doe jdoe jdoe@winlab.rutgers.edu WINLAB, Rutgers University libmac >= 0.4 apt:repository.orbit-lab.org/debian/binary:libmac }}} = Application definition script for Iperf sender and Receiver = == Iperf Sender == {{{ # # 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 = < 1}, [ ['stream_no'], ['pkt_seqno'], ['pkt_size', Filter::SUM], ['gen_timestamp'], ['tx_timestamp'] ] ) if $0 == __FILE__ p.to_xml.write($stdout, 2) puts end }}} == Iperf UDP Receiver == {{{ # # Define a prototype # require 'handler/prototype' require 'handler/filter' require 'handler/appDefinition' p = Prototype.create("test:proto:iperfudpreceiver") p.name = "Iperf UDP Receiver" p.description = "Nodes which receive packets" p.defProperty('use_udp', 'Protocol to use') p.defProperty('server', 'Client/Server') p.defProperty('time', 'Duration of experiment (seconds)', 10) p.defProperty('len', 'Payload length', 512) p.defProperty('report_interval', 'Interval between bandwidth reports', 1) iperfr = p.addApplication('iperfr', "test:app:iperfr") iperfr.bindProperty('udp') iperfr.bindProperty('server') iperfr.bindProperty('time') iperfr.bindProperty('len') iperfr.bindProperty('interval','report_interval') iperfr.addMeasurement('receiverport', Filter::TIME, {Filter::SAMPLE_SIZE => 1}, [ ['flow_no'], ['throughput'], ['jitter'], ['packet_loss'] ] ) if $0 == __FILE__ p.to_xml.write($stdout, 2) puts end }}} == Iperf TCP Sender == {{{ # # Define a prototype # require 'handler/prototype' require 'handler/filter' require 'handler/appDefinition' p = Prototype.create("test:proto:iperftcpsender") p.name = "Iperf TCP Sender" p.description = "Nodes which send a stream of packets" p.defProperty('client', 'Host to send packets to') #p.defProperty('port', 'Port to send packets to') p.defProperty('len', 'Size of packets') p.defProperty('window', 'TCP window Size (bytes)', 64000) p.defProperty('time', 'Experiment duration (sec)', 10) iperfs = p.addApplication(:iperfs, "test:app:iperfs") iperfs.bindProperty('client') iperfs.bindProperty('len') iperfs.bindProperty('time') iperfs.bindProperty('window') iperfs.addMeasurement('senderport', Filter::TIME, {Filter::SAMPLE_SIZE => 1}, [ ['stream_no'], ['pkt_seqno'], ['pkt_size', Filter::SUM], ['gen_timestamp'], ['tx_timestamp'] ] ) # if $0 == __FILE__ p.to_xml.write($stdout, 2) puts end }}} == Iperf TCP Receiver == {{{ # # Define a prototype # require 'handler/prototype' require 'handler/filter' require 'handler/appDefinition' p = Prototype.create("test:proto:iperftcpreceiver") p.name = "Iperf TCP Receiver" p.description = "Nodes which receive packets" p.defProperty('server', 'Client/Server') p.defProperty('time', 'Duration of experiment (seconds)', 10) p.defProperty('window', 'Receiver Window Size', 64000) p.defProperty('report_interval', 'Interval beween reports', 1) iperfr = p.addApplication('iperfr', "test:app:iperfr") iperfr.bindProperty('server') iperfr.bindProperty('time') iperfr.bindProperty('window') iperfr.bindProperty('interval', 'report_interval') iperfr.addMeasurement('receiverport', Filter::TIME, {Filter::SAMPLE_SIZE => 1}, [ ['flow_no'], ['throughput'], ] ) if $0 == __FILE__ p.to_xml.write($stdout, 2) puts end }}} = Experiment script for Iperf = {{{ ############# Tutorial1 ################################## # This script defines the experiment # that has one sender and one receiver using Iperf # Sender, Receiver - 802.11a channel 36 # UDP flow at 1 Mbps # Receiver reports throughput, packet loss and jitter ############################################################ require 'net/http' require 'uri' Experiment.name = "tutorial-iperf" Experiment.project = "orbit:tutorial" ########################################### # Sender definition and configuration ########################################### defNodes('sender',[1,1]) {|node| node.image = nil # assume the right image to be on disk # use prototype "iperfudpsender" # and set it's property "destinationHost" to # the receiver node # and bind the remaining properties to the # experiment property space node.prototype("test:proto:iperfudpsender", { 'client' => '192.168.1.2', 'use_udp' => nil, #UDP client - nil argument means use UDP, For TCP, we dont use this option 'time' => 60, #Duration of traffic gen 'sender_rate' => 1000000, #Sender rate = 1 Mbps 'len' => 1024 #Payload length (bytes) }) node.net.w0.ip = "%192.168.%x.%y" node.net.w0.mode = "master" node.net.w0.type = 'a' node.net.w0.essid = "helloworld" } ########################################### # Receiver definition and configuration ########################################### defNodes('receiver', [1,2]) {|node| node.image = nil # assume the right image to be on disk node.prototype("test:proto:iperfudpreceiver" , { 'server' => nil, # Server 'use_udp' => nil, # Use UDP nil means no argument required 'len' => 1024, # Payload length (bytes) 'time' => 60, # Duration = 60 seconds 'report_interval' => 1 # Report interval = 1 sec }) node.net.w0.ip = "%192.168.%x.%y" node.net.w0.mode = "managed" node.net.w0.type = 'a' node.net.w0.essid = "helloworld" } ########################################### # When nodeAgents have reported "OK" to # the nodeHandler start the application ########################################### whenAllInstalled {|node| NodeSet['receiver'].startApplications NodeSet['sender'].startApplications ########################################### # Run for 60 seconds ########################################### wait 60 ########################################### # Shutdown nodes ########################################### Experiment.done } }}}