= Module D: Extend experiment script = In this module, we will take a look at the modifications that have to be made in the experiment script to evaluate correct functionality of both learning switches in the extended topology. This example shows that it is relatively easy to adapt an existing OEDL script to an extended or slightly modified topology. {{{ defProperty('source1', "nodea-extend1", "ID of a resource") defProperty('source2', "switch1-extend1", "ID of a resource") defProperty('source3', "switch2-extend1", "ID of a resource") peak_list = [] defProperty('sinkaddr12', '192.168.1.7', "Ping destination address") defProperty('sinkaddr13', '192.168.1.8', "Ping destination address") defProperty('sinkaddr21', '192.168.1.13', "Ping destination address") defProperty('sinkaddr23', '192.168.1.14', "Ping destination address") defProperty('sinkaddr24', '192.168.1.15', "Ping destination address") defProperty('sinkaddr11', '192.168.1.6', "Ping destination address") defApplication('ping') do |app| app.description = 'Simple Definition for the ping-oml2 application' # Define the path to the binary executable for this application app.binary_path = '/usr/local/bin/ping-oml2' # Define the configurable parameters for this application # For example if target is set to foo.com and count is set to 2, then the # application will be started with the command line: # /usr/bin/ping-oml2 -a foo.com -c 2 app.defProperty('target', 'Address to ping', '-a', {:type => :string}) app.defProperty('count', 'Number of times to ping', '-c', {:type => :integer}) # Define the OML2 measurement point that this application provides. # Here we have only one measurement point (MP) named 'ping'. Each measurement # sample from this MP will be composed of a 4-tuples (addr,ttl,rtt,rtt_unit) app.defMeasurement('ping') do |m| m.defMetric('dest_addr',:string) m.defMetric('ttl',:uint32) m.defMetric('rtt',:double) m.defMetric('rtt_unit',:string) end end defApplication('trema') do |app| app.description = 'This app runs trema from command line' app.binary_path = '/bin/sh /root/ovs-setup2.sh' end defGroup('Source2', property.source2, property.source3) do |node| node.addApplication("trema") end defGroup('Source1', property.source1) do |node| node.addApplication("ping") do |app| app.setProperty('target', property.sinkaddr12) app.setProperty('count', 30) #app.setProperty('interval', 1) app.measure('ping', :samples => 1) end node.addApplication("ping") do |app| app.setProperty('target', property.sinkaddr13) app.setProperty('count', 30) #app.setProperty('interval', 1) app.measure('ping', :samples => 1) end node.addApplication("ping") do |app| app.setProperty('target', property.sinkaddr21) app.setProperty('count', 30) #app.setProperty('interval', 1) app.measure('ping', :samples => 1) end node.addApplication("ping") do |app| app.setProperty('target', property.sinkaddr23) app.setProperty('count', 30) #app.setProperty('interval', 1) app.measure('ping', :samples => 1) end node.addApplication("ping") do |app| app.setProperty('target', property.sinkaddr24) app.setProperty('count', 30) #app.setProperty('interval', 1) app.measure('ping', :samples => 1) end end defGroup('Source3', property.source1) do |node| node.addApplication("ping") do |app| app.setProperty('target', property.sinkaddr11) app.setProperty('count', 30) #app.setProperty('interval', 1) app.measure('ping', :samples => 1) end end defEvent(:MY_EVENT, every: 0.5) do # Query for some measurements... # returns an array where each element is a hash representing a row from the DB query = ms('ping').select { [ :remote] } data = defQuery(query) triggered = false if !data.nil? && !(last_row = data.pop).nil? # Make sure we have some data next if peak_list.include?(last_row[:remote]) # Do nothing if we have seen this sample before if !peak_list.include?(last_row[:remote]) peak_list << last_row[:remote] # record that sample, so we dont trigger on it again end 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') triggered = true end end triggered end onEvent :MY_EVENT do group('Source3').startApplications end onEvent(:ALL_UP_AND_INSTALLED) do |event| info "Starting the ping" after 2 do group('Source2').startApplications end after 20 do group('Source1').startApplications end after 80 do info "Stopping the ping" allGroups.stopApplications Experiment.done end end defGraph 'RTT' do |g| g.ms('ping').select(:oml_seq, :dest_addr, :rtt) g.caption "RTT of received packets." g.type 'line_chart3' g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => :dest_addr g.xaxis :legend => 'oml_seq' g.yaxis :legend => 'rtt', :ticks => {:format => 's'} end }}} [wiki:GEC22Agenda/LabWiki LabWiki Tutorial]