Changes between Initial Version and Version 1 of GENIExperimenter/Tutorials/LabWiki/ModuleD


Ignore:
Timestamp:
02/12/15 16:17:13 (9 years ago)
Author:
divyashri.bhat@gmail.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GENIExperimenter/Tutorials/LabWiki/ModuleD

    v1 v1  
     1= Module D: Extend experiment script =
     2
     3In this module, we will take a look at the modifications that have to be made in the experiment script to evaluate correct
     4functionality of both learning switches in the extended topology. This example shows that it is relatively easy to adapt an
     5existing OEDL script to an extended or slightly modified topology.
     6
     7{{{
     8#!ruby
     9
     10defProperty('resource1', "nodea", "ID of a resource")
     11defProperty('resource2', "switch1", "ID of a resource")
     12defProperty('resource3', "switch2", "ID of a resource")
     13
     14
     15defProperty('sinkaddr12', '192.168.1.7', "Ping destination address")
     16defProperty('sinkaddr13', '192.168.1.8', "Ping destination address")
     17
     18defProperty('sinkaddr21', '192.168.1.13', "Ping destination address")
     19defProperty('sinkaddr23', '192.168.1.14', "Ping destination address")
     20defProperty('sinkaddr24', '192.168.1.15', "Ping destination address")
     21
     22
     23defApplication('ping') do |app|
     24  app.description = 'Simple Definition for the ping-oml2 application'
     25  # Define the path to the binary executable for this application
     26  app.binary_path = '/usr/local/bin/ping-oml2'
     27  # Define the configurable parameters for this application
     28  # For example if target is set to foo.com and count is set to 2, then the
     29  # application will be started with the command line:
     30  # /usr/bin/ping-oml2 -a foo.com -c 2
     31  app.defProperty('target', 'Address to ping', '-a', {:type => :string})
     32  app.defProperty('count', 'Number of times to ping', '-c', {:type => :integer})
     33  # Define the OML2 measurement point that this application provides.
     34  # Here we have only one measurement point (MP) named 'ping'. Each measurement
     35  # sample from this MP will be composed of a 4-tuples (addr,ttl,rtt,rtt_unit)
     36  app.defMeasurement('ping') do |m|
     37    m.defMetric('remote',:string)
     38    m.defMetric('ttl',:uint32)
     39    m.defMetric('rtt',:double)
     40    m.defMetric('rtt_unit',:string)
     41  end
     42end
     43
     44defApplication('trema') do |app|
     45  app.description = 'This app runs trema from command line'
     46  app.binary_path = '/bin/sh /root/ovs-setup2.sh'
     47end
     48defGroup('Source2', property.resource2, property.resource3) do |node|
     49  node.addApplication("trema")
     50end
     51defGroup('Source1', property.resource1) do |node|
     52  node.addApplication("ping") do |app|
     53    app.setProperty('target', property.sinkaddr12)
     54    app.setProperty('count', 30)
     55    #app.setProperty('interval', 1)
     56    app.measure('ping', :samples => 1)
     57  end
     58  node.addApplication("ping") do |app|
     59    app.setProperty('target', property.sinkaddr13)
     60    app.setProperty('count', 30)
     61    #app.setProperty('interval', 1)
     62    app.measure('ping', :samples => 1)
     63  end
     64   node.addApplication("ping") do |app|
     65    app.setProperty('target', property.sinkaddr21)
     66    app.setProperty('count', 30)
     67    #app.setProperty('interval', 1)
     68    app.measure('ping', :samples => 1)
     69  end
     70   node.addApplication("ping") do |app|
     71    app.setProperty('target', property.sinkaddr23)
     72    app.setProperty('count', 30)
     73    #app.setProperty('interval', 1)
     74    app.measure('ping', :samples => 1)
     75  end
     76  node.addApplication("ping") do |app|
     77    app.setProperty('target', property.sinkaddr24)
     78    app.setProperty('count', 30)
     79    #app.setProperty('interval', 1)
     80    app.measure('ping', :samples => 1)
     81  end
     82end
     83
     84
     85onEvent(:ALL_UP_AND_INSTALLED) do |event|
     86  info "Starting the ping"
     87  after 2 do
     88    group('Source2').startApplications
     89  end
     90  after 20 do
     91    group('Source1').startApplications
     92  end
     93  after 80 do
     94    info "Stopping the ping"
     95    allGroups.stopApplications
     96    Experiment.done
     97  end
     98end
     99
     100defGraph 'RTT' do |g|
     101  g.ms('ping').select(:oml_seq, :remote, :rtt)
     102  g.caption "RTT of received packets."
     103  g.type 'line_chart3'
     104  g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => :remote
     105  g.xaxis :legend => 'oml_seq'
     106  g.yaxis :legend => 'rtt', :ticks => {:format => 's'}
     107end
     108
     109}}}
     110
     111[wiki:GEC21Agenda/LabWiki LabWiki Tutorial]