IMInteroperability/GIMIInstaGENITestCase: step1-ping_all.rb

File step1-ping_all.rb, 2.4 KB (added by divyashri.bhat@gmail.com, 12 years ago)
Line 
1defProperty('source1', "nodeA", "ID of a resource")
2defProperty('source2', "nodeB", "ID of a resource")
3#defProperty('sink2', "nodeB", "ID of a sink")
4#defProperty('sink3', "nodeC", "ID of a sink")
5#defProperty('sink4', "nodeD", "ID of a sink")
6#defProperty('sink5', "nodeE", "ID of a sink")
7
8defProperty('sinkaddr11', '10.10.1.1', "Ping destination address")
9defProperty('sinkaddr12', '10.10.1.2', "Ping destination address")
10
11defApplication('ping_app', 'pingmonitor') do |a|
12    a.path = "/root/pingWrap.rb"
13    a.version(1, 2, 0)
14    a.shortDescription = "Wrapper around ping"
15    a.description = "ping application"
16    a.defProperty('dest_addr', 'Address to ping', '-a', {:type => :string, :dynamic => false})
17    a.defProperty('count', 'Number of times to ping', '-c', {:type => :integer, :dynamic => false})
18    a.defProperty('interval', 'Interval between pings in s', '-i', {:type => :integer, :dynamic => false})
19   
20    a.defMeasurement('myping') do |m|
21    #a.defMeasurement('myping', '') do |m|
22     m.defMetric('dest_addr',:string)
23     m.defMetric('ttl',:int)
24     m.defMetric('rtt',:float)
25     m.defMetric('rtt_unit',:string)
26    end
27end
28
29defGroup('Source1', property.source1) do |node|
30  node.addApplication("ping_app") do |app|
31    app.setProperty('dest_addr', property.sinkaddr12)
32    app.setProperty('count', 30)
33    app.setProperty('interval', 1)
34    app.measure('myping', :samples => 1)
35  end
36end
37defGroup('Source2', property.source2) do |node|
38  node.addApplication("ping_app") do |app|
39    app.setProperty('dest_addr', property.sinkaddr11)
40    app.setProperty('count', 30)
41    app.setProperty('interval', 1)
42    app.measure('myping', :samples => 1)
43  end
44
45end
46
47
48
49#defGroup('Sink1', property.sink1) do |node|
50#end
51
52#defGroup('Sink2', property.sink2) do |node|
53#end
54
55#defGroup('Sink3', property.sink3) do |node|
56#end
57
58#defGroup('Sink4', property.sink4) do |node|
59#end
60
61#defGroup('Sink5', property.sink5) do |node|
62#end
63
64onEvent(:ALL_UP_AND_INSTALLED) do |event|
65  info "Starting the ping"
66  allGroups.startApplications
67  wait 30
68  info "Stopping the ping"
69  allGroups.stopApplications
70  Experiment.done
71end
72
73defGraph 'RTT' do |g|
74  g.ms('myping').select(:oml_seq, :dest_addr, :rtt)#.where(:dest_addr => "192.168.5.12")
75  g.caption "RTT of received packets."
76  g.type 'line_chart3'
77  g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => :dest_addr
78#    g.group_by(:dest_addr)
79  g.xaxis :legend => 'oml_seq'
80  g.yaxis :legend => 'rtt', :ticks => {:format => 's'}
81end