1 | defProperty('source1', "nodeA", "ID of a resource") |
---|
2 | defProperty('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 | |
---|
8 | defProperty('sinkaddr11', '10.10.1.1', "Ping destination address") |
---|
9 | defProperty('sinkaddr12', '10.10.1.2', "Ping destination address") |
---|
10 | |
---|
11 | defApplication('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 |
---|
27 | end |
---|
28 | |
---|
29 | defGroup('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 |
---|
36 | end |
---|
37 | defGroup('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 | |
---|
45 | end |
---|
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 | |
---|
64 | onEvent(: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 |
---|
71 | end |
---|
72 | |
---|
73 | defGraph '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'} |
---|
81 | end |
---|