Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Feb 9, 2015
2 parents 1946df4 + a53d0f4 commit 8e5c096
Show file tree
Hide file tree
Showing 25 changed files with 672 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/test/tmp/
/test/version_tmp/
/tmp/
/vendor/

## Specific to RubyMotion:
.dat*
Expand Down
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--require spec_helper
--order random
--color
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Style/StringLiterals:
EnforcedStyle: single_quotes
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
language: ruby

bundler_args: --without development

script: bundle exec rake travis

rvm:
- 2.0
- 2.1
- 2.2
- ruby-head

before_install:
- sudo apt-get update -qq
- sudo apt-get install libpcap-dev -qq
- gem update bundler

matrix:
allow_failures:
- rvm: 2.1
- rvm: ruby-head
fast_finish: true

env:
global:
- secure: EFzZPH/hJYC2cHJ8aBS+C7gUz6eR3AFtdVK8ezPOzm/KHmu5LHhaEO2yjuGZGkc03W5j+qqjjmc8LzrvDxKrNZ+IrsxFh8XDoDHnBso65qowSwKGQPcWqUKOmYTBCAZEPD7HCYh0pUbZBojSuJqWmjQCvsVtRzQov70Iep0/bvA=
- secure: jKt0iIx/lyI+gNEMRDmO64nDWcNX4i6u+T3caGGOy34Ty0ds/ZpGeEpeHVGp/fgaK9MiBMvFNHWvrTeRWf8CuUidVW1cAjq9kGFIWzHyzDbJ/ARmVTZ6UlIrFyFek20sskXLskT//5f44HkZASo9I1yW7E1dYphfLSheifkTdfQ=
33 changes: 33 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
source 'https://rubygems.org'

gem 'phut', github: 'trema/phut', branch: 'develop'
gem 'trema', github: 'trema/trema_ruby', branch: 'develop'

group :development, :test do
gem 'aruba', require: false
gem 'cucumber', require: false
gem 'rspec', require: false
gem 'rspec-given', require: false

gem 'guard', require: false
gem 'guard-bundler', require: false
gem 'guard-cucumber', require: false
gem 'guard-rspec', require: false
gem 'guard-rubocop', require: false

gem 'flay', require: false
gem 'flog', require: false
gem 'reek', require: false
gem 'rubocop', require: false
end

group :development do
gem 'inch', require: false
gem 'yard', require: false
end

# The test group will be installed on Travis CI
group :test do
gem 'codeclimate-test-reporter', require: false
gem 'coveralls', require: false
end
221 changes: 221 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
GIT
remote: git://github.com/trema/phut.git
revision: 91b98a6fa1d2e5342051df2911b0c1ec5d06d262
branch: develop
specs:
phut (0.1.0)
gli (~> 2.12.2)
pio (~> 0.14.0)
pry (~> 0.10.1)

GIT
remote: git://github.com/trema/trema_ruby.git
revision: 82aaa786bab37f853dd5e2aca3a095be35b99658
branch: develop
specs:
trema (0.1.0)
bundler (~> 1.7.12)
gli (~> 2.12.0)
pio (~> 0.14.0)
rake

GEM
remote: https://rubygems.org/
specs:
abstract_type (0.0.7)
adamantium (0.2.0)
ice_nine (~> 0.11.0)
memoizable (~> 0.4.0)
aruba (0.6.2)
childprocess (>= 0.3.6)
cucumber (>= 1.1.1)
rspec-expectations (>= 2.7.0)
ast (2.0.0)
astrolabe (1.3.0)
parser (>= 2.2.0.pre.3, < 3.0)
bindata (2.1.0)
builder (3.2.2)
celluloid (0.16.0)
timers (~> 4.0.0)
childprocess (0.5.5)
ffi (~> 1.0, >= 1.0.11)
codeclimate-test-reporter (0.4.6)
simplecov (>= 0.7.1, < 1.0.0)
coderay (1.1.0)
concord (0.1.5)
adamantium (~> 0.2.0)
equalizer (~> 0.0.9)
coveralls (0.7.9)
multi_json (~> 1.10)
rest-client (~> 1.7)
simplecov (~> 0.9.1)
term-ansicolor (~> 1.3)
thor (~> 0.19.1)
cucumber (1.3.18)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.1)
diff-lcs (1.2.5)
docile (1.1.5)
equalizer (0.0.9)
ffi (1.9.6)
flay (2.6.1)
ruby_parser (~> 3.0)
sexp_processor (~> 4.0)
flog (4.3.2)
ruby_parser (~> 3.1, > 3.1.0)
sexp_processor (~> 4.4)
formatador (0.2.5)
gherkin (2.12.2)
multi_json (~> 1.3)
given_core (3.6.0)
sorcerer (>= 0.3.7)
gli (2.12.2)
guard (2.11.1)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-bundler (2.1.0)
bundler (~> 1.0)
guard (~> 2.2)
guard-compat (~> 1.1)
guard-compat (1.2.1)
guard-cucumber (1.5.3)
cucumber (>= 1.3.0)
guard (>= 2.0.0)
guard-compat (~> 1.0)
nenv (~> 0.1)
guard-rspec (4.5.0)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
guard-rubocop (1.2.0)
guard (~> 2.0)
rubocop (~> 0.20)
hitimes (1.2.2)
ice_nine (0.11.1)
inch (0.5.10)
pry
sparkr (>= 0.2.0)
term-ansicolor
yard (~> 0.8.7.5)
listen (2.8.5)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.9)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
method_source (0.8.2)
mime-types (2.4.3)
multi_json (1.10.1)
multi_test (0.1.1)
nenv (0.2.0)
netrc (0.10.2)
notiffany (0.0.4)
nenv (~> 0.1)
shellany (~> 0.0)
parser (2.2.0.2)
ast (>= 1.1, < 3.0)
pio (0.14.0)
bindata (~> 2.1.0)
powerpack (0.1.0)
procto (0.0.2)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rainbow (2.0.0)
rake (10.4.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
reek (1.6.5)
parser (~> 2.2.0.pre.7)
rainbow (>= 1.99, < 3.0)
unparser (~> 0.2.2)
rest-client (1.7.2)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec (3.2.0)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.0)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-given (3.6.0)
given_core (= 3.6.0)
rspec (>= 2.14.0)
rspec-mocks (3.2.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.1)
rubocop (0.29.0)
astrolabe (~> 1.3)
parser (>= 2.2.0.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-progressbar (1.7.1)
ruby_parser (3.6.4)
sexp_processor (~> 4.1)
sexp_processor (4.4.5)
shellany (0.0.1)
simplecov (0.9.1)
docile (~> 1.1.0)
multi_json (~> 1.0)
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
slop (3.6.0)
sorcerer (1.0.2)
sparkr (0.4.1)
term-ansicolor (1.3.0)
tins (~> 1.0)
thor (0.19.1)
thread_safe (0.3.4)
timers (4.0.1)
hitimes
tins (1.3.4)
unparser (0.2.2)
abstract_type (~> 0.0.7)
adamantium (~> 0.2.0)
concord (~> 0.1.5)
diff-lcs (~> 1.2.5)
equalizer (~> 0.0.9)
parser (~> 2.2.0.2)
procto (~> 0.0.2)
yard (0.8.7.6)

PLATFORMS
ruby

DEPENDENCIES
aruba
codeclimate-test-reporter
coveralls
cucumber
flay
flog
guard
guard-bundler
guard-cucumber
guard-rspec
guard-rubocop
inch
phut!
reek
rspec
rspec-given
rubocop
trema!
yard
15 changes: 15 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
guard :rspec, cmd: 'bundle exec rspec' do
watch(/^spec\/.+_spec\.rb$/)
watch(/^lib\/(.+)\.rb$/) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
end

guard :rubocop do
watch(/.+\.rb$/)
watch(/.+\.rake$/)
watch(/(?:.+\/)?\.rubocop\.yml$/) { |m| File.dirname(m[0]) }
end

guard :bundler do
watch('Gemfile')
end
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,48 @@
learning_switch
Learning Switch
===============

OpenFlow controller that emulates a layer 2 switch
[![Build Status](http://img.shields.io/travis/trema/learning_switch/develop.svg?style=flat)][travis]
[![Coverage Status](http://img.shields.io/coveralls/trema/learning_switch/develop.svg?style=flat)][coveralls]
[![Code Climate](http://img.shields.io/codeclimate/github/trema/learning_switch.svg?style=flat)][codeclimate]
[![Dependency Status](http://img.shields.io/gemnasium/trema/learning_switch.svg?style=flat)][gemnasium]
[![Inline docs](http://inch-ci.org/github/trema/learning_switch.png?branch=develop)][inch]

An OpenFlow controller that controls a single OpenFlow switch and
emulates a layer 2 switch.

[travis]: http://travis-ci.org/trema/learning_switch
[coveralls]: https://coveralls.io/r/trema/learning_switch
[codeclimate]: https://codeclimate.com/github/trema/learning_switch
[gemnasium]: https://gemnasium.com/trema/learning_switch
[inch]: http://inch-ci.org/github/trema/learning_switch

Install
-------

```
$ git clone https://github.com/trema/learning_switch.git
$ cd learning_switch
$ bundle install
```


Play
----

Run this controller:

```
% bundle exec trema run lib/learning_switch.rb -c trema.conf
```

Send some packets from host1 to host2, and show received packet stats
of host2:

```
% bundle exec trema send_packets --source host1 --dest host2 --n_pkts 10
% bundle exec trema show_stats host2 --rx
ip_dst,tp_dst,ip_src,tp_src,n_pkts,n_octets
192.168.0.2,1,192.168.0.1,1,10,500
```

Enjoy!
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
task default: [:spec, :cucumber, :quality]
task quality: [:rubocop, :reek, :flog, :flay]
task travis: [:spec, :quality]

Dir.glob('tasks/*.rake').each { |each| import each }
Loading

0 comments on commit 8e5c096

Please sign in to comment.