hello-world.rb

Thierry Rakotoarivelo, 08/09/2010 02:49 pm

Download (1.2 kB)

 
1
defGroup('Sender', "omf.nicta.node28") do |node|
2
  node.addApplication("test:app:otg2") do |app|
3
    app.setProperty('udp:local_host', '192.168.0.2')
4
    app.setProperty('udp:dst_host', '192.168.0.3')
5
    app.setProperty('udp:dst_port', 3000)
6
    #app.measure('udp_out', :interval => 3)
7
    app.measure('udp_out', :samples => 1)
8
  end
9
  node.net.w0.mode = "adhoc"
10
  node.net.w0.type = 'g'
11
  node.net.w0.channel = "6"
12
  node.net.w0.essid = "helloworld"
13
  node.net.w0.ip = "192.168.0.2"
14
end
15

    
16
defGroup('Receiver', "omf.nicta.node29") do |node|
17
  node.addApplication("test:app:otr2") do |app|
18
    app.setProperty('udp:local_host', '192.168.0.3')
19
    app.setProperty('udp:local_port', 3000)
20
    #app.measure('udp_in', :interval => 3)
21
    app.measure('udp_in', :samples => 1)
22
  end
23
  node.net.w0.mode = "adhoc"
24
  node.net.w0.type = 'g'
25
  node.net.w0.channel = "6"
26
  node.net.w0.essid = "helloworld"
27
  node.net.w0.ip = "192.168.0.3"
28
end
29

    
30
onEvent(:ALL_UP_AND_INSTALLED) do |node|
31
  info "This is my first OMF experiment"
32
  wait 10
33
  allGroups.startApplications
34
  info "All my Applications are started now..."
35
  wait 30
36
  allGroups.stopApplications
37
  info "All my Applications are stopped now."
38
  Experiment.done
39
end