-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,405 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# OmfRcOpenflow | ||
|
||
This package includes OMF6 Resource Controllers (RCs) related to the OpenFlow technology. | ||
The OMF6 framework considers everything (hardware, software, etc) as a separate resource. | ||
This version includes the RCs of the Stanford software tools, named FlowVisor and OpenvSwitch. | ||
|
||
* FlowVisor creates OpenFlow Slices (slicing the flow space into separate pieces), so the corresponding RC is the OpenFlow_Slice_Factory. | ||
* OpenvSwitch creates Virtual OpenFlow Switches on top of a Linux machine using the machine's interfaces, so the corresponding RC is the Virtual_OpenFlow_Switch_Factory. | ||
|
||
## Installation | ||
|
||
Add this line to your application's Gemfile: | ||
|
||
gem 'omf_rc_openflow' | ||
|
||
And then execute: | ||
|
||
$ bundle | ||
|
||
Or install it yourself as: | ||
|
||
$ gem install omf_rc_openflow | ||
|
||
## Usage | ||
|
||
In a Linux machine that runs FlowVisor or OpenvSwitch software, execute: | ||
|
||
$ omf_rc_openflow_slice_factory | ||
|
||
Or execute: | ||
|
||
$ omf_rc_virtual_openflow_slice_factory | ||
|
||
to control the FlowVisor or OpenvSwitch resource in a OMF6 Experiment Controller (EC). | ||
|
||
The 'example' subdirectory includes some examples of experiment descriptions, that could be feeded to the omf_ec binary (the OMF6 EC) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "optparse" | ||
require 'omf_rc' | ||
require 'omf_rc/resource_factory' | ||
require 'omf_rc_openflow' | ||
|
||
$stdout.sync = true | ||
|
||
options = { | ||
uid: `hostname`.chomp | ||
} | ||
|
||
executable_name = File.basename($PROGRAM_NAME) | ||
oml_enabled = false | ||
|
||
begin | ||
oml_enabled = OML4R::init(ARGV, :appName => executable_name) do |opts| | ||
opts.banner = "usage: #{executable_name} [options]" | ||
|
||
opts.on("-u USER", "Username") do |user| | ||
options[:user] = user | ||
end | ||
|
||
opts.on("-p PASSWORD", "Password") do |password| | ||
options[:password] = password | ||
end | ||
|
||
opts.on("-s SERVER", "PubSub server") do |server| | ||
options[:server] = server | ||
end | ||
|
||
opts.on("-t TOPIC", "PubSub topic to create, also becomes the uid of the resource, default to hostname") do |topic| | ||
options[:uid] = topic | ||
end | ||
|
||
opts.on("-d", "--debug", "Debug mode") do | ||
options[:debug] = true | ||
end | ||
|
||
opts.on("-l LOG_FILE_DIR", "Write log file to this folder") do |file_dir| | ||
options[:log_file_dir] = file_dir | ||
end | ||
end | ||
rescue => e | ||
# Right now OML4R does not raise proper exceptions :( | ||
# OML4R requires --oml-noop to be set if we want to run without doing any | ||
# measurements... this is too restrictive here, we want to run without OML | ||
# if no OML parameters were set and this even if --oml-noop is not set. | ||
if e.message.include?('OML4R: Missing values for parameters :expID ') | ||
puts "Warning: Missing some OML options to instrument this RC, so it will "+ | ||
"run without instrumentation. (see --oml-help)" | ||
else | ||
puts e.message | ||
exit(1) | ||
end | ||
end | ||
|
||
OmfCommon::Measure.enable if oml_enabled | ||
|
||
unless options[:server] && options[:user] && options[:password] | ||
puts "Error: Missing parameters to connect to a PubSub Server (see --help)" | ||
exit(1) | ||
end | ||
|
||
Logging.logger.root.level = :debug if options[:debug] | ||
Blather.logger = logger | ||
|
||
if options[:log_file_dir] && File.exist?(options[:log_file_dir]) | ||
Logging.logger.root.add_appenders( | ||
Logging.appenders.file( | ||
"#{options[:log_file_dir]}/omf_rc.log", | ||
:layout => Logging.layouts.pattern(:date_pattern => '%F %T %z', | ||
:pattern => '[%d] %-5l %c: %m\n'))) | ||
end | ||
|
||
EM.run do | ||
virtual_openflow_switch_factory = OmfRc::ResourceFactory.new(:virtual_openflow_switch_factory, options) | ||
virtual_openflow_switch_factory | ||
|
||
trap(:INT) { virtual_openflow_switch_factory.disconnect } | ||
trap(:TERM) { virtual_openflow_switch_factory.disconnect } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "optparse" | ||
require 'omf_rc' | ||
require 'omf_rc/resource_factory' | ||
require 'omf_rc_openflow' | ||
|
||
$stdout.sync = true | ||
|
||
options = { | ||
uid: `hostname`.chomp | ||
} | ||
|
||
executable_name = File.basename($PROGRAM_NAME) | ||
oml_enabled = false | ||
|
||
begin | ||
oml_enabled = OML4R::init(ARGV, :appName => executable_name) do |opts| | ||
opts.banner = "usage: #{executable_name} [options]" | ||
|
||
opts.on("-u USER", "Username") do |user| | ||
options[:user] = user | ||
end | ||
|
||
opts.on("-p PASSWORD", "Password") do |password| | ||
options[:password] = password | ||
end | ||
|
||
opts.on("-s SERVER", "PubSub server") do |server| | ||
options[:server] = server | ||
end | ||
|
||
opts.on("-t TOPIC", "PubSub topic to create, also becomes the uid of the resource, default to hostname") do |topic| | ||
options[:uid] = topic | ||
end | ||
|
||
opts.on("-d", "--debug", "Debug mode") do | ||
options[:debug] = true | ||
end | ||
|
||
opts.on("-l LOG_FILE_DIR", "Write log file to this folder") do |file_dir| | ||
options[:log_file_dir] = file_dir | ||
end | ||
end | ||
rescue => e | ||
# Right now OML4R does not raise proper exceptions :( | ||
# OML4R requires --oml-noop to be set if we want to run without doing any | ||
# measurements... this is too restrictive here, we want to run without OML | ||
# if no OML parameters were set and this even if --oml-noop is not set. | ||
if e.message.include?('OML4R: Missing values for parameters :expID ') | ||
puts "Warning: Missing some OML options to instrument this RC, so it will "+ | ||
"run without instrumentation. (see --oml-help)" | ||
else | ||
puts e.message | ||
exit(1) | ||
end | ||
end | ||
|
||
OmfCommon::Measure.enable if oml_enabled | ||
|
||
unless options[:server] && options[:user] && options[:password] | ||
puts "Error: Missing parameters to connect to a PubSub Server (see --help)" | ||
exit(1) | ||
end | ||
|
||
Logging.logger.root.level = :debug if options[:debug] | ||
Blather.logger = logger | ||
|
||
if options[:log_file_dir] && File.exist?(options[:log_file_dir]) | ||
Logging.logger.root.add_appenders( | ||
Logging.appenders.file( | ||
"#{options[:log_file_dir]}/omf_rc.log", | ||
:layout => Logging.layouts.pattern(:date_pattern => '%F %T %z', | ||
:pattern => '[%d] %-5l %c: %m\n'))) | ||
end | ||
|
||
EM.run do | ||
virtual_openflow_switch_factory = OmfRc::ResourceFactory.new(:virtual_openflow_switch_factory, options) | ||
virtual_openflow_switch_factory | ||
|
||
trap(:INT) { virtual_openflow_switch_factory.disconnect } | ||
trap(:TERM) { virtual_openflow_switch_factory.disconnect } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'omf_rc' | ||
require 'omf_rc/resource_factory' | ||
#require 'omf_rc_openflow' | ||
$stdout.sync = true | ||
|
||
Blather.logger = logger | ||
|
||
opts = { | ||
# XMPP server domain | ||
server: 'srv.mytestbed.net', | ||
user: 'flowvisor', | ||
password: 'pw', | ||
uid: 'flowvisor', | ||
# Debug mode of not | ||
debug: false | ||
} | ||
|
||
Logging.logger.root.level = :debug if opts[:debug] | ||
|
||
OmfRc::ResourceFactory.load_addtional_resource_proxies(File.dirname(__FILE__)+"/../lib/omf_rc/resource_proxy") | ||
|
||
EM.run do | ||
# Use resource factory method to initialise a new instance of garage | ||
info "Starting #{opts[:uid]}" | ||
flowvisor = OmfRc::ResourceFactory.new(:openflow_slice_factory, opts) | ||
flowvisor.connect | ||
|
||
# Disconnect garage from XMPP server, when these two signals received | ||
trap(:INT) { flowvisor.disconnect } | ||
trap(:TERM) { flowvisor.disconnect } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.