hello-world-graph.rb

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

Download (1.5 kB)

 
1
defGroup('Sender', "omf.nicta.node36") 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', :samples => 1)
7
  end
8
  node.net.e0.ip = "192.168.0.2"
9
end
10

    
11
defGroup('Receiver', "omf.nicta.node37") do |node|
12
  node.addApplication("test:app:otr2") do |app|
13
    app.setProperty('udp:local_host', '192.168.0.3')
14
    app.setProperty('udp:local_port', 3000)
15
    app.measure('udp_in', :samples => 1)
16
  end
17
  node.net.e0.ip = "192.168.0.3"
18
end
19

    
20
onEvent(:ALL_UP_AND_INSTALLED) do |event|
21
  info "This is my first OMF experiment"
22
  wait 10
23
  allGroups.startApplications
24
  info "All my Applications are started now..."
25
  wait 300
26
  allGroups.stopApplications
27
  info "All my Applications are stopped now."
28
  Experiment.done
29
end
30

    
31
addTab(:defaults)
32
addTab(:graph2) do |tab|
33
  opts = { :postfix => %{This graph shows the Sequence Number from the UDP traffic.}, :updateEvery => 1 }
34
  tab.addGraph("Sequence_Number", opts) do |g|
35
    dataOut = Array.new
36
    dataIn = Array.new
37
    mpOut = ms('udp_out')
38
    mpIn = ms('udp_in')
39
    mpOut.project(:oml_ts_server, :seq_no).each do |sample|
40
      dataOut << sample.tuple
41
    end
42
    mpIn.project(:oml_ts_server, :seq_no).each do |sample|
43
      dataIn << sample.tuple
44
    end
45
    g.addLine(dataOut, :label => "Sender (outgoing UDP)")
46
    g.addLine(dataIn, :label => "Receiver (incoming UDP)")
47
  end
48
end
49