| 2 | |
| 3 | {{{ |
| 4 | require 'net/http' |
| 5 | require 'uri' |
| 6 | |
| 7 | Experiment.name = "hop-4" |
| 8 | Experiment.project = "orbit:mutli-hop" |
| 9 | |
| 10 | Experiment.defProperty('rate', 10, 'Kilo Bits per second sent from sender') |
| 11 | Experiment.defProperty('packetSize', 512, 'Size of packets sent from sender') |
| 12 | Experiment.defProperty('destinationIP','12.0.0.7','The sink of the flow') |
| 13 | |
| 14 | # |
| 15 | # Define nodes used in experiment |
| 16 | # |
| 17 | nodes([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 | |
| 27 | nodes([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 | |
| 41 | nodes([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 | |
| 57 | nodes([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 | } |
| 71 | nodes([6,6], 'forwarder3') {|node| |
| 72 | node.image = nil # assume the right image to be on disk |
| 73 | node.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 | |
| 86 | nodes([7,7], 'forwarder4') {|node| |
| 87 | node.image = nil # assume the right image to be on disk |
| 88 | node.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 | } |
| 100 | whenAll("/*/*", "procs/proc/status[text()='INSTALLED.OK']") {|node| |
| 101 | # |
| 102 | # Start the OML Collection Server |
| 103 | # |
| 104 | filename = "http://console.grid.orbit-lab.org:4000/omls" |
| 105 | url = "http://idb1.grid.orbit-lab.org:5001/startCollectionServer?config_file=#{filename}" |
| 106 | response = Net::HTTP.get_response(URI.parse(url)) |
| 107 | if (! response.kind_of? Net::HTTPSuccess) |
| 108 | raise "Can't start OML Collection Server : #{response.to_s}" |
| 109 | end |
| 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 | # |
| 144 | filename = "http://console.grid.orbit-lab.org:4000/omls" |
| 145 | url = "http://idb1.grid.orbit-lab.org:5001/stopCollectionServer?config_file=#{filename}" |
| 146 | response = Net::HTTP.get_response(URI.parse(url)) |
| 147 | if (! response.kind_of? Net::HTTPSuccess) |
| 148 | raise "Can't stop OML Collection Server : #{response.to_s}" |
| 149 | end |
| 150 | |
| 151 | |
| 152 | NodeHandler.exit |
| 153 | |
| 154 | } |