Skip to content

Commit

Permalink
Merge branch 'release/0.8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Dec 17, 2014
2 parents d6145fa + 5ca0972 commit 1ece7af
Show file tree
Hide file tree
Showing 151 changed files with 697 additions and 674 deletions.
3 changes: 3 additions & 0 deletions .hound.yml
@@ -0,0 +1,3 @@
ruby:
enabled: true
config_file: .rubocop.yml
3 changes: 3 additions & 0 deletions .rubocop.yml
Expand Up @@ -6,3 +6,6 @@ AllCops:
- examples
- pio.gemspec
- tasks/*.rake

Style/StringLiterals:
EnforcedStyle: single_quotes
14 changes: 7 additions & 7 deletions .travis.yml
Expand Up @@ -5,26 +5,26 @@ bundler_args: --without development

env:
global:
- "KbWY/i2xysF1PMc/51tWxJGinJiUY/zpc32b7MDUwMUrl5IoPA7Ick7prgVaJHau1/ug8lIOwzx9YT+ph/Kej3BFmPkYE4qyCv9m23I4Vlc53qA5jroFUvjuiTpiCE83HiW0xzEhvEMXF35Yusso4RshCpstH3hC/rE90PQxIcM="
- secure: KbWY/i2xysF1PMc/51tWxJGinJiUY/zpc32b7MDUwMUrl5IoPA7Ick7prgVaJHau1/ug8lIOwzx9YT+ph/Kej3BFmPkYE4qyCv9m23I4Vlc53qA5jroFUvjuiTpiCE83HiW0xzEhvEMXF35Yusso4RshCpstH3hC/rE90PQxIcM=
- secure: cbR8GBZyaDxE54pfGkfzhuTQEh3mpcghrx95dL42df3Ei9s3DHCI2Q/yDChUMY3eeqzHUNAt9fPQeDZsMG/aHUrh775bebh28M8zSkUYzv6x1diPnDtywXGutW7MKGak6jw8F+45J6TW4IxNFYMmuWyBu9HOd5VkqWRKvezvqc8=

rvm:
- 1.9.3
- 2.0.0
- 2.1.0
- ruby-head

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

script: bundle exec rake travis

notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/ce8abcdff1f9c912333f
on_success: alawys # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: always # default: false
on_success: alawys
on_failure: always
on_start: always
7 changes: 6 additions & 1 deletion CHANGELOG.md
@@ -1,9 +1,14 @@
# Changelog

## 0.8.2 (12/18/2014)

### Bugs fixed
* [#100](https://github.com/trema/pio/pull/100): Fix bug when passing `ports:` option to `Pio::Features::Request.new`.


## 0.8.1 (6/5/2014)

### Misc

* Updated bundled gems.
* Modernized Gemfile and .gemspec.

Expand Down
4 changes: 1 addition & 3 deletions Gemfile
@@ -1,9 +1,7 @@
# encoding: utf-8

source 'https://rubygems.org'

gemspec development_group: :test

group :development do
gem 'byebug', '~> 3.1.2', platforms: :ruby_20
gem 'byebug', '~> 3.5.1', platforms: :ruby_20
end
7 changes: 1 addition & 6 deletions Guardfile
@@ -1,14 +1,9 @@
# encoding: utf-8

notification :terminal_notifier
notification :tmux, display_message: true

guard :bundler do
watch('Gemfile')
watch(/^.+\.gemspec/)
end

guard :rspec do
guard :rspec, cmd: 'bundle exec rspec' do
watch(%r{^spec/pio/.+_spec\.rb$})
watch(%r{^lib/pio/(.+)\.rb$}) { |m| "spec/pio/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
Expand Down
35 changes: 24 additions & 11 deletions README.md
@@ -1,10 +1,11 @@
# Pio

<a href='https://rubygems.org/gems/pio'><img src='http://img.shields.io/gem/v/pio.svg' alt='Gem Version' /></a>
<a href='https://travis-ci.org/trema/pio'><img src='http://img.shields.io/travis/trema/pio/develop.svg' alt='Build Status' /></a>
<a href='https://codeclimate.com/github/trema/pio'><img src='http://img.shields.io/codeclimate/github/trema/pio.svg' alt='Code Climate' /></a>
<a href='https://coveralls.io/r/trema/pio?branch=develop'><img src='http://img.shields.io/coveralls/trema/pio/develop.svg' alt='Coverage Status' /></a>
<a href='https://gemnasium.com/trema/pio'><img src='https://gemnasium.com/trema/pio.svg' alt='Dependency Status' /></a>
<a href='https://rubygems.org/gems/pio'><img src='http://img.shields.io/gem/v/pio.svg?style=flat' alt='Gem Version' /></a>
<a href='https://travis-ci.org/trema/pio'><img src='http://img.shields.io/travis/trema/pio/develop.svg?style=flat' alt='Build Status' /></a>
<a href='https://codeclimate.com/github/trema/pio'><img src='http://img.shields.io/codeclimate/github/trema/pio.svg?style=flat' alt='Code Climate' /></a>
<a href='https://coveralls.io/r/trema/pio?branch=develop'><img src='http://img.shields.io/coveralls/trema/pio/develop.svg?style=flat' alt='Coverage Status' /></a>
<a href='https://gemnasium.com/trema/pio'><img src='http://img.shields.io/gemnasium/trema/pio.svg?style=flat' alt='Dependency Status' /></a>
<a href='https://gitter.im/trema/pio'><img src='https://badges.gitter.im/Join Chat.svg?style=flat' alt='Gitter Chat' /></a>
<a href="http://inch-pages.github.io/github/trema/pio"><img src="http://inch-pages.github.io/github/trema/pio.svg" alt="Inline docs"></a>

<a href="http://www.flickr.com/photos/mongogushi/4226014070/" title="pio pencil by mongo gushi, on Flickr"><img src="http://farm5.staticflickr.com/4022/4226014070_cdeb7c1e5d_n.jpg" width="320" height="290" alt="pio pencil"></a>
Expand Down Expand Up @@ -228,12 +229,23 @@ generate an Features Request/Reply message like below:

# The Features xid (transaction_id)
# should be same as that of the request.
reply = Pio::Features::Reply.new(xid: request.xid,
dpid: 0x123,
n_buffers: 0x100,
n_tables: 0xfe,
capabilities: 0xc7,
actions: 0xfff)
reply = Pio::Features::Reply.new(
xid: request.xid,
dpid: 0x123,
n_buffers: 0x100,
n_tables: 0xfe,
capabilities: [:flow_stats, :table_stats, :port_stats,
:queue_stats, :arp_match_ip],
actions: [:output, :set_vlan_vid, :set_vlan_pcp, :strip_vlan,
:set_dl_src, :set_dl_dst, :set_nw_src, :set_nw_dst,
:set_nw_tos, :set_tp_src, :set_tp_dst, :enqueue],
ports: [{ port_no: 1,
hardware_address: '11:22:33:44:55:66',
name: 'port123',
config: [:port_down],
state: [:link_down],
curr: [:port_10gb_fd, :port_copper] }]
)
reply.to_binary # => Features Reply message in binary format.

## Installation
Expand Down Expand Up @@ -269,4 +281,5 @@ and install it by running Bundler:
## License

Pio is released under the GNU General Public License version 3.0:

- <http://www.gnu.org/licenses/gpl.html>
11 changes: 6 additions & 5 deletions README.org
Expand Up @@ -5,11 +5,12 @@

* Pio
#+BEGIN_HTML
<a href='https://rubygems.org/gems/pio'><img src='http://img.shields.io/gem/v/pio.svg' alt='Gem Version' /></a>
<a href='https://travis-ci.org/trema/pio'><img src='http://img.shields.io/travis/trema/pio/develop.svg' alt='Build Status' /></a>
<a href='https://codeclimate.com/github/trema/pio'><img src='http://img.shields.io/codeclimate/github/trema/pio.svg' alt='Code Climate' /></a>
<a href='https://coveralls.io/r/trema/pio?branch=develop'><img src='http://img.shields.io/coveralls/trema/pio/develop.svg' alt='Coverage Status' /></a>
<a href='https://gemnasium.com/trema/pio'><img src='https://gemnasium.com/trema/pio.svg' alt='Dependency Status' /></a>
<a href='https://rubygems.org/gems/pio'><img src='http://img.shields.io/gem/v/pio.svg?style=flat' alt='Gem Version' /></a>
<a href='https://travis-ci.org/trema/pio'><img src='http://img.shields.io/travis/trema/pio/develop.svg?style=flat' alt='Build Status' /></a>
<a href='https://codeclimate.com/github/trema/pio'><img src='http://img.shields.io/codeclimate/github/trema/pio.svg?style=flat' alt='Code Climate' /></a>
<a href='https://coveralls.io/r/trema/pio?branch=develop'><img src='http://img.shields.io/coveralls/trema/pio/develop.svg?style=flat' alt='Coverage Status' /></a>
<a href='https://gemnasium.com/trema/pio'><img src='http://img.shields.io/gemnasium/trema/pio.svg?style=flat' alt='Dependency Status' /></a>
<a href='https://gitter.im/trema/pio'><img src='https://badges.gitter.im/Join Chat.svg?style=flat' alt='Gitter Chat' /></a>
<a href="http://inch-pages.github.io/github/trema/pio"><img src="http://inch-pages.github.io/github/trema/pio.svg" alt="Inline docs"></a>
#+END_HTML

Expand Down
2 changes: 0 additions & 2 deletions Rakefile
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'bundler/gem_tasks'

# rubocop:disable HashSyntax
Expand Down
23 changes: 17 additions & 6 deletions examples/features_new.rb
Expand Up @@ -5,10 +5,21 @@

# The Features xid (transaction_id)
# should be same as that of the request.
reply = Pio::Features::Reply.new(xid: request.xid,
dpid: 0x123,
n_buffers: 0x100,
n_tables: 0xfe,
capabilities: 0xc7,
actions: 0xfff)
reply = Pio::Features::Reply.new(
xid: request.xid,
dpid: 0x123,
n_buffers: 0x100,
n_tables: 0xfe,
capabilities: [:flow_stats, :table_stats, :port_stats,
:queue_stats, :arp_match_ip],
actions: [:output, :set_vlan_vid, :set_vlan_pcp, :strip_vlan,
:set_dl_src, :set_dl_dst, :set_nw_src, :set_nw_dst,
:set_nw_tos, :set_tp_src, :set_tp_dst, :enqueue],
ports: [{ port_no: 1,
hardware_address: '11:22:33:44:55:66',
name: 'port123',
config: [:port_down],
state: [:link_down],
curr: [:port_10gb_fd, :port_copper] }]
)
reply.to_binary # => Features Reply message in binary format.
Binary file added features/packet_data/aggregate_stats_reply.raw
Binary file not shown.
Binary file added features/packet_data/aggregate_stats_request.raw
Binary file not shown.
Binary file added features/packet_data/barrier_reply.raw
Binary file not shown.
Binary file added features/packet_data/barrier_request.raw
Binary file not shown.
Binary file added features/packet_data/desc_stats_reply.raw
Binary file not shown.
Binary file added features/packet_data/desc_stats_request.raw
Binary file not shown.
Binary file added features/packet_data/echo_reply.raw
Binary file not shown.
Binary file added features/packet_data/echo_request.raw
Binary file not shown.
Binary file added features/packet_data/error.raw
Binary file not shown.
Binary file modified features/packet_data/features_reply.raw
Binary file not shown.
Binary file added features/packet_data/flow_mod_add.raw
Binary file not shown.
Binary file added features/packet_data/flow_mod_delete.raw
Binary file not shown.
Binary file added features/packet_data/flow_removed.raw
Binary file not shown.
Binary file added features/packet_data/flow_stats_reply.raw
Binary file not shown.
Binary file added features/packet_data/flow_stats_request.raw
Binary file not shown.
Binary file added features/packet_data/get_config_reply.raw
Binary file not shown.
Binary file added features/packet_data/get_config_request.raw
Binary file not shown.
Binary file modified features/packet_data/hello.raw
Binary file not shown.
Binary file added features/packet_data/packet_in.raw
Binary file not shown.
Binary file added features/packet_data/packet_out.raw
Binary file not shown.
Binary file added features/packet_data/port_mod.raw
Binary file not shown.
Binary file added features/packet_data/port_stats_reply.raw
Binary file not shown.
Binary file added features/packet_data/port_stats_request.raw
Binary file not shown.
Binary file added features/packet_data/port_status.raw
Binary file not shown.
Binary file added features/packet_data/queue_get_config_reply.raw
Binary file not shown.
Binary file added features/packet_data/queue_get_config_request.raw
Binary file not shown.
Binary file added features/packet_data/set_config.raw
Binary file not shown.
Binary file added features/packet_data/table_stats_reply.raw
Binary file not shown.
Binary file added features/packet_data/table_stats_request.raw
Binary file not shown.
Binary file added features/packet_data/vendor.raw
Binary file not shown.
Binary file added features/packet_data/vendor_stats_request.raw
Binary file not shown.
2 changes: 0 additions & 2 deletions features/step_definitions/packet_data_steps.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

Given(/^a packet data file "(.*?)"$/) do |name|
path = File.expand_path(File.join(File.dirname(__FILE__),
'..', 'packet_data', name))
Expand Down
2 changes: 0 additions & 2 deletions features/step_definitions/pending_steps.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

Given(/^PENDING/) do
pending
end
2 changes: 0 additions & 2 deletions features/support/env.rb
@@ -1,4 +1,2 @@
# encoding: utf-8

require 'pio'
require 'pio/pcap'
2 changes: 0 additions & 2 deletions lib/pio.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/parse_error'

require 'pio/arp'
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/arp.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/arp/format'
require 'pio/arp/request'
require 'pio/arp/reply'
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/arp/format.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'bindata'
require 'pio/type/ethernet_header'
require 'pio/type/ip_address'
Expand Down
36 changes: 14 additions & 22 deletions lib/pio/arp/message.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'forwardable'
require 'pio/arp/format'

Expand All @@ -9,31 +7,25 @@ class Arp
class Message
extend Forwardable

def_delegators :@frame, :destination_mac
def_delegators :@frame, :source_mac
def_delegators :@frame, :ether_type
def_delegators :@frame, :hardware_type
def_delegators :@frame, :protocol_type
def_delegators :@frame, :hardware_length
def_delegators :@frame, :protocol_length
def_delegators :@frame, :operation
def_delegators :@frame, :sender_hardware_address
def_delegators :@frame, :sender_protocol_address
def_delegators :@frame, :target_hardware_address
def_delegators :@frame, :target_protocol_address
def_delegators :@frame, :to_binary

def self.create_from(frame)
message = allocate
message.instance_variable_set :@frame, frame
message
end
def_delegators :@format, :destination_mac
def_delegators :@format, :source_mac
def_delegators :@format, :ether_type
def_delegators :@format, :hardware_type
def_delegators :@format, :protocol_type
def_delegators :@format, :hardware_length
def_delegators :@format, :protocol_length
def_delegators :@format, :operation
def_delegators :@format, :sender_hardware_address
def_delegators :@format, :sender_protocol_address
def_delegators :@format, :target_hardware_address
def_delegators :@format, :target_protocol_address
def_delegators :@format, :to_binary

private_class_method :new

def initialize(user_options)
options = self.class.const_get(:Options).new(user_options.dup.freeze)
@frame = Arp::Format.new(options.to_hash)
@format = Arp::Format.new(options.to_hash)
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/arp/reply.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/arp/message'
require 'pio/mac'
require 'pio/options'
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/arp/request.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/arp/message'
require 'pio/mac'
require 'pio/options'
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

# Packet parser and generator library.
module Pio
# Dhcp parser and generator.
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/ack.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/dhcp/boot_reply'

module Pio
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/boot_reply.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/dhcp/message'
require 'pio/dhcp/boot_reply_options'

Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/boot_reply_options.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/options'
require 'pio/dhcp/common_options'
require 'pio/dhcp/dhcp_tlv_options'
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/boot_request.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/dhcp/message'
require 'pio/dhcp/boot_request_options'

Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/boot_request_options.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/options'
require 'pio/dhcp/common_options'
require 'pio/dhcp/dhcp_tlv_options'
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/client_id.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/type/mac_address'

module Pio
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/common_options.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

module Pio
class Dhcp
# DHCP Common Options.
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/csum_util.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

module Pio
class Dhcp
# Checksum Calculate Utility.
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/dhcp_field.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/dhcp/optional_tlv'
require 'pio/type/ip_address'
require 'pio/type/mac_address'
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/dhcp_tlv_options.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/dhcp/common_options'

module Pio
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/discover.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/dhcp/boot_request'

module Pio
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/field_util.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

module Pio
class Dhcp
# Dhcp Field Read Methods.
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/frame.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/type/ethernet_header'
require 'pio/type/ipv4_header'
require 'pio/type/udp_header'
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/message.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/dhcp/frame'
require 'forwardable'

Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/offer.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/dhcp/boot_reply'

module Pio
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/optional_tlv.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'pio/dhcp/parameter_list'
require 'pio/dhcp/client_id'
require 'pio/type/ip_address'
Expand Down
2 changes: 0 additions & 2 deletions lib/pio/dhcp/parameter_list.rb
@@ -1,5 +1,3 @@
# encoding: utf-8

require 'bindata'

module Pio
Expand Down

0 comments on commit 1ece7af

Please sign in to comment.