Changes between Initial Version and Version 1 of GENIExperimenter/Tutorials/GettingStarted_PartII_Labwiki/Execute


Ignore:
Timestamp:
05/13/15 10:31:56 (6 years ago)
Author:
cwang1@umass.edu
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GENIExperimenter/Tutorials/GettingStarted_PartII_Labwiki/Execute

    v1 v1  
     1= Module A Execute Experiment =
     2
     3== 3. Instrument your Application using !LabWiki ==
     4
     5In this part of Module A you will learn how you can use !LabWiki to execute an experiment on the slice you
     6reserved in the [wiki:GEC22Agenda/LabWiki/ModuleA/DesignSetup previous step].
     7
     8=== 3.1 Design and Execute measurement in !LabWiki ===
     9
     10
     11=== 3.1.1. The "Plan" Window ===
     12To get started point your browser to [http://labwiki.casa.umass.edu]. Labwiki has three major windows. We will focus on the leftmost window first. This is the "Planning" window in which you document your experiment. (This is somewhat the equivalent of an electronic lab journal.) Documents are written in [http://daringfireball.net/projects/markdown/ Markdown].
     13
     14At the top of that window is a text field which you can use to search for existing MD scripts. Type "GEC22-learningswitch" in the field and then select "GEC22-learningswitch.md" from the list of files that are offered. This document has some information on the experiment that will be performed in Module A of the tutorial.
     15
     16To edit Markdown scripts use the Prepare window by selecting the option "Wiki" from the menu shown.
     17
     18=== 3.1.2 The "Prepare" Window ===
     19
     20The "Prepare" (middle) window allows you to define your experiment through and [http://mytestbed.net/projects/omf/wiki/OMF_Main_Page OMF] experiment script specified in [http://mytestbed.net/projects/omf6/wiki/OEDLOMF6 OMF Experiment Description Language] (OEDL).
     21
     22At the top of that window is a text field which you can use to search for existing OEDL scripts. Type "GEC22" in the field and then select "GEC22-learningswitch.oedl" from the list of files that are offered. This shows the experiment script in the field below.
     23
     24For reference, we show the experiment script here:
     25{{{
     26#!ruby
     27
     28defProperty('source1', "nodea", "ID of a resource")
     29defProperty('source2', "switch", "ID of a resource")
     30
     31
     32defProperty('sinkaddr12', '192.168.1.7', "Ping destination address")
     33defProperty('sinkaddr13', '192.168.1.8', "Ping destination address")
     34
     35defProperty('sinkaddr21', '192.168.1.9', "Ping destination address")
     36defProperty('sinkaddr11', '192.168.1.6', "Ping destination address")
     37peak_list = []
     38
     39defApplication('ping') do |app|
     40  app.description = 'Simple Definition for the ping-oml2 application'
     41  # Define the path to the binary executable for this application
     42  app.binary_path = '/usr/local/bin/ping-oml2'
     43  # Define the configurable parameters for this application
     44  # For example if target is set to foo.com and count is set to 2, then the
     45  # application will be started with the command line:
     46  # /usr/bin/ping-oml2 -a foo.com -c 2
     47  app.defProperty('target', 'Address to ping', '-a', {:type => :string})
     48  app.defProperty('count', 'Number of times to ping', '-c', {:type => :integer})
     49  # Define the OML2 measurement point that this application provides.
     50  # Here we have only one measurement point (MP) named 'ping'. Each measurement
     51  # sample from this MP will be composed of a 4-tuples (addr,ttl,rtt,rtt_unit)
     52  app.defMeasurement('ping') do |m|
     53    m.defMetric('remote',:string)
     54    m.defMetric('ttl',:uint32)
     55    m.defMetric('rtt',:double)
     56    m.defMetric('rtt_unit',:string)
     57  end
     58end
     59
     60defApplication('trema') do |app|
     61  app.description = 'This app runs trema from command line'
     62  app.binary_path = '/bin/sh /root/ovs-setup2.sh'
     63end
     64defGroup('Source2', property.source2) do |node|
     65  node.addApplication("trema")
     66end
     67defGroup('Source1', property.source1) do |node|
     68  node.addApplication("ping") do |app|
     69    app.setProperty('target', property.sinkaddr12)
     70    app.setProperty('count', 30)
     71    #app.setProperty('interval', 1)
     72    app.measure('ping', :samples => 1)
     73  end
     74  node.addApplication("ping") do |app|
     75    app.setProperty('target', property.sinkaddr13)
     76    app.setProperty('count', 30)
     77    #app.setProperty('interval', 1)
     78    app.measure('ping', :samples => 1)
     79  end
     80   node.addApplication("ping") do |app|
     81    app.setProperty('target', property.sinkaddr21)
     82    app.setProperty('count', 30)
     83    #app.setProperty('interval', 1)
     84    app.measure('ping', :samples => 1)
     85  end
     86end
     87
     88defGroup('Source3', property.source1) do |node|
     89  node.addApplication("ping") do |app|
     90    app.setProperty('target', property.sinkaddr11)
     91    app.setProperty('count', 30)
     92    #app.setProperty('interval', 1)
     93    app.measure('ping', :samples => 1)
     94  end
     95end
     96
     97defEvent(:MY_EVENT, every: 0.5) do
     98# Query for some measurements...
     99  # returns an array where each element is a hash representing a row from the DB
     100  query = ms('ping').select { [ :remote] }
     101  data = defQuery(query)
     102 
     103  triggered = false
     104  if !data.nil? && !(last_row = data.pop).nil? # Make sure we have some data
     105    next if peak_list.include?(last_row[:remote]) # Do nothing if we have seen this sample before
     106    if !peak_list.include?(last_row[:remote])
     107      peak_list << last_row[:remote] # record that sample, so we dont trigger on it again
     108    end
     109    if peak_list.include?('192.168.1.9')&&peak_list.include?('192.168.1.7')&&peak_list.include?('192.168.1.8')
     110     
     111      triggered = true
     112    end
     113  end
     114  triggered
     115end
     116onEvent :MY_EVENT do
     117  group('Source3').startApplications
     118end
     119
     120onEvent(:ALL_UP_AND_INSTALLED) do |event|
     121  info "Starting the ping"
     122  after 1 do
     123    group('Source2').startApplications
     124  end
     125  after 30 do
     126    group('Source1').startApplications
     127  end
     128  after 80 do
     129    info "Stopping the ping"
     130    allGroups.stopApplications
     131    Experiment.done
     132  end
     133end
     134
     135defGraph 'RTT' do |g|
     136  g.ms('ping').select(:oml_seq, :remote, :rtt)
     137  g.caption "RTT of received packets."
     138  g.type 'line_chart3'
     139  g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => :remote
     140  g.xaxis :legend => 'oml_seq'
     141  g.yaxis :legend => 'rtt', :ticks => {:format => 's'}
     142end
     143
     144
     145}}}
     146
     147=== 3.1.3 Start your application from !LabWiki ===
     148
     149To start your experiment, simply drag the icon that is to the left of the file name (see figure below) from the middle (Prepare) to the right (Execute) window.
     150That will automatically fill out the experiment relevant information in this window
     151 Explanation of the fields in the Execute window:
     152
     153* name: In this field you specify the name of your experiment.
     154
     155* project: This pull-down menu list all the projects you are currently a member of. Select the project that contains the slice you want to run your experiment on.
     156
     157* experiment context: With the context you can specify a certain set of experiments. E.g., a series of experiments you run under a certain set of startup parameters. This field is not mandatory and only necessary if you would like to save your experiment data to view later.
     158
     159* slice: This pull down menu lists all slice that have been created under "project". Select the slice you would like to run your experiment on.
     160
     161*Change source1 and source2 fields to include your slice name similar to nodea-<slicename>
     162
     163Then, start the actual experiment by clicking on the "Start Experiment" button.
     164
     165[[Image(LW-execute.png, 50%)]]
     166
     167
     168=== 3.1.4 During experiment execution ===
     169
     170After pressing the "Start" button, the Execute window will change and start showing status information about your experiment.
     171The figure below gives an example for the Execute window during experiment execution.
     172
     173[[Image(LW-executing.png, 50%)]]
     174
     175Now the window lists experiment properties, one or several live graphs (if they have been specified in the OEDL script), and logging information. The latter would be a good starting point for trouble shooting, should your experiment not run as expected.
     176
     177Depending on the status of your resources and experiments, you will see one of the following statuses at the top of the Execute window:
     178 * Pending - This is the first state of your experiment where the job scheduler adds it to the run queue. This status would remain for the first few seconds before it changes to Running or Failed
     179 * Running - This status appears when your experiment starts running. If it fails for one or more reasons, a Failed status will appear instead
     180 * Aborted - When you click on "Stop Experiment" at the top-left corner of the Execute window, the status changes to aborted
     181 * Finished - When your experiment is done, you will see this status
     182
     183
     184== Note for Students ==
     185
     186      * Once the experiment is complete, students have to create a new Markdown file for submission. You can create your own Markdown from scratch or copy the contents of the sample Markdown created by the instructor. Then can drag the graphs of the experiment into the file and and include necessary details about the experiment. When you are ready to submit the file, you can click "share page" icon in the leftmost-corner of plan panel of Labwiki.
     187
     188      * The "Share Page" creates a submission file with the student's user name in the submission repository
     189
     190[[Image(studentsubmit.png, 50%)]]
     191
     192== Note to Instructors ==
     193
     194* Students can be asked to implement a particular functionality of the OpenFlow controller. A template should be given to them. [[BR]]
     195* !LabWiki has a new feature that enables the instructor to auto-grade the students' experiments. !LabWiki allows graders to write a user-defined event, which is triggered when an 
     196experiment-generated measurement reaches a specific value. In the script below, MY_EVENT is the user-defined event. The function will be called every 0.5 seconds. It queries the specified stats and checks if Node A is able to ping all other nodes. The event will be triggered once that condition is satisfied. Then, ping application to itself is started on Node A. If a ping to the IP address of Node A is also seen on the graph, the experiment ran successfully.
     197
     198{{{
     199#!ruby
     200defEvent(:MY_EVENT, every: 0.5) do
     201# Query for some measurements...
     202  # returns an array where each element is a hash representing a row from the DB
     203  query = ms('ping').select { [ :remote] }
     204  data = defQuery(query)
     205
     206  triggered = false
     207  if !data.nil? && !(last_row = data.pop).nil? # Make sure we have some data
     208    next if peak_list.include?(last_row[:remote]) # Do nothing if we have seen this sample before
     209    if !peak_list.include?(last_row[:remote])
     210      peak_list << last_row[:remote] # record that sample, so we dont trigger on it again
     211    end
     212    if peak_list.include?('192.168.1.9')&&peak_list.include?('192.168.1.7')&&peak_list.include?('192.168.1.8')
     213     
     214      triggered = true
     215    end
     216  end
     217  triggered
     218end
     219onEvent :MY_EVENT do
     220  group('Source3').startApplications
     221end
     222
     223}}}
     224
     225* To view students' submissions open a Markdown called "submission.md" in the Plan window. This file contains links to all student submissions. Click on the link you wish to grade.
     226
     227[[Image(submission.png, 40%)]]                               [[Image(studentsubmission.png, 40%)]]
     228
     229= [wiki:GEC22Agenda/LabWiki/ModuleA/Finish Next: Finish] =
     230= [wiki:GEC22Agenda/LabWiki/ModuleA/DesignSetup Design] =