wiki:Old/OtherApps/ScriptsITGRepository

Orbit > Other Applications > ITG Scripts

Application Definition Schema

The application definition schema for the ITG application is as follows

<?xml version="1.0" encoding="UTF-8"?>
<orbit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="H:\Orbit\Oml\docs\definitions\application\app_def.xsd">
	<application id="orbit_winlab_itg">
		<name>ITG</name>
		<id>ITG</id>
		<version major="0" minor="1" revision="0"/>
		<organization>
			<name>WINLAB, Rutgers University</name>
			<url>http://www.winlab.rutgers.edu/</url>
		</organization>
		<shortDescription>Receive network traffic</shortDescription>
		<description>
Receive network traffic on the specified interface
       </description>
		<url>http://apps.orbit-lab.org/itg</url>
		<properties>
			<property>
				<name>network_interface</name>
				<mnemonic>i</mnemonic>
				<type>xsd:string</type>
				<dynamic>no</dynamic>
				<description>Device name for sending network traffic</description>
			</property>
			<property>
				<name>pipe name</name>
				<mnemonic>p</mnemonic>
				<type>xsd:string</type>
				<dynamic>no</dynamic>
				<description>iinterface for changing generator properties</description>
			</property>
		</properties>
		<measurement-points>
			<measurement-point id="decoderport">
				<metric id="flow_no" type="int">
					<description>id of the stream</description>
				</metric>
				<metric id="src_port" type="int">
					<description>source port</description>
				</metric>
				<metric id="dst_port" type="int">
					<description>Destination port</description>
				</metric>
				<metric id="throughput" type="float">
					<description>Flow Throughput</description>
				</metric>
                                <metric id="jitter" type ="float">
                                     <description>Flow jitter</description> 
				</metric>
                                <metric id="delay" type="float">
					<description>flow delay</description>
				</metric>
				<metric id="pkt_loss" type="float">
					<description>Pkt loss for flow</description>
				</metric>   
			</measurement-point>
		</measurement-points>
		<issueTrackingUrl>
          http://apps.orbit-lab.org/issues/winlab/renny
       </issueTrackingUrl>
		<repository>
			<development>scm:cvs:pserver:anoncvs@cvs.orbit-lab.org:/trafficgenerator/renny</development>
			<binary>apt:repository.orbit-lab.org/orbit/binary:???</binary>
		</repository>
		<mailingLists/>
		<developers>
			<developer>
				<name>John Doe</name>
				<id>jdoe</id>
				<email>jdoe@winlab.rutgers.edu</email>
				<organization>
					<name>WINLAB, Rutgers University</name>
				</organization>
			</developer>
		</developers>
		<dependencies>
			<dependency>
				<id>libmac</id>
				<version>&gt;= 0.4</version>
				<url>apt:repository.orbit-lab.org/debian/binary:libmac</url>
			</dependency>
		</dependencies>
	</application>
</orbit>


Application definition script for Iperf sender and Receiver

ITG Sender

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

a = AppDefinition.create('test:app:itgs')
a.name = "itgs"
a.version(0, 0, 1)
a.shortDescription = "D-ITG Sender"
a.description = <<TEXT
ITGSend 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)

#Flow options
a.addProperty('m', 'Measurement type: either onewaydelay or RTT', ?m, String, false)
a.addProperty('a', 'Destination address', ?a, String, false)
a.addProperty('r', 'Remote port', ?r, Integer, false)
a.addProperty('T', 'Protocol type TCP or UDP', ?T, Integer, false)
a.addProperty('f', 'TTL',?f, Integer, false)
a.addProperty('d', 'Gen_Delay',?d, Integer, false)
a.addProperty('t', "Duration of traffic generation(millisecs)", ?t, Integer, false)

#Interdeparture time options
a.addProperty('C', 'Constant interdeparture time b/w packets (pkts_per_s)', ?C, Integer, false)
a.addProperty('E', '(Exponential) Average packets per sec', ?E, Integer, false)
a.addProperty('O', '(Poisson) Average pkts per sec', ?O, Integer, false)

#Note that Pareto, Cauchy, UNiform, Normal and Gamma distributions will # be added

#Log file options
a.addProperty('l', 'Log file', ?l, String, false)

#Packet size options
a.addProperty('c', 'Constant payload size', ?c, Integer, false)
a.addProperty('e', "Average pkt size (exponential)", ?e, Integer, false)
a.addProperty('o', "Poisson distributed avg. pkt size", ?o, Integer, false)

#Note that Pareto, Cauchy, UNiform, Normal and Gamma distributions will # be added

# Applications (note that no other interdeparture or packet size can be #chosen if an application is chosen
a.addProperty('App', 'VoIP traffic', ?Z, Integer, false)
a.addProperty('codec', 'VoIP codec: G.711.1, G.711.2, G.723.1, G.729.2, G.729.3', ?i, Integer, false)
a.addProperty('voip_control', 'protocol_type RTP or CRTP',?h, String, false)

a.addProperty('Telnet', 'Telnet traffic', nil, Integer, false)
a.addProperty('DNS', 'DNS traffic', nil, Integer, false)

a.path = "/usr/local/bin/ITGSend"

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


ITG Receiver

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

a = AppDefinition.create('test:app:itgr')
a.name = "itgr"
a.version(0, 0, 1)
a.shortDescription = "D-ITG Receiver"
a.description = <<TEXT
D-ITG 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)
#Flow options
a.addProperty('l', 'Log file', ?l, String, false)

a.path = "/usr/local/bin/ITGRecv"

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

ITG Decoder

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

a = AppDefinition.create('test:app:itgdec')
a.name = "itgdec"
a.version(0, 0, 1)
a.shortDescription = "D-ITG Decoder"
a.description = <<TEXT
This program decodes the output of the experiment
TEXT

# addProperty(name, description, mnemonic, type, isDynamic = false, constraints = nil)
a.addProperty('logfile', 'Log file', ?x , String, false)
a.addProperty('d', 'Delay interval size (msec)', ?d, Integer, false)
a.addProperty('j', 'Jitter Interval size (msec)', ?j, Integer, false)
a.addProperty('b', 'Bitrate interval size (msec)', ?b, Integer, false)
a.addProperty('p', 'Packet loss interval size(msec)', ?p, Integer, false)

a.addMeasurement("decoderport", nil, [
    ['flow_no', 'int'],
    ['src_port', 'int'],
    ['dst_port', 'int'],
    ['throughput', Float],
    ['jitter', Float],
    ['delay', Float],
    ['pkt_loss', Float]
 ])

a.path = "/usr/local/bin/ITGDec"

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

Sample prototype definitions script for ITG UDP CBR(sender and Receiver)

ITG CBR UDP Sender

#
# Define a prototype
#
require 'prototype'
require 'filter'
require 'appDefinition'

p = Prototype.create("test:proto:itgcbrsender")
p.name = "ITG Sender"
p.description = "Nodes which send a stream of packets"
p.defProperty('meter', 'one way delay or RTT', 'owdm')
p.defProperty('protocol', 'Protocol to use', 'udp')
p.defProperty('destinationHost', 'Host to send packets to')
p.defProperty('constsize', 'Size of packets', 1000)
p.defProperty('constrate', 'Number of bits per second', 1000)
p.defProperty('duration', 'Time for sending (millisec)', 1000)
p.defProperty('gen_delay', 'Generation delay (millisec)', 10000)
p.defProperty('recv_port', 'Receiver_port', 8000)

itgs = p.addApplication(:itgs, "test:app:itgs")
itgs.bindProperty('m','meter')
itgs.bindProperty('T','protocol')
itgs.bindProperty('a', 'destinationHost')
itgs.bindProperty('c', 'constsize')
itgs.bindProperty('C', 'constrate')
itgs.bindProperty('t', 'duration')
itgs.bindProperty('d', 'gen_delay')
itgs.bindProperty('r', 'recv_port')

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


ITG CBR UDP Receiver

#
# Define a prototype
#

require 'prototype'
require 'filter'
require 'appDefinition'

p = Prototype.create("test:proto:itgreceiver")
p.name = "ITG Receiver"
p.description = "Nodes which receive packets"
p.defProperty('logfile', 'Logfile')

itgr = p.addApplication('itgr', "test:app:itgr")
itgr.bindProperty('l','logfile')

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



ITG CBR UDP Decoder

#
# Define a prototype
#

require 'prototype'
require 'filter'
require 'appDefinition'

p = Prototype.create("test:proto:itgdecoder")
p.name = "ITG Decoder"
p.description = "Decodes output and prints results"
p.defProperty('logfile', 'Logfile')
p.defProperty('tput_report_interval', 'Report interval for throughput')
p.defProperty('delay_report_interval', 'Report interval for Delay')
p.defProperty('jitter_report_interval', 'Report interval for Jitter')
p.defProperty('loss_report_interval', 'Report interval for Packet loss')

itgd = p.addApplication('itgdec', "test:app:itgdec")
itgd.bindProperty('logfile')
itgd.bindProperty('d', 'delay_report_interval')
itgd.bindProperty('j', 'jitter_report_interval')
itgd.bindProperty('b', 'tput_report_interval')
itgd.bindProperty('p', 'loss_report_interval')

itgd.addMeasurement('decoderport',  Filter::SAMPLE, 
  {Filter::SAMPLE_SIZE => 1},
  [
    ['flow_no'],
    ['src_port'],
    ['dst_port'],
    ['throughput'],
    ['jitter'],
    ['delay'],
    ['pkt_loss']
  ]
)

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

Experiment script for Iperf

UDP CBR Experiment

############# Tutorial1 ##################################
# This script defines the experiment
# that has two senders and one receiver using Iperf
# 802.11b 
# UDP flow of 500 packet/sec of 1024 byte payload
# Decoder reports throughput, delay, packet loss and jitter ############################################################

Experiment.name = "tutorial-itg"
Experiment.project = "orbit:tutorial"

###########################################
# Receiver definition and configuration
##########################################

defNodes('receiver',[3,1]) {|node|
  node.image = nil  # assume the right image to be on disk
  node.prototype("test:proto:itgreceiver", { 
    'logfile' => "/tmp/results.txt"
    }
)
  node.net.w0.ip = "%192.168.%x.%y"
  node.net.w0.mode = "master"
  node.net.w0.type = 'b'
  node.net.w0.essid = "helloworld"	
}
###########################################
# Decoder definition and configuration
##########################################

defNodes('decoder',[3,1]) {|node|
  node.image = nil  # assume the right image to be on disk
  node.prototype("test:proto:itgdecoder", { 
    'logfile' => "/tmp/results.txt",
    'tput_report_interval' => 1000,
    'delay_report_interval' => 1000,
    'loss_report_interval' => 1000,
    'jitter_report_interval' => 1000
    }
)
}
###########################################
# Sender definition and configuration
###########################################
defNodes('sender',[1,2]) {|node|
  node.image = nil  # assume the right image to be on disk
  node.prototype("test:proto:itgcbrsender", {
    'destinationHost' => '192.168.3.1',
    'meter' => 'owdm',          #One way delay
    'protocol' => 'udp',        #UDP client
    'constsize' => 1024,        #Const payload size (bytes)
    'constrate' => 500,         #packets per second
    'duration' => 60000,        #Expt duration (msec)
    'recv_port' => 8000         #Receiver port
  })
  node.net.w0.ip = "%192.168.%x.%y"
  node.net.w0.mode = "managed"
  node.net.w0.type = 'b'
  node.net.w0.essid = "helloworld"
}
###########################################
# Sender definition and configuration
###########################################
defNodes('sender',[2,2]) {|node|
  node.image = nil  # assume the right image to be on disk
  # use prototype "sender" 
  # and set it's property "destinationHost" to 
  # the receiver node
  # and bind the remaining properties to the 
  # experiment property space
  node.prototype("test:proto:itgcbrsender", {
    'destinationHost' => '192.168.3.1',
    'meter' => 'owdm',          #One way delay
    'protocol' => 'udp',        #UDP client
    'constsize' => 1024,        #Const payload size (bytes)
    'constrate' => 500,         #packets per second
    'duration' => 60000,        #Expt duration (msec)
    'recv_port' => 8001         #Receiver port
  })
  node.net.w0.ip = "%192.168.%x.%y"
  node.net.w0.mode = "managed"
  node.net.w0.type = 'b'
  node.net.w0.essid = "helloworld"
}

###########################################
#  When nodeAgents have reported "OK" to 
# the nodeHandler start the application
###########################################
whenAllInstalled {|node|
  NodeSet['receiver'].startApplications
  ###Need to separate receiver and sender start
  wait  15 
  ###
  NodeSet['sender'].startApplications
  NodeSet['sender1'].startApplications

  wait 60

###############################################
Launch the decoder application to report results
################################################
  NodeSet['decoder'].startApplications
 


###########################################
# Shutdown nodes
###########################################
 Experiment.done

}

VoIP Experiment

############# Tutorial2 ##################################
# This script defines the experiment
# that has one sender and one receiver and VoIP session
# Sender, Receiver - 802.11a channel 36
# Receiver reports throughput, packet loss, avg. delay and jitter
############################################################


Experiment.name = "tutorial-itg"
Experiment.project = "orbit:tutorial"

#
# Define nodes used in experiment
###########################################
# Receiver definition and configuration
##########################################

defNodes('receiver',[3,1]) {|node|
  node.image = nil  # assume the right image to be on disk
  node.prototype("test:proto:itgreceiver", { 
    'logfile' => "/tmp/results.txt"
    }
)
  node.net.w0.ip = "%192.168.%x.%y"
  node.net.w0.mode = "master"
  node.net.w0.type = 'a'
  node.net.w0.essid = "helloworld"	
}
###########################################
# Decoder definition and configuration
##########################################

defNodes('decoder',[3,1]) {|node|
  node.image = nil  # assume the right image to be on disk
  node.prototype("test:proto:itgdecoder", { 
    'logfile' => "/tmp/results.txt",
    'tput_report_interval' => 1000,
    'delay_report_interval' => 1000,
    'loss_report_interval' => 1000,
    'jitter_report_interval' => 1000
    }
)}
###########################################
# Sender definition and configuration
###########################################
defNodes('sender',[2,2]) {|node|
  node.image = nil  # assume the right image to be on disk
  node.prototype("test:proto:itgvoipsender", {
    'destinationHost' => '192.168.3.1',
    'meter' => 'owdm',          #One way delay
    'duration' => 20000,        #Run for 20 seconds
    'recv_port' => 8000,        #Recv port
    'App' => 'VoIP',            #Use VoIP
    'codec' => 'G.711.1',       #Codec type
    'voip_control' => 'RTP'     #VoIP control
  })
  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
  ###Need to separate receiver and sender start
  wait 15 
  ###
  NodeSet['sender'].startApplications
 


  wait 60

###############################################
Launch the decoder application to report results
################################################

  NodeSet['decoder'].startApplications
 

###########################################
# Shutdown nodes
###########################################
 Experiment.done

}


Last modified 18 years ago Last modified on Aug 8, 2006, 3:28:22 PM
Note: See TracWiki for help on using the wiki.