wiki:Old/Documentation/OTG/ScriptsRepository/ExpFWD

Version 6 (modified by zhibinwu, 18 years ago) ( diff )

Orbit > OTG > Scripts Repository > Forwarding Example

 

require 'net/http'
require 'uri'

Experiment.name = "hop-2"
Experiment.project = "orbit:mutli-hop"

#Experiment.defProperty('rate', 10, 'Kilo Bits per second sent from sender')
#Experiment.defProperty('packetSize', 512, 'Size of packets sent from sender')
#Experiment.defProperty('destinationIP','12.0.0.7','The sink of the flow')

#
# Define nodes used in experiment
#

defNodes('receiver', [7,6]) {|node|
  node.image = nil  # assume the right image to be on disk
  node.prototype("test:proto:raw_receiver" , {
      'dstfilter' => '12.0.0.7',
      'rxdev' => 'ath0',
      'protocol' => 'raw'
  })
  node.net.w0.mode = "master"
  node.net.w0.essid = "helloworld"
  node.net.w0.type = 'a'
  node.net.w0.channel = 36
  node.net.w0.ip = '12.0.0.7'
}


defNodes('sender', [4,3]) {|node|
  node.image = nil  # assume the right image to be on disk

  node.prototype("test:proto:sender", {
    'destinationHost' => '12.0.0.7',
    'packetSize' => 1024,
    'rate' => 300,
    'protocol' => 'udp'
  })
  node.net.w0.mode = "managed"
  node.net.w0.essid = "helloworld"
  node.net.w0.ip = "11.0.0.4"
#  node.net.w0.gateway = "11.0.0.1"  
}


defNodes('forwarder', [5,8]) {|node|
  node.image = nil  # assume the right image to be on disk
   node.prototype("test:proto:forwarder", {
   'protocol' => 'raw',
   'rxdev' =>'ath0',
   'txdev' =>'ath0',
   'ipFilter' =>  "12.0.0.7",
   'nextHopMAC' =>'00:0E:35:85:0F:59'
  })
   node.net.w0.ip="11.0.0.1"
   node.net.w0.mode = "managed"   
   node.net.w0.essid = "helloworld"
}
 
#
# Now, start the application
#
whenAllInstalled() {|node|
puts "run something..."
  wait 30
 allNodes.startApplications
  wait 30

  Experiment.done
}


Note: See TracWiki for help on using the wiki.