wiki:Old/Documentation/OTG/ScriptsRepository/ProtoDefForwarder

Version 3 (modified by root, 18 years ago) ( diff )

Name changed from OTG/ScriptsRepository/ProtoDefForwarder to Documentation/OTG/ScriptsRepository/ProtoDefForwarder

Orbit > OTG > Scripts Repository > forwarder.rb

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

p = Prototype.create("test:proto:forwarder")
p.name = "Forwarder"
p.description = "Nodes which forward packets"
p.defProperty('protocol', 'Protocol to use', 'raw')
p.defProperty('rxdev', 'hw interface to listen on', 'eth0')
p.defProperty('txdev', 'hw interaface to send', 'eth0')
p.defProperty('ipFilter', 'IP address of the destination', '12.0.0.6')
p.defProperty('nextHopMAC', 'HW (MAC) address of next-hop receiver', 'FF:FF:FF:FF:FF:FF')

otf = p.addApplication('otf', "test:app:otf")

otf.bindProperty('protocol')
otf.bindProperty('rxdev')
otf.bindProperty('txdev')
otf.bindProperty('dstfilter','ipFilter')
otf.bindProperty('dstmacaddr','nextHopMAC')

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

otf.addMeasurement('otfreceiver',  Filter::TIME,
  {Filter::SAMPLE_SIZE => 1},
  [
    'flow_no'],
    ['pkt_num_rcvd'],
    ['rcvd_pkt_size', Filter::SUM],
    ['rx_timestamp'], 
    ['rssi', Filter::MEAN],
    ['xmitrate', Filter::MEAN]
  ]
)

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

Note: See TracWiki for help on using the wiki.