wiki:Old/Documentation/OTG/ScriptsRepository/ProtoDefColocateSender

Orbit > OTG > Scripts Repository > colocate_sender.rb

3 Co-located UDP sessions in One sender

#
# Define a prototype containing three
# traffic generators colocated in one node.
#

require 'handler/prototype'
require 'handler/filter'
require 'handler/appDefinition'

p = Prototype.create("test:proto:colocate_sender")
p.name = "Colocate Sender"
p.description = "A node which transmit several streams of packets"
# List properties of prototype
p.defProperty('protocol', 'Protocol to use', 'udp')
p.defProperty('port1', 'port to bind by sender', 3001)
p.defProperty('port2', 'port to bind by sender', 3002)
p.defProperty('port3', 'port to bind by sender', 3003)
p.defProperty('generator', 'Generator to use', 'cbr')
p.defProperty('destinationHost', 'Host to send packets to')
p.defProperty('packetSize', 'Size of packets', 1000)
p.defProperty('rate', 'Number of bits per second', 1000)
p.defProperty('broadcast','broadcast or not', 'off')

# Define applications to be installed on this type of node,
# bind the application properties to the prototype properties,
# and finally, define what measurements should be collected
# for each application.
#
otg1 = p.addApplication(:otg1, "test:app:otg")
otg1.bindProperty('protocol')
otg1.bindProperty('port','port1')
otg1.bindProperty('generator')
otg1.bindProperty('dsthostname', 'destinationHost')
otg1.bindProperty('size', 'packetSize')
otg1.bindProperty('rate')
otg1.bindProperty('broadcast')

otg1.addMeasurement('senderport',  Filter::TIME, 
  {Filter::SAMPLE_SIZE => 1},
  [  
    ['pkt_seqno'],
    ['pkt_size', Filter::SUM],
    ['gen_timestamp'],
    ['tx_timestamp']
  ]
)

otg2 = p.addApplication(:otg2, "test:app:otg")
otg2.bindProperty('protocol')
otg2.bindProperty('port','port2')
otg2.bindProperty('generator')
otg2.bindProperty('dsthostname', 'destinationHost')
otg2.bindProperty('size', 'packetSize')
otg2.bindProperty('rate')
otg2.bindProperty('broadcast')

otg2.addMeasurement('senderport',  Filter::TIME, 
  {Filter::SAMPLE_SIZE => 1},
  [  
    ['pkt_seqno'],
    ['pkt_size', Filter::SUM],
    ['gen_timestamp'],
    ['tx_timestamp']
  ]
)
otg3 = p.addApplication(:otg3, "test:app:otg")
otg3.bindProperty('protocol')
otg3.bindProperty('port','port3')
otg3.bindProperty('generator')
otg3.bindProperty('dsthostname', 'destinationHost')
otg3.bindProperty('size', 'packetSize')
otg3.bindProperty('rate')
otg3.bindProperty('broadcast')

otg3.addMeasurement('senderport',  Filter::TIME, 
  {Filter::SAMPLE_SIZE => 1},
  [  
    ['pkt_seqno'],
    ['pkt_size', Filter::SUM],
    ['gen_timestamp'],
    ['tx_timestamp']
  ]
)


if $0 == __FILE__
  p.



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



Last modified 15 years ago Last modified on Apr 4, 2006, 9:14:30 PM
Note: See TracWiki for help on using the wiki.