###Benchmark tests ##################################
# The purpose of this experiment is to benchmark the node CPU
# capabilities in terms of the maximum offered load that it can
# generate and consume on the wireless 802.11a link in ad-hoc mode

# It has one sender and one receiver
# Sender, Receiver - Wireless interface
# UDP flow at 50Mbps
# 802.11a Channel 64 with autorate and MAC retries on
	# Receiver reports throughput, jitter and packet loss per second
	# Iperf traffic generator
	############################################################
	
	Experiment.name = "iperf-udp"
	Experiment.project = "orbit:tutorial"
	
	#
	# Define nodes used in experiment
	#
	###########################################
	# Sender definition and configuration
	###########################################
	defNodes('sender', [4,1]) {|node|
	  node.image = nil  # assume the right image to be on disk
	  # use prototype "sender"
	  # and set it's property "destinationHost" to
	  # the receiver node
	  # and bind the remaining properties to the
	  # experiment property space
	  node.prototype("test:proto:iperfudpsender", {
	    'client' => '192.168.4.3',  #Send to
	    'use_udp' => nil,           #UDP client
	    'sender_rate' => '50M',      #Input offered load (bits per sec)
	    'len' => 1400               #Payload length (bytes)
	  })
	  node.net.w0.ip = '%192.168.%x.%y'
	  node.net.w0.mode = 'ad-hoc'
	  node.net.w0.essid = 'thrutest'
	  node.net.w0.type = 'a'
	  node.net.w0.channel = 64
	
	}
	###########################################
	# Receiver definition and configuration
	###########################################
	
	defNodes('receiver', [4,3]) {|node|
	  node.image = nil  # assume the right image to be on disk
	  node.prototype("test:proto:iperfudpreceiver" , {
	  'server' => nil,         # Server
	  'use_udp' => nil,        # Use UDP
	  'len' => 1400,           #Payload length (bytes)
	  'report_interval' => 10   #Report interval(seconds)
	  })
	  node.net.w0.ip = '%192.168.%x.%y'
	  node.net.w0.mode = 'ad-hoc'
	  node.net.w0.essid = 'thrutest'
	  node.net.w0.type = 'a'
	  node.net.w0.channel = 64
	
	}
	
	###########################################
	# When nodeAgents have reported "OK" to
	# the nodeHandler start the application
	###########################################
	whenAllInstalled() {|node|
	
	  nodes('receiver').startApplications
	
	  wait 10
	  nodes('sender').startApplications
	  wait 60
	 
	  allNodes.stopApplications 
	
	
	  Experiment.done
	
	}
