Changes between Version 1 and Version 2 of Old/Documentation/OTG/ScriptsRepository/ExpFWD


Ignore:
Timestamp:
Feb 2, 2006, 5:12:23 PM (19 years ago)
Author:
zhibinwu
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Old/Documentation/OTG/ScriptsRepository/ExpFWD

    v1 v2  
    11[wiki:WikiStart Orbit] > [wiki:OTG OTG] > [wiki:OTG/ScriptsRepository Scripts Repository] > Forwarding Example
     2
     3{{{
     4require 'net/http'
     5require 'uri'
     6
     7Experiment.name = "hop-4"
     8Experiment.project = "orbit:mutli-hop"
     9
     10Experiment.defProperty('rate', 10, 'Kilo Bits per second sent from sender')
     11Experiment.defProperty('packetSize', 512, 'Size of packets sent from sender')
     12Experiment.defProperty('destinationIP','12.0.0.7','The sink of the flow')
     13
     14#
     15# Define nodes used in experiment
     16#
     17nodes([3,3], 'sender') {|node|
     18  node.image = nil  # assume the right image to be on disk
     19  # experiment property space
     20  node.prototype("test:proto:sender", {
     21    'destinationHost' => "12.0.0.7",
     22  })
     23  node.net.e0.ip = "11.0.0.4"
     24  node.net.e0.gateway="11.0.0.1"
     25}
     26
     27nodes([8,8], 'receiver') {|node|
     28  node.image = nil
     29  node.prototype("test:proto:receiver" , {
     30   'hostname' => '12.0.0.7',
     31    'protocol' => 'udp_libmac'
     32  })
     33    node.net.w0.mode = "ad-hoc"
     34    node.net.w0.type = 'a'
     35  #  node.net.w0.essid = "mhop"
     36    node.net.w0.ip = "12.0.0.7"
     37    node.net.w0.gateway="12.0.0.1"
     38}
     39
     40
     41nodes([4,4], 'forwarder1') {|node|
     42  node.image = nil  # assume the right image to be on disk
     43   node.prototype("test:proto:forwarder", {
     44   'protocol' => 'raw',
     45   'rxdev' =>'eth0',
     46   'txdev' =>'eth2',
     47   'ipFilter' =>  "12.0.0.7",
     48   'nextHopMAC' =>'00:0E:35:85:0F:59'
     49  })
     50  node.net.e0.ip="11.0.0.1"
     51   node.net.w0.mode = "ad-hoc"
     52   node.net.w0.type = 'a'
     53 #  node.net.w0.essid = "mhop"
     54   node.net.w0.ip = "11.0.0.2"
     55}
     56
     57nodes([5,5], 'forwarder2') {|node|
     58  node.image = nil  # assume the right image to be on disk
     59  node.prototype("test:proto:forwarder", {
     60   'protocol' => 'raw',
     61   'rxdev' =>'eth2',
     62   'txdev' =>'eth2',
     63   'ipFilter' => '12.0.0.7',
     64   'nextHopMAC' =>'00:0E:35:9E:4D:82'
     65   })
     66   node.net.w0.mode = "ad-hoc"
     67   node.net.w0.type = 'a'
     68#   node.net.w0.essid = "mhop"
     69   node.net.w0.ip = "14.0.0.1"
     70   }
     71nodes([6,6], 'forwarder3') {|node|
     72node.image = nil  # assume the right image to be on disk
     73node.prototype("test:proto:forwarder", {
     74    'protocol' => 'raw',
     75    'rxdev' =>'eth2',
     76    'txdev' =>'eth2',
     77    'ipFilter' => '12.0.0.7',
     78    'nextHopMAC' =>'00:0E:35:9E:55:7F'
     79    })
     80    node.net.w0.mode = "ad-hoc"
     81    node.net.w0.type = 'a'
     82    # node.net.w0.essid = "mhop"
     83     node.net.w0.ip = "15.0.0.1"
     84  }
     85
     86nodes([7,7], 'forwarder4') {|node|
     87node.image = nil  # assume the right image to be on disk
     88node.prototype("test:proto:forwarder", {
     89    'protocol' => 'raw',
     90    'rxdev' =>'eth2',
     91    'txdev' =>'eth2',
     92    'ipFilter' => '12.0.0.7',
     93    'nextHopMAC' => '00:0E:35:9E:4D:B8'
     94    })
     95    node.net.w0.mode = "ad-hoc"
     96    node.net.w0.type = 'a'
     97    # node.net.w0.essid = "mhop"
     98    node.net.w0.ip = "12.0.0.1"
     99    }
     100whenAll("/*/*", "procs/proc/status[text()='INSTALLED.OK']") {|node|
     101#
     102# Start the OML Collection Server
     103#
     104filename = "http://console.grid.orbit-lab.org:4000/omls"
     105url = "http://idb1.grid.orbit-lab.org:5001/startCollectionServer?config_file=#{filename}"
     106response = Net::HTTP.get_response(URI.parse(url))
     107if (! response.kind_of? Net::HTTPSuccess)
     108        raise "Can't start OML Collection Server : #{response.to_s}"
     109end
     110
     111#
     112# Now, start the application
     113#
     114  Experiment.props.packetSize = 256
     115  Experiment.props.rate = 2000
     116
     117  print "\t\n Enter ESSID now\n"
     118  Kernel.sleep 20
     119
     120
     121  NodeSet['receiver'].startApplication('otr')
     122  NodeSet['forwarder1'].startApplication('otf')
     123  NodeSet['forwarder2'].startApplication('otf')
     124  NodeSet['forwarder3'].startApplication('otf')
     125  NodeSet['forwarder4'].startApplication('otf')
     126  NodeSet['sender'].startApplication('otg')
     127
     128 # Kernel.sleep 5
     129  NodeSet['sender'].send(:STDIN, 'proc/otg', 'size 1024')
     130  NodeSet['sender'].send(:STDIN, 'proc/otg', 'rate 5000')
     131
     132  Kernel.sleep 60
     133  NodeSet['sender'].send(:STDIN, 'proc/otg', 'exit')
     134  NodeSet['receiver'].send(:STDIN, 'proc/otr', 'exit')
     135 NodeSet['forwarder1'].send(:STDIN, 'proc/otf', 'exit')
     136  NodeSet['forwarder2'].send(:STDIN, 'proc/otf', 'exit')
     137  NodeSet['forwarder3'].send(:STDIN, 'proc/otf', 'exit')
     138  NodeSet['forwarder4'].send(:STDIN, 'proc/otf', 'exit')
     139  Kernel.sleep 10
     140
     141#
     142# Stop the OML Collection Server
     143#
     144filename = "http://console.grid.orbit-lab.org:4000/omls"
     145url = "http://idb1.grid.orbit-lab.org:5001/stopCollectionServer?config_file=#{filename}"
     146response = Net::HTTP.get_response(URI.parse(url))
     147if (! response.kind_of? Net::HTTPSuccess)
     148        raise "Can't stop OML Collection Server : #{response.to_s}"
     149end
     150
     151
     152 NodeHandler.exit
     153
     154}
    2155
    3156
    4157
     158
     159
     160}}}
     161