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


Ignore:
Timestamp:
May 15, 2006, 12:53:37 AM (18 years ago)
Author:
zhibinwu
Comment:

Legend:

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

    v1 v1  
     1
     2
     3{{{
     4#
     5# Define a prototype containing a single
     6# traffic generator (otg).
     7#
     8
     9require 'handler/prototype'
     10require 'handler/filter'
     11require 'handler/appDefinition'
     12
     13p = Prototype.create("test:proto:tcpsender")
     14p.name = "Sender"
     15p.description = "A node which transmit a stream of packets"
     16# List properties of prototype
     17p.defProperty('protocol', 'Protocol to use', 'udp')
     18p.defProperty('port', 'port to bind by sender', 3000)
     19p.defProperty('generator', 'Generator to use', 'cbr')
     20p.defProperty('destinationHost', 'Host to send packets to')
     21p.defProperty('packetSize', 'Size of packets', 1000)
     22p.defProperty('rate', 'Number of bits per second', 1000)
     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('port')
     32otg.bindProperty('generator')
     33otg.bindProperty('dsthostname', 'destinationHost')
     34otg.bindProperty('size', 'packetSize')
     35otg.bindProperty('rate')
     36
     37otg.addMeasurement('senderport',  Filter::TIME,
     38  {Filter::SAMPLE_SIZE => 1},
     39  [ 
     40    ['pkt_seqno'],
     41    ['pkt_size', Filter::SUM],
     42    ['gen_timestamp'],
     43    ['tx_timestamp']
     44  ]
     45)
     46
     47if $0 == __FILE__
     48  p.to_xml.write($stdout, 2)
     49  puts
     50end
     51
     52
     53
     54
     55}}}