Changes between Version 2 and Version 3 of GEC22Agenda/LabWiki/ModuleE/Execute


Ignore:
Timestamp:
03/10/15 16:56:20 (9 years ago)
Author:
divyashri.bhat@gmail.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GEC22Agenda/LabWiki/ModuleE/Execute

    v2 v3  
    5656{{{
    5757#!ruby
    58 defProperty('source1', "switch1-egtest7", "ID of a resource")
    59 defProperty('theSender1', "nodeb-egtest7", "ID of a resource")
    60 defProperty('theSender2', "nodec-egtest7", "ID of a resource")
    61 defProperty('theSender3', "noded-egtest7", "ID of a resource")
    62 defProperty('theSender4', "nodea-egtest7", "ID of a resource")
    63 defProperty('theSender5', "nodee-egtest7", "ID of a resource")
    64 defProperty('theReceiver', "nodef-egtest7", "ID of a resource")
     58defProperty('source1', "switch1-testextend", "ID of a resource")
     59defProperty('theSender1', "nodeb-testextend", "ID of a resource")
     60defProperty('theSender2', "nodec-testextend", "ID of a resource")
     61defProperty('theSender3', "noded-testextend", "ID of a resource")
     62defProperty('theSender4', "nodea-testextend", "ID of a resource")
     63defProperty('theSender5', "nodee-testextend", "ID of a resource")
     64defProperty('theReceiver', "nodef-testextend", "ID of a resource")
     65
     66defProperty('sinkaddr11', '192.168.1.6', "Ping destination address")
     67peak_list = []
     68count =0
    6569
    6670defProperty('intervalcol',"1", "Interval to Tail")
     
    8084end
    8185
     86defApplication('ping') do |app|
     87  app.description = 'Simple Definition for the ping-oml2 application'
     88  # Define the path to the binary executable for this application
     89  app.binary_path = '/usr/local/bin/ping-oml2'
     90  # Define the configurable parameters for this application
     91  # For example if target is set to foo.com and count is set to 2, then the
     92  # application will be started with the command line:
     93  # /usr/bin/ping-oml2 -a foo.com -c 2
     94  app.defProperty('target', 'Address to ping', '-a', {:type => :string})
     95  app.defProperty('count', 'Number of times to ping', '-c', {:type => :integer})
     96  # Define the OML2 measurement point that this application provides.
     97  # Here we have only one measurement point (MP) named 'ping'. Each measurement
     98  # sample from this MP will be composed of a 4-tuples (addr,ttl,rtt,rtt_unit)
     99  app.defMeasurement('ping') do |m|
     100    m.defMetric('remote',:string)
     101    m.defMetric('ttl',:uint32)
     102    m.defMetric('rtt',:double)
     103    m.defMetric('rtt_unit',:string)
     104  end
     105end
     106
     107
    82108defApplication('iperfserv') do |app|
    83109  app.description = "manually run Iperf server"
     
    124150    end
    125151  end
     152defGroup('Source4', property.source1) do |node|
     153  node.addApplication("ping") do |app|
     154    app.setProperty('target', property.sinkaddr11)
     155    app.setProperty('count', 30)
     156    #app.setProperty('interval', 1)
     157    app.measure('ping', :samples => 1)
     158  end
     159end
    126160
    127161onEvent(:ALL_UP_AND_INSTALLED) do |event|
     
    153187  end
    154188end
     189defEvent(:MY_EVENT, every: 0.5) do
     190# Query for some measurements...
     191  # returns an array where each element is a hash representing a row from the DB
     192  query = ms('wrapper_ofthroughput').select { [ :srcaddr] }
     193  data = defQuery(query)
     194 
     195
     196  triggered = false
     197  if !data.nil? && !(last_row = data.pop).nil? # Make sure we have some data
     198    next if peak_list.include?(last_row[:srcaddr]) # Do nothing if we have seen this sample before
     199    if !peak_list.include?(last_row[:srcaddr])
     200      peak_list << last_row[:srcaddr] # record that sample, so we dont trigger on it again
     201      #count+=1
     202    end
     203    if  peak_list.size >= 1
     204     
     205      triggered = true
     206    end
     207  end
     208  triggered
     209end
     210onEvent :MY_EVENT do
     211  group('Source4').startApplications
     212end
     213
    155214
    156215defGraph 'Throughput' do |g|
     
    164223
    165224
     225
     226
    166227}}}
    167228=== 3.1.3 Start your application from !LabWiki ===