Changes between Version 2 and Version 3 of GEC22Agenda/LabWiki/ModuleD
- Timestamp:
- 03/10/15 17:06:49 (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GEC22Agenda/LabWiki/ModuleD
v2 v3 6 6 7 7 {{{ 8 #!ruby 9 10 defProperty('resource1', "nodea", "ID of a resource") 11 defProperty('resource2', "switch1", "ID of a resource") 12 defProperty('resource3', "switch2", "ID of a resource") 13 8 defProperty('source1', "nodea-extend1", "ID of a resource") 9 defProperty('source2', "switch1-extend1", "ID of a resource") 10 defProperty('source3', "switch2-extend1", "ID of a resource") 11 peak_list = [] 14 12 15 13 defProperty('sinkaddr12', '192.168.1.7', "Ping destination address") … … 19 17 defProperty('sinkaddr23', '192.168.1.14', "Ping destination address") 20 18 defProperty('sinkaddr24', '192.168.1.15', "Ping destination address") 21 19 defProperty('sinkaddr11', '192.168.1.6', "Ping destination address") 22 20 23 21 defApplication('ping') do |app| … … 35 33 # sample from this MP will be composed of a 4-tuples (addr,ttl,rtt,rtt_unit) 36 34 app.defMeasurement('ping') do |m| 37 m.defMetric(' remote',:string)35 m.defMetric('dest_addr',:string) 38 36 m.defMetric('ttl',:uint32) 39 37 m.defMetric('rtt',:double) … … 46 44 app.binary_path = '/bin/sh /root/ovs-setup2.sh' 47 45 end 48 defGroup('Source2', property. resource2, property.resource3) do |node|46 defGroup('Source2', property.source2, property.source3) do |node| 49 47 node.addApplication("trema") 50 48 end 51 defGroup('Source1', property. resource1) do |node|49 defGroup('Source1', property.source1) do |node| 52 50 node.addApplication("ping") do |app| 53 51 app.setProperty('target', property.sinkaddr12) … … 82 80 end 83 81 82 defGroup('Source3', property.source1) do |node| 83 node.addApplication("ping") do |app| 84 app.setProperty('target', property.sinkaddr11) 85 app.setProperty('count', 30) 86 #app.setProperty('interval', 1) 87 app.measure('ping', :samples => 1) 88 end 89 end 90 91 defEvent(:MY_EVENT, every: 0.5) do 92 # Query for some measurements... 93 # returns an array where each element is a hash representing a row from the DB 94 query = ms('ping').select { [ :remote] } 95 data = defQuery(query) 96 triggered = false 97 if !data.nil? && !(last_row = data.pop).nil? # Make sure we have some data 98 next if peak_list.include?(last_row[:remote]) # Do nothing if we have seen this sample before 99 if !peak_list.include?(last_row[:remote]) 100 peak_list << last_row[:remote] # record that sample, so we dont trigger on it again 101 end 102 if peak_list.include?('192.168.1.7')&&peak_list.include?('192.168.1.8')&&peak_list.include?('192.168.1.13')&&peak_list.include?('192.168.1.14')&&peak_list.include?('192.168.1.15') 103 104 triggered = true 105 end 106 end 107 triggered 108 end 109 onEvent :MY_EVENT do 110 group('Source3').startApplications 111 end 84 112 85 113 onEvent(:ALL_UP_AND_INSTALLED) do |event| … … 99 127 100 128 defGraph 'RTT' do |g| 101 g.ms('ping').select(:oml_seq, : remote, :rtt)129 g.ms('ping').select(:oml_seq, :dest_addr, :rtt) 102 130 g.caption "RTT of received packets." 103 131 g.type 'line_chart3' 104 g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => : remote132 g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => :dest_addr 105 133 g.xaxis :legend => 'oml_seq' 106 134 g.yaxis :legend => 'rtt', :ticks => {:format => 's'}