wiki:UHTutorial

Version 6 (modified by divyashri.bhat@gmail.com, 6 years ago) (diff)

--

=GIMI Tutorial with OMF6 =

1. Beginner's GIMI Tutorial

RSpec to be used

UHGIMIimage (Available on Portal)

Download Link: GIMI Rspec for OMF6

For more information:

GEC 18 GIMI Tutorial

Please use the scripts that are attached here.

2. OpenFlow and GIMI Tutorial (VLC DASH)

VLC DASH Tutorial

RSpec Used:

VLCDASH Rspec

Ruby Script to run VLC

defApplication('vlc', 'vlc') do |app|

   app.binary_path = "/usr/local/bin/vlc" 
#   app.path = "/home/cong/work/vlc-2.1.0-git/bin/vlc-static"
   #app.version(2, 1, 0)
   #app.shortDescription = "VLC" 
   app.description = "VLC multimedia player and streamer" 

   app.defProperty("input", "Stream input (e.g. file or network address)", nil, 
                   {:type => :string, :dynamic => false})
#   app.defProperty("sout", "Stream output", "--sout", 
#                   {:type => :string, :dynamic => false}) 
   app.defProperty("intf", "Main interface module", "--intf",
                   {:type => :string, :dynamic => false})
#   app.defProperty("extraintf", "Extra interface module(s). Use --extraintf omlstats to enable OML", "--extraintf",
#                   {:type => :string, :dynamic => false})
 #  app.defProperty("mtu", "Specifies the MTU of the network interface", "--mtu",
#                   {:type => :string, :dynamic => false})
#   app.defProperty("quiet", " Deactivates all console messages", "--quiet",
#                   {:type => :boolean, :dynamic => false})
 #  app.defProperty("play-and-exit", "Exit VLC after playing all the items in the input stream list", "--play-and-exit",
 #                  {:type => :boolean, :dynamic => false})

   app.defMeasurement('dashRateAdaptation') do |mp|
     mp.defMetric('chosenRate_bps',:int)
     mp.defMetric('empiricalRate_bps',:int)
     mp.defMetric('decisionRate_bps',:int)
     mp.defMetric('buffer_percent',:int)
   end

   app.defMeasurement('dashDlSession') do |mp|
     mp.defMetric('chunkCount',:int)
     mp.defMetric('readSession_B',:int)
     mp.defMetric('readChunk_B',:int)
     mp.defMetric('timeSession_s',:float)
     mp.defMetric('timeChunk_s',:float)
   end
end

defProperty('theOne','node7-vlcovsinsta','ID of sender node')

#defProperty('packetsize', 128, "Packet size (byte) from the sender node")
#defProperty('bitrate', 2048, "Bitrate (bit/s) from the sender node")
#defProperty('runtime', 40, "Time in second for the experiment is to run")
defProperty('duration', 100, "Duration of experiment")

defGroup('Sender',property.theOne) do |node|
  node.addApplication("vlc") do |app|
#    app.setProperty('quiet', true)
#    app.setProperty('play-and-exit', false)
    app.setProperty('intf', 'dummy')
#    app.setProperty('extraintf', 'omlstats')
    app.setProperty('input', 'http://emmy9.casa.umass.edu/DASH_BuckBunny/www-itec.uni-klu.ac.at/ftp/datasets/mmsys12/BigBuckBunny/bunny_2s_480p_only/bunny_Desktop.mpd')
#    app.setProperty('mtu', '1200')
    app.measure('dashDlSession', :samples =>1)
    app.measure('dashRateAdaptation', :samples =>1)
  end
end


onEvent(:ALL_UP_AND_INSTALLED) do |event|
    info "starting"
  after 5 do
    allGroups.startApplications
    info "All applications started..."
  end
  after property.duration do
    allGroups.stopApplications
    info "All applications stopped." 
    Experiment.done
  end
end

#defGraph 'DashRate1' do |g|
 # g.ms('dashRateAdaptation').select {[:oml_seq, :decisionRate_bps]}
  #g.caption "Dash Rate Adaptation."
 # g.type 'line_chart3'
 # g.mapping :x_axis => :oml_seq, :y_axis => :decisionRate_bps
 # g.xaxis :legend => 'time [s]'
 # g.yaxis :legend => 'Decision Rate', :ticks => {:format => 's'}
#end

#defGraph 'DashRate2' do |g|
 # g.ms('dashRateAdaptation').select {[:oml_seq, :buffer_percent]}
  #g.caption "VLC Buffer Percentage."
  #g.type 'line_chart3'
  #g.mapping :x_axis => :oml_seq, :y_axis => :buffer_percent
  #g.xaxis :legend => 'time [s]'
  #g.yaxis :legend => 'Buffer Percentage ', :ticks => {:format => 's'}
#end

defGraph 'DashRate3' do |g|
  g.ms('dashDlSession').select {[:oml_seq, :timeChunk_s]}
   g.caption "read Chunk."
   g.type 'line_chart3'
   g.mapping :x_axis => :oml_seq, :y_axis => :timeChunk_s
   g.xaxis :legend => 'time [s]'
   g.yaxis :legend => 'read session [bps] ', :ticks => {:format => 's'}
end

3. Writing an OML Application E.g Layer 2 Ping (aka pingPlus)

3.1 Execute experiment manually on terminal

http://www.gpolab.bbn.com/experiment-support/gec17/pingPlus/pingPlus_v3.tar.gz

How to run pingPlus

root@client:/bin# ./pingPlus fe:16:3e:00:74:38 eth1 10002 5
RQ:'2114+4074' to fe:16:3e:0:74:38.
RL:2114+4074=6188 from fe:16:3e:0:74:38.
RTT = 4.629883

RQ:'6683+0' to fe:16:3e:0:74:38.
RL:6683+0=6683 from fe:16:3e:0:74:38.
RTT = 2.137939

RQ:'8044+1260' to fe:16:3e:0:74:38.
RL:8044+1260=9304 from fe:16:3e:0:74:38.
RTT = 0.438965

RQ:'5016+7303' to fe:16:3e:0:74:38.
RL:5016+7303=12319 from fe:16:3e:0:74:38.
RTT = 0.324951

RQ:'4986+2140' to fe:16:3e:0:74:38.
RL:4986+2140=7126 from fe:16:3e:0:74:38.
RTT = 0.461182

3.2 Parse output to get Measurement points

def process_output(row)
  if not (parse= /RQ:'(?<pktsnt1>\d*)\+(?<pktsnt2>\d*)' to (?<host>[a-f0-9:]*)/.match(row)).nil?
  puts "ReturnQual #{parse[:pktsnt1]}\n" 
  MPrt.inject(parse[:pktsnt1], parse[:pktsnt2],parse[:host])
  
  elsif not (parse= /RL:(?<numofpkt1>\d*)\+(?<numofpkt2>\d*)=(?<totpktrec>\d*) from (?<dest_hw_addr>[a-f0-9:]*)/.match(row)).nil?
  puts "ReturnLength\n"
  p parse
  p MPrl.inject(parse[:numofpkt1],parse[:numofpkt2],parse[:totpktrec],parse[:dest_hw_addr]) 
  
  elsif not (parse = /RTT = (?<rtt>[0-9.]*)/.match(row)).nil?
  puts "RoundTripTime #{parse[:rtt]}\n"
  p parse
  p MPrtt.inject(parse[:rtt])
  end
end

3.3 Write Application Script

#!/usr/bin/ruby1.9.1
require 'rubygems'
require 'oml4r'

class MPrt < OML4R::MPBase
   name :pingrt
   param :pktsnt1, :type => :integer
   param :pktsnt2, :type => :integer
   param :host, :type => :string
end

class MPrl < OML4R::MPBase
   name :pingrl
   param :totpktrec, :type => :integer
   param :numofpkt1, :type => :integer
   param :numofpkt2, :type => :integer
   param :dest_hw_addr, :type => :string
end

class MPrtt < OML4R::MPBase
   name :pingrtt
   param :rtt, :type => :double
end

   


class Pingl2Wrapper

  def initialize(args)
     @addr = nil
     @if_num = ''
     @eth = nil
     @verbose = true
     @numeric = ''
     
     leftover = OML4R::init(args, :appName => 'pingl2') do |argParser|
       argParser.banner = "Runs layer 2 ping and reports measurements via OML\n\n"
       argParser.on("-a" , "--dest_hw_addr ADDRESS", "Hardware address to ping (the -a switch is optional)"){ |address| @addr = address.to_s() }
       argParser.on("-i","--interface IFNUM","Interface number"){ |if_num| @if_num ="#{if_num.to_i()}" }
       argParser.on("-e", "--eth ETHTYPE","Ethernet Type") { |ethtype| @eth = ethtype.to_s() }
       argParser.on("-c","--count NUMBER","Number of pings (default: infinite)"){ |count| @count = "#{count.to_i()}"}
       argParser.on("-q", "--no-quiet ","Don't show layer 2 ping output on console"){ @verbose = false }
       argParser.on("-n", "--[no]-numeric ", "No attempt twill be made to look up symbolic names for host addresses"){ @numeric ='-n' }
    end
    
    if @addr.nil?
      if leftover.length > 0
        @addr = leftover [0]
      else
        raise "You did not specify an address to ping!"
      end
    end
    
end

def process_output(row)
  if not (parse= /RQ:'(?<pktsnt1>\d*)\+(?<pktsnt2>\d*)' to (?<host>[a-f0-9:]*)/.match(row)).nil?
  puts "ReturnQual #{parse[:pktsnt1]}\n" 
  MPrt.inject(parse[:pktsnt1], parse[:pktsnt2],parse[:host])
  
  elsif not (parse= /RL:(?<numofpkt1>\d*)\+(?<numofpkt2>\d*)=(?<totpktrec>\d*) from (?<dest_hw_addr>[a-f0-9:]*)/.match(row)).nil?
  puts "ReturnLength\n"
  p parse
  p MPrl.inject(parse[:numofpkt1],parse[:numofpkt2],parse[:totpktrec],parse[:dest_hw_addr]) 
  
  elsif not (parse = /RTT = (?<rtt>[0-9.]*)/.match(row)).nil?
  puts "RoundTripTime #{parse[:rtt]}\n"
  p parse
  p MPrtt.inject(parse[:rtt])
  end
end
  
def pingl2()
   @pingio = IO.popen("/bin/pingPlus #{@addr} #{@eth} #{@if_num} #{@count}")
   while true
    row = @pingio.readline
    puts row if @verbose
    process_output(row)
    end
end

def start()
    return if not @pingio.nil?
    
    # handle for OMF's exit command
    a = Thread.new do
      $stdin.each do |line|
    if /^exit/ =~ line
      Process.kill("INT",0)    
    end
      end
    end
    
    # Handle Ctrl+C and OMF's SIGTERM
    Signal.trap("INT", stop)
    Signal.trap("TERM", stop)
    
    begin
      pingl2
    rescue EOFError
    
    end
end

def stop()
   return if @pingio.nil?
   # Kill the ping process, which will result in EOFError from ping()
   Process.kill("INT", @pingio.pid)
end

end
begin
  $stderr.puts "INFO\tpingl2 2.11.0\n"
  app = Pingl2Wrapper.new(ARGV)
  app.start()
  sleep 1
rescue Interrupt
rescue Exception => ex
   $stderr.puts "Error\t#{ex}\n"
end



# Local Variables:
# mode:ruby  
# End:
# vim: ft=ruby:sw=2
   

3.4 Write OEDL Script to test application

defProperty('source1', "client-testpingplus", "ID of a resource")
#defProperty('source2', "ig-utah-testBBN", "ID of a resource")
#defProperty('source3', "nodeC-createexoimage", "ID of a resource")
#defProperty('source4', "nodeD-createexoimage", "ID of a resource")
#defProperty('source5', "nodeE-createexoimage", "ID of a resource")
defProperty('graph', true, "Display graph or not")


defProperty('sinkaddr11', 'fe:16:3e:00:74:38', "Ping destination address")
defProperty('eth11','eth1',"Output Eth interface")
defProperty('sinkaddr12', 'fe:16:3e:00:74:38', "Ping destination address")

#defProperty('sinkaddr11', '192.168.6.10', "Ping destination address")
#defProperty('sinkaddr12', '192.168.5.12', "Ping destination address")

#defProperty('sinkaddr21', '192.168.4.11', "Ping destination address")
#defProperty('sinkaddr22', '192.168.2.12', "Ping destination address")
#defProperty('sinkaddr23', '192.168.1.13', "Ping destination address")

#defProperty('sinkaddr31', '192.168.5.11', "Ping destination address")
#defProperty('sinkaddr32', '192.168.2.10', "Ping destination address")
#defProperty('sinkaddr33', '192.168.3.13', "Ping destination address")
#defProperty('sinkaddr34', '192.168.6.14', "Ping destination address")

#defProperty('sinkaddr41', '192.168.1.10', "Ping destination address")
#defProperty('sinkaddr42', '192.168.3.12', "Ping destination address")

#defProperty('sinkaddr51', '192.168.6.12', "Ping destination address")

defApplication('ping') do |app|
  app.description = 'Simple Definition for the pingl2 application'
  # Define the path to the binary executable for this application
  app.binary_path = '/usr/local/bin/pingl2'
  # 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})
  app.defProperty('if_num', 'interface number', '-i', {:type => :integer})
  app.defProperty('eth', 'Ethernet Type', '-e', {:type => :string})
  # 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('hw_dest_addr',:string)
    m.defMetric('rtt',:double)
  end
end
defGroup('Source1', property.source1) do |node|
  node.addApplication("ping") do |app|
    app.setProperty('target', property.sinkaddr11)
    app.setProperty('count', 30)
    app.setProperty('if_num', 10002)
    app.setProperty('eth',property.eth11)
    app.measure('ping', :samples => 1)
  end
end


#defGroup('Source2', property.source2) 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


onEvent(:ALL_UP_AND_INSTALLED) do |event|
  info "Starting the ping"
  after 5 do
    allGroups.startApplications
  end
  after 70 do
    info "Stopping the ping"
    allGroups.stopApplications
    Experiment.done
  end
end

defGraph 'RTT' do |g|
  g.ms('ping').select(:oml_seq, :hw_dest_addr, :rtt) 
  g.caption "RTT of received packets."
  g.type 'line_chart3'
  g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => :hw_dest_addr
  g.xaxis :legend => 'oml_seq'
  g.yaxis :legend => 'rtt', :ticks => {:format => 's'}
end

3.5 Debugging and Testing Application manually on RC

Manually run the command and store data on any location in the RC (/home/dbhat/testpingnow.out)

 env -i /usr/local/bin/pingl2 -a fe:16:3e:00:74:38 -c 5 -i 10002 -e eth1 --oml-id pingl2 --oml-domain tetspingl2 --oml-collect file:/home/dbhat/testpingnow.out

Contents of /home/dbhat/testpingnow.out

protocol: 4
content: text
domain: tetspingl2
start-time: 1387350654
sender-id: pingl2
app-name: pingl2
schema: 0 _experiment_metadata subject:string key:string value:string
schema: 1 pingl2_pingrt pktsnt1:integer pktsnt2:integer host:string
schema: 2 pingl2_pingrl totpktrec:integer numofpkt1:integer numofpkt2:integer dest_hw_addr:string
schema: 3 pingl2_pingrtt rtt:double

0.008326062     1       1       8769    3486    fe:16:3e:0:74:38
0.008561018     2       1       8769    3486    12255   fe:16:3e:0:74:38
0.008747358     3       1       4.083984
0.008879672     1       2       219     3026    fe:16:3e:0:74:38
0.009011919     2       2       8769    3486    12255   fe:16:3e:0:74:38
0.009165199     3       2       1.743896
0.009291544     1       3       1491    6855    fe:16:3e:0:74:38
0.009432851     2       3       1491    6855    8346    fe:16:3e:0:74:38
0.009589396     3       3       0.474121
0.009713862     1       4       7844    9050    fe:16:3e:0:74:38
0.009867939     2       4       1491    6855    8346    fe:16:3e:0:74:38
0.010034998     3       4       0.211914
0.01016508      1       5       2859    901     fe:16:3e:0:74:38
0.010294958     2       5       7844    9050    16894   fe:16:3e:0:74:38
0.010456647     3       5       0.038818

Attachments (3)

Download all attachments as: .zip