Changes between Version 1 and Version 2 of GEC19Agenda/GIMI/Procedure/Finish


Ignore:
Timestamp:
03/18/14 13:08:39 (10 years ago)
Author:
divyashri.bhat@gmail.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GEC19Agenda/GIMI/Procedure/Finish

    v1 v2  
    1515</div>
    1616}}}
     17
     18 = 1. Release Resources =
     19After you are done with this experiment, release your resources using the reservation tool of choice. [[BR]]
     20Simply follow the tutorial on [http://groups.geni.net/geni/wiki/GENIExperimenter/Tutorials/PortalSimpleLayer2Example/TeardownExperiment TeardownExperiment] to tear down your experiment and release the resources you reserved.
     21
     22
     23= 2. Sample Applications =
     24
     25Now you can start designing and running your own experiments. Some examples are here:
     26
     27[https://github.com/mytestbed/oml4r/tree/master/examples How to use OML4r]
     28
     29== 2.1 OpenFlow Statistics Measurement ===
     30
     31ofcollect.rb
     32{{{
     33
     34#!/usr/bin/env ruby
     35require 'rubygems'
     36require 'oml4r'
     37require 'file-tail'
     38APPNAME = "ofstats"
     39class MPThroughput < OML4R::MPBase
     40   name :ofthroughput
     41   param :pathtype, :type => :string
     42   param :numflows, :type => :int64
     43   param :numbytes, :type => :int64
     44   param :numpacket, :type => :int64
     45   param :throughput, :type => :int64
     46   param :units,        :type => :string
     47   param :instput, :type => :int64
     48   param :units2,       :type => :string
     49end
     50class OFStatsWrapper
     51  def initialize(args)
     52     @addr = nil
     53     @if_num = ' '
     54     @trema_port = ' '
     55     @trema_path = ' '
     56     @verbose = true
     57     @numeric = ' '
     58     OML4R::init(args, :appName => "#{APPNAME}_wrapper", :domain => 'foo', :collect => 'file:-') {  |argParser|
     59       argParser.banner = "Reports OpenFlow stat measurements via OML\n\n"
     60       argParser.on("-f" , "--file_path ADDRESS", "Path where output is saved"){ |address| @addr = address }
     61       argParser.on("-i","--interface IFNUM","Interface number"){ |if_num| @if_num ="#{if_num.to_i()}" }
     62       argParser.on("-q", "--no-quiet ","Don't show of stats output on console"){ @verbose = false }
     63       argParser.on("-n", "--[no]-numeric ", "No attempt twill be made to look up symbolic names for host addresses"){ @numeric ='-n' }
     64    }
     65     unless @addr !=nil
     66      raise "You did not specify path of file (-p option)"
     67    end
     68end
     69class MyFile < File
     70  include File::Tail
     71end
     72def start()
     73                log = MyFile.new("#{@addr}")
     74                log.interval = @if_num
     75                log.backward(10)
     76                puts "#{@if_num}"
     77                log.tail { |line| print line
     78                processOutput(line)
     79                }
     80end
     81def processOutput(output)
     82  column = output.split(" ")
     83      puts "Each line process"
     84      # Inject the measurements into OML
     85      MPThroughput.inject("#{column[0]}", column[1], column[2],
     86                                column[3], column[4], "#{column[5]}",
     87                                column[6], "#{column[7]}")
     88end
     89end
     90begin
     91  app = OFStatsWrapper.new(ARGV)
     92  app.start()
     93  rescue SystemExit
     94  rescue SignalException
     95     puts "OFWrapper stopped."
     96  rescue Exception => ex
     97  puts "Error - When executing the wrapper application!"
     98  puts "Error - Type: #{ex.class}"
     99  puts "Error - Message: #{ex}\n\n"
     100  # Uncomment the next line to get more info on errors
     101  # puts "Trace - #{ex.backtrace.join("\n\t")}"
     102end
     103OML4R::close()
     104# Local Variables:
     105# mode:ruby
     106# End:
     107# vim: ft=ruby:sw=2
     108}}}