wiki:Old/Documentation/OTG/ScriptsRepository/ExpFWD

Version 4 (modified by zhibinwu, 19 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('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.ip = "11.0.0.4"
  node.net.w0.gateway="11.0.0.1"
}


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"
}

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"   
}

allNodes.net.w0 { |w|
  w.essid = "helloworld"
}

#
# Now, start the application
#
whenAllInstalled() {|node|
  wait 30

  allNodes.startApplications
  wait 40

  Experiment.done
}

Note: See TracWiki for help on using the wiki.