Changes between Version 1 and Version 2 of Old/Documentation/OTG/ScriptsRepository/ProtoDefRawSender


Ignore:
Timestamp:
Oct 5, 2005, 4:20:51 PM (19 years ago)
Author:
zhibinwu
Comment:

Legend:

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

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