wiki:Old/Athstats/ScriptsRepository/ExpUDP1

Version 1 (modified by kishore, 19 years ago) ( diff )

Orbit > Athstats > Scripts Repository > UDP/TCP Unicast

require 'net/http'
require 'uri'

Experiment.name = "tutorial-1a"
Experiment.project = "orbit:tutorial"

defProperty('rate', 300, 'Bits per second sent from sender')
defProperty('packetSize', 256, 'Size of packets sent from sender')
defProperty('startExp', 0, 'Start experiment flag - set to true only when all nodes have associated')

defNodes('receiver', [1,2]) {|node|
   node.image = nil  # assume the right image to be on disk
   node.prototype("test:proto:receiver" , {
        'hostname' => '192.168.1.2',
        'protocol' => 'udp'
   })
   node.net.w0.type = 'a'
   node.net.w0.essid = "neo"
   node.net.w0.mode = "master"
   node.net.w0.ip = "%192.168.%x.%y"
}

defNodes('sender', [1,1]) {|node|
   node.image = nil  # assume the right image to be on disk
   node.prototype("test:proto:sender", {
        'destinationHost' => '192.168.1.2',
        'packetSize' => Experiment.property("packetSize"),
        'rate' => Experiment.property("rate"),
        'protocol' => 'udp',
   })
   node.net.w0.type = 'a'
   node.net.w0.essid = "neo"
   node.net.w0.mode = "managed"
   node.net.w0.ip = "%192.168.%x.%y"
}

defNodes('allnodes', [[1,1],[1,2]]) {|node|
   node.image = nil  # assume the right image to be on disk
   node.prototype("test:proto:driverqueryapp", {
        'interface' => 'ath0',
        'interval' => '1000',
   })
}

whenAllInstalled() {|node|
  Experiment.props.packetSize = 1350
  Experiment.props.rate = 35000
  Experiment.props.startExp = 0

  puts "Starting applications"

  nodes('allnodes').startApplications
  nodes('receiver').startApplications
  nodes('sender').startApplications

  wait 60

  puts "Stopping applications"

  nodes('sender').stopApplications
  nodes('receiver').stopApplications
  nodes('allnodes').stopApplications

  wait 10
  Experiment.done
}

Note: See TracWiki for help on using the wiki.