Changes between Initial Version and Version 1 of HowTo/UsingAODV/Scripts


Ignore:
Timestamp:
Nov 1, 2006, 10:15:39 PM (18 years ago)
Author:
anonymous
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • HowTo/UsingAODV/Scripts

    v1 v1  
     1{{{
     2##################################################
     3# AODV with OTG
     4# Every node has two prototypes: sender/receiver and AODV
     5# AODV rt table logs are reported every 4 secs on the nodes to
     6# /var/log/aodv.rtlog
     7# These will soon be OMLized to report to the database instead
     8##################################################
     9
     10Experiment.name = "tutorial-aodv"
     11Experiment.project = "orbit:tutorial"
     12
     13#
     14# Define nodes used in experiment
     15#
     16defNodes('sender', [1,2]) {|node|
     17  node.image = nil  # assume the right image to be on disk
     18
     19  node.prototype("test:proto:sender", {
     20    'destinationHost' => '192.168.1.1',
     21    'packetSize' => 1024,
     22    'rate' => 300,
     23    'protocol' => 'udp'
     24  })
     25  node.net.w0.mode = "master"
     26}
     27
     28defNodes('receiver', [1,1]) {|node|
     29  node.image = nil  # assume the right image to be on disk
     30  node.prototype("test:proto:receiver" , {
     31    'hostname' => '192.168.1.1',
     32    'protocol' => 'udp_libmac'
     33  })
     34  node.net.w0.mode = "managed"
     35}
     36
     37defNodes('everyone',[[1,1],[1,2]]) {|node|
     38  node.image = nil
     39  node.prototype("test:proto:aodvrouter", {
     40'interface' => 'ath0',   #Run aodvd on interface ath0
     41  'log' => nil,            #Enable logging
     42  'routelog' => 4          #Enable routing table logging every 4 secs
     43  })
     44}
     45
     46
     47allNodes.net.w0 { |w|
     48  w.type = 'b'
     49  w.essid = "helloworld"
     50  w.ip = "%192.168.%x.%y"
     51}
     52
     53#
     54# Now, start the application
     55#
     56whenAllInstalled() {|node|
     57 #First start AODV daemon on all nodes
     58  NodeSet['everyone'].startApplications
     59
     60  wait 10
     61
     62  #Then start receiver and sender
     63  NodeSet['receiver'].startApplications
     64  wait 30
     65  NodeSet['sender'].startApplications
     66
     67  wait 180
     68
     69  Experiment.done
     70}
     71
     72}}}
     73
     74
     75
     76== For Developers ==
     77The application definition and prototype definitions corresponding to AODV router are as follows
     78
     79== Application definition ==
     80{{{
     81#
     82# Create an application representation from scratch
     83#
     84require 'handler/appDefinition'
     85
     86a = AppDefinition.create('test:app:aodvd')
     87a.name = "aodvd"
     88a.version(0, 0, 1)
     89a.shortDescription = "AODV routing protocol"
     90a.description = <<TEXT
     91AODV launch
     92TEXT
     93
     94# addProperty(name, description, mnemonic, type, isDynamic = false, constraints
     95= nil)
     96a.addProperty('interface', 'Interface to run on', ?i, String, false)
     97a.addProperty('log', 'Enable logging', ?l, String, false)
     98a.addProperty('rttable', 'Log rting table every N secs', ?r, String, false)
     99a.path = "/usr/sbin/aodvd"
     100
     101if $0 == __FILE__
     102  require 'stringio'
     103  require 'rexml/document'
     104  include REXML
     105
     106  sio = StringIO.new()
     107  a.to_xml.write(sio, 2)
     108  sio.rewind
     109  puts sio.read
     110
     111  sio.rewind
     112  doc = Document.new(sio)
     113  t = AppDefinition.from_xml(doc.root)
     114
     115  puts
     116  puts "-------------------------"
     117  puts
     118  t.to_xml.write($stdout, 2)
     119
     120end
     121
     122}}}
     123 
     124=== Prototype definition ===
     125{{{
     126#
     127# Define a prototype
     128#
     129
     130require 'handler/prototype'
     131require 'handler/filter'
     132require 'handler/appDefinition'
     133
     134p = Prototype.create("test:proto:aodvrouter")
     135p.name = "AODV daemon"
     136p.description = "Nodes which receive packets"
     137p.defProperty('interface', 'Interface to listen on')
     138p.defProperty('log', 'Enable logging')
     139p.defProperty('routelog', 'Enable logging')
     140
     141aodvd = p.addApplication('aodvd', "test:app:aodvd")
     142aodvd.bindProperty('interface')
     143aodvd.bindProperty('log')
     144aodvd.bindProperty('rttable','routelog')
     145
     146
     147if $0 == __FILE__
     148  p.to_xml.write($stdout, 2)
     149  puts
     150end
     151
     152
     153}}}