Changes between Initial Version and Version 1 of Old/Documentation/OTG/ScriptsRepository/ProtoDefSender


Ignore:
Timestamp:
Sep 26, 2005, 6:39:01 PM (19 years ago)
Author:
zhibinwu
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Old/Documentation/OTG/ScriptsRepository/ProtoDefSender

    v1 v1  
     1{{{
     2#
     3# Define a prototype containing a single
     4# traffic generator (otg).
     5#
     6
     7require 'handler/prototype'
     8require 'handler/filter'
     9require 'handler/appDefinition'
     10
     11p = Prototype.create("test:proto:sender")
     12p.name = "Sender"
     13p.description = "A node which transmit a stream of packets"
     14# List properties of prototype
     15p.defProperty('protocol', 'Protocol to use', 'udp')
     16p.defProperty('generator', 'Generator to use', 'cbr')
     17p.defProperty('destinationHost', 'Host to send packets to')
     18p.defProperty('packetSize', 'Size of packets', 1000)
     19p.defProperty('rate', 'Number of bits per second', 1000)
     20p.defProperty('broadcast','broadcast or not', 'off')
     21
     22# Define applications to be installed on this type of node,
     23# bind the application properties to the prototype properties,
     24# and finally, define what measurements should be collected
     25# for each application.
     26#
     27otg = p.addApplication(:otg, "test:app:otg")
     28otg.bindProperty('protocol')
     29ptg.bindProperty('generator')
     30otg.bindProperty('dsthostname', 'destinationHost')
     31otg.bindProperty('size', 'packetSize')
     32otg.bindProperty('rate')
     33otg.bindProperty('broadcast')
     34
     35otg.addMeasurement('senderport',  Filter::TIME,
     36  {Filter::SAMPLE_SIZE => 1},
     37  [ 
     38    ['pkt_seqno'],
     39    ['pkt_size', Filter::SUM],
     40    ['gen_timestamp'],
     41    ['tx_timestamp']
     42  ]
     43)
     44
     45if $0 == __FILE__
     46  p.to_xml.write($stdout, 2)
     47  puts
     48end
     49
     50
     51
     52
     53}}}