GIMIv2tasks/TestCases: step1-ping_all.rb

File step1-ping_all.rb, 5.7 KB (added by koneil@bbn.com, 6 years ago)
Line 
1defProperty('source1', "NodeA", "ID of a resource")
2defProperty('source2', "NodeB", "ID of a resource")
3defProperty('source3', "NodeC", "ID of a resource")
4defProperty('source4', "NodeD", "ID of a resource")
5defProperty('source5', "NodeE", "ID of a resource")
6defProperty('graph', true, "Display graph or not")
7
8#defProperty('sink1', "nodeA", "ID of a sink")
9#defProperty('sink2', "nodeB", "ID of a sink")
10#defProperty('sink3', "nodeC", "ID of a sink")
11#defProperty('sink4', "nodeD", "ID of a sink")
12#defProperty('sink5', "nodeE", "ID of a sink")
13
14defProperty('sinkaddr11', '192.168.16.10', "Ping destination address")
15defProperty('sinkaddr12', '192.168.5.12', "Ping destination address")
16
17defProperty('sinkaddr21', '192.168.4.11', "Ping destination address")
18defProperty('sinkaddr22', '192.168.2.12', "Ping destination address")
19defProperty('sinkaddr23', '192.168.1.13', "Ping destination address")
20
21defProperty('sinkaddr31', '192.168.5.11', "Ping destination address")
22defProperty('sinkaddr32', '192.168.2.10', "Ping destination address")
23defProperty('sinkaddr33', '192.168.3.13', "Ping destination address")
24defProperty('sinkaddr34', '192.168.6.14', "Ping destination address")
25
26defProperty('sinkaddr41', '192.168.1.10', "Ping destination address")
27defProperty('sinkaddr42', '192.168.3.12', "Ping destination address")
28
29defProperty('sinkaddr51', '192.168.6.12', "Ping destination address")
30
31defApplication('ping_app', 'pingmonitor') do |a|
32    a.path = "/root/pingWrap.rb"
33    a.version(1, 2, 0)
34    a.shortDescription = "Wrapper around ping"
35    a.description = "ping application"
36    a.defProperty('dest_addr', 'Address to ping', '-a', {:type => :string, :dynamic => false})
37    a.defProperty('count', 'Number of times to ping', '-c', {:type => :integer, :dynamic => false})
38    a.defProperty('interval', 'Interval between pings in s', '-i', {:type => :integer, :dynamic => false})
39   
40    a.defMeasurement('myping', '', :stream_name => 'pingmonitor_myping') do |m|
41    #a.defMeasurement('myping', '') do |m|
42     m.defMetric('dest_addr',:string)
43     m.defMetric('ttl',:int)
44     m.defMetric('rtt',:float)
45     m.defMetric('rtt_unit',:string)
46    end
47end
48
49defGroup('Source1', property.source1) do |node|
50  node.addApplication("ping_app") do |app|
51    app.setProperty('dest_addr', property.sinkaddr11)
52    app.setProperty('count', 30)
53    app.setProperty('interval', 1)
54    app.measure('myping', :samples => 1)
55  end
56
57  node.addApplication("ping_app") do |app|
58    app.setProperty('dest_addr', property.sinkaddr12)
59    app.setProperty('count', 30)
60    app.setProperty('interval', 1)
61    app.measure('myping', :samples => 1)
62  end
63end
64
65
66defGroup('Source2', property.source2) do |node|
67  node.addApplication("ping_app") do |app|
68    app.setProperty('dest_addr', property.sinkaddr21)
69    app.setProperty('count', 30)
70    app.setProperty('interval', 1)
71    app.measure('myping', :samples => 1)
72  end
73
74  node.addApplication("ping_app") do |app|
75    app.setProperty('dest_addr', property.sinkaddr22)
76    app.setProperty('count', 30)
77    app.setProperty('interval', 1)
78    app.measure('myping', :samples => 1)
79  end
80
81  node.addApplication("ping_app") do |app|
82    app.setProperty('dest_addr', property.sinkaddr23)
83    app.setProperty('count', 30)
84    app.setProperty('interval', 1)
85    app.measure('myping', :samples => 1)
86  end
87end
88
89defGroup('Source3', property.source3) do |node|
90  node.addApplication("ping_app") do |app|
91    app.setProperty('dest_addr', property.sinkaddr31)
92    app.setProperty('count', 30)
93    app.setProperty('interval', 1)
94    app.measure('myping', :samples => 1)
95  end
96
97  node.addApplication("ping_app") do |app|
98    app.setProperty('dest_addr', property.sinkaddr32)
99    app.setProperty('count', 30)
100    app.setProperty('interval', 1)
101    app.measure('myping', :samples => 1)
102  end
103
104  node.addApplication("ping_app") do |app|
105    app.setProperty('dest_addr', property.sinkaddr33)
106    app.setProperty('count', 30)
107    app.setProperty('interval', 1)
108    app.measure('myping', :samples => 1)
109  end
110
111  node.addApplication("ping_app") do |app|
112    app.setProperty('dest_addr', property.sinkaddr34)
113    app.setProperty('count', 30)
114    app.setProperty('interval', 1)
115    app.measure('myping', :samples => 1)
116  end
117end
118
119defGroup('Source4', property.source4) do |node|
120  node.addApplication("ping_app") do |app|
121    app.setProperty('dest_addr', property.sinkaddr41)
122    app.setProperty('count', 30)
123    app.setProperty('interval', 1)
124    app.measure('myping', :samples => 1)
125  end
126
127  node.addApplication("ping_app") do |app|
128    app.setProperty('dest_addr', property.sinkaddr42)
129    app.setProperty('count', 30)
130    app.setProperty('interval', 1)
131    app.measure('myping', :samples => 1)
132  end
133end
134
135defGroup('Source5', property.source5) do |node|
136  node.addApplication("ping_app") do |app|
137    app.setProperty('dest_addr', property.sinkaddr51)
138    app.setProperty('count', 30)
139    app.setProperty('interval', 1)
140    app.measure('myping', :samples => 1)
141  end
142end
143
144
145
146#defGroup('Sink1', property.sink1) do |node|
147#end
148
149#defGroup('Sink2', property.sink2) do |node|
150#end
151
152#defGroup('Sink3', property.sink3) do |node|
153#end
154
155#defGroup('Sink4', property.sink4) do |node|
156#end
157
158#defGroup('Sink5', property.sink5) do |node|
159#end
160
161onEvent(:ALL_UP_AND_INSTALLED) do |event|
162  info "Starting the ping"
163  allGroups.startApplications
164  wait 30
165  info "Stopping the ping"
166  allGroups.stopApplications
167  Experiment.done
168end
169
170defGraph 'RTT' do |g|
171  g.ms('myping').select(:oml_seq, :dest_addr, :rtt)#.where(:dest_addr => "192.168.5.12")
172  g.caption "RTT of received packets."
173  g.type 'line_chart3'
174  g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => :dest_addr
175#    g.group_by(:dest_addr)
176  g.xaxis :legend => 'oml_seq'
177  g.yaxis :legend => 'rtt', :ticks => {:format => 's'}
178end