pio 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +20 -13
  4. data/Rakefile +1 -1
  5. data/features/open_flow10/aggregate_stats_reply.feature +17 -0
  6. data/features/open_flow10/aggregate_stats_request.feature +60 -0
  7. data/features/open_flow10/description_stats_reply.feature +18 -0
  8. data/features/open_flow10/{desc_stats_reply.raw → description_stats_reply.raw} +0 -0
  9. data/features/open_flow10/description_stats_request.feature +43 -0
  10. data/features/open_flow10/{desc_stats_request.raw → description_stats_request.raw} +0 -0
  11. data/features/open_flow10/nx_flow_mod_add.raw +0 -0
  12. data/features/open_flow10/nx_flow_mod_delete.raw +0 -0
  13. data/features/open_flow10/nx_flow_mod_delete_strict.raw +0 -0
  14. data/features/open_flow10/nx_flow_mod_modify.raw +0 -0
  15. data/features/open_flow10/nx_flow_mod_modify_strict.raw +0 -0
  16. data/features/open_flow13/stats_request.feature +19 -0
  17. data/features/open_flow_read.feature +24 -18
  18. data/lib/pio/arp/format.rb +1 -0
  19. data/lib/pio/dhcp/ack.rb +1 -0
  20. data/lib/pio/icmp/format.rb +1 -0
  21. data/lib/pio/lldp/chassis_id_tlv.rb +1 -0
  22. data/lib/pio/lldp/frame.rb +1 -0
  23. data/lib/pio/open_flow.rb +4 -4
  24. data/lib/pio/open_flow10.rb +6 -0
  25. data/lib/pio/open_flow10/aggregate_stats_reply.rb +38 -0
  26. data/lib/pio/open_flow10/aggregate_stats_request.rb +42 -0
  27. data/lib/pio/open_flow10/description_stats_reply.rb +35 -0
  28. data/lib/pio/open_flow10/description_stats_request.rb +36 -0
  29. data/lib/pio/open_flow10/error/error_type10.rb +19 -17
  30. data/lib/pio/open_flow10/flow_mod.rb +1 -1
  31. data/lib/pio/open_flow10/flow_stats_reply.rb +1 -1
  32. data/lib/pio/open_flow10/flow_stats_request.rb +1 -1
  33. data/lib/pio/open_flow10/match.rb +1 -1
  34. data/lib/pio/open_flow10/stats_reply.rb +28 -0
  35. data/lib/pio/open_flow10/stats_request.rb +28 -0
  36. data/lib/pio/open_flow13.rb +1 -0
  37. data/lib/pio/open_flow13/features_reply.rb +4 -4
  38. data/lib/pio/open_flow13/features_request.rb +0 -4
  39. data/lib/pio/open_flow13/meter.rb +1 -1
  40. data/lib/pio/open_flow13/stats_request.rb +53 -0
  41. data/lib/pio/version.rb +1 -1
  42. metadata +33 -8
  43. data/features/step_definitions/Gemfile.lock +0 -76
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97e01dadf109d6b2d380ce8a5594f28e74ef1ad5
4
- data.tar.gz: e66083b080b1734bd0d080a9d8ebc7ea20b2113d
3
+ metadata.gz: 4ac567d11a76df3274344c3e5ddb963879f8381a
4
+ data.tar.gz: 08fdbed8c63e7abf6a75079bdca6f497977e505e
5
5
  SHA512:
6
- metadata.gz: e4be4e2c7008ef74af834e751ddb540e81e82282ac53384049da01767106f13eb55741a658968dbb4a661b40d4bcf999724105a55932c848dd78415c96a3372d
7
- data.tar.gz: c7e70a342c16e90f4a167cfaca3e3898367a604d26fa188958d44c8e1d8ce78b59b7f749dcfcbfa07bf19b28c6cf1651348afd1620bda7b00c9065086400b317
6
+ metadata.gz: c15052c6d83a106474ef2df7495a583f00e8bbf19a64cea87b743362853dec11da2ee13d87b6cf282626ff215924f9c81179e11dbfa924097d73138c6ef65e26
7
+ data.tar.gz: 13039d0174785fecc8e0bb1f9ccd1e16390a91b397e021a624a49d1e743b8859f8194fe074b2a994fa78d90ef357e04f50ffc1dd4e384a193907bc7e7597f5ac
data/CHANGELOG.md CHANGED
@@ -3,6 +3,11 @@
3
3
  ## develop (unreleased)
4
4
 
5
5
 
6
+ ## 0.27.0 (9/16/2015)
7
+ ### New features
8
+ * [#203](https://github.com/trema/pio/pull/203): Add new classes `Pio::OpenFlow10::DescriptionStats::Request`, `Pio::OpenFlow10::DescriptionStats::Reply`, `Pio::OpenFlow10::FlowStats::Request`, `Pio::OpenFlow10::FlowStats::Reply`, `Pio::OpenFlow10::AggregateStats::Request`, `Pio::OpenFlow10::AggregateStats::Reply`.
9
+
10
+
6
11
  ## 0.26.0 (9/8/2015)
7
12
  ### New features
8
13
  * [#214](https://github.com/trema/pio/pull/214): Add new class `Pio::OpenFlow10::Error::HelloFailed`.
data/README.md CHANGED
@@ -10,8 +10,21 @@
10
10
 
11
11
  <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>
12
12
 
13
- Pio is a ruby gem to easily parse and generate network packets. It
14
- supports the following packet formats:
13
+ Pio is a ruby gem to easily parse and generate network packets.
14
+
15
+ ## Features Overview
16
+
17
+ - Pure Ruby. No additional dependency on other external tools to
18
+ parse/generate packets.
19
+ - Multi-Platform. Runs on major operating systems (recent Windows,
20
+ Linux, and MacOSX).
21
+ - Clean Code. Pio is built on
22
+ [BinData](https://github.com/dmendel/bindata)'s declarative binary
23
+ format DSL so that it is easy to read and debug by human beings.
24
+
25
+ ## Supported packet formats
26
+
27
+ Pio supports the following packet formats:
15
28
 
16
29
  - [ICMP](https://relishapp.com/trema/pio/docs/pio-icmp)
17
30
  - [ARP](https://relishapp.com/trema/pio/docs/pio-arp)
@@ -33,8 +46,12 @@ supports the following packet formats:
33
46
  - [Exact Match](https://relishapp.com/trema/pio/docs/open-flow10/pio-exactmatch)
34
47
  - [Barrier Request](https://relishapp.com/trema/pio/docs/open-flow10/pio-barrier-request)
35
48
  - [Barrier Reply](https://relishapp.com/trema/pio/docs/open-flow10/pio-barrier-reply)
49
+ - [Description Stats Request](https://relishapp.com/trema/pio/docs/open-flow10/pio-descriptionstats-request)
50
+ - [Description Stats Reply](https://relishapp.com/trema/pio/docs/open-flow10/pio-descriptionstats-reply)
36
51
  - [Flow Stats Request](https://relishapp.com/trema/pio/docs/open-flow10/pio-flowstats-request)
37
52
  - [Flow Stats Reply](https://relishapp.com/trema/pio/docs/open-flow10/pio-flowstats-reply)
53
+ - [Aggregate Stats Request](https://relishapp.com/trema/pio/docs/open-flow10/pio-aggregatestats-request)
54
+ - [Aggregate Stats Reply](https://relishapp.com/trema/pio/docs/open-flow10/pio-aggregatestats-reply)
38
55
  - OpenFlow 1.3
39
56
  - [Hello](https://relishapp.com/trema/pio/docs/open-flow13/pio-hello)
40
57
  - [HelloFailed](https://relishapp.com/trema/pio/docs/open-flow13/pio-error-hellofailed)
@@ -47,16 +64,6 @@ supports the following packet formats:
47
64
  - [Packet Out](https://relishapp.com/trema/pio/docs/open-flow13/pio-packetout)
48
65
  - [Flow Mod](https://relishapp.com/trema/pio/docs/open-flow13/pio-flowmod)
49
66
 
50
- ## Features Overview
51
-
52
- - Pure Ruby. No additional dependency on other external tools to
53
- parse/generate packets.
54
- - Multi-Platform. Runs on major operating systems (recent Windows,
55
- Linux, and MacOSX).
56
- - Clean Code. Pio is built on
57
- [BinData](https://github.com/dmendel/bindata)'s declarative binary
58
- format DSL so that it is easy to read and debug by human beings.
59
-
60
67
  ## Installation
61
68
 
62
69
  The simplest way to install Pio is to use [Bundler](http://gembundler.com/).
@@ -75,7 +82,7 @@ bundle
75
82
 
76
83
  ## Documents
77
84
 
78
- - [API document generated with YARD](http://rubydoc.info/github/trema/pio/frames/file/README.md)
85
+ - [API document](https://relishapp.com/trema/pio/docs)
79
86
 
80
87
  ## Team
81
88
 
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'bundler/gem_tasks'
2
2
 
3
3
  RELISH_PROJECT = 'trema/pio'
4
- FLAY_THRESHOLD = 863
4
+ FLAY_THRESHOLD = 919
5
5
 
6
6
  task default: :travis
7
7
  task test: [:spec, :cucumber]
@@ -0,0 +1,17 @@
1
+ @open_flow10
2
+ Feature: Pio::AggregateStats::Reply
3
+ Scenario: read
4
+ When I try to parse a file named "open_flow10/aggregate_stats_reply.raw" with "AggregateStats::Reply" class
5
+ Then it should finish successfully
6
+ And the message has the following fields and values:
7
+ | field | value |
8
+ | ofp_version | 1 |
9
+ | message_type | 17 |
10
+ | length | 36 |
11
+ | transaction_id | 15 |
12
+ | xid | 15 |
13
+ | stats_type | :aggregate |
14
+ | flags | 0 |
15
+ | packet_count | 0 |
16
+ | byte_count | 0 |
17
+ | flow_count | 0 |
@@ -0,0 +1,60 @@
1
+ @open_flow10
2
+ Feature: Pio::AggregateStats::Request
3
+ Scenario: new
4
+ When I try to create an OpenFlow message with:
5
+ """
6
+ Pio::AggregateStats::Request.new(match: Match.new(in_port: 1))
7
+ """
8
+ Then it should finish successfully
9
+ And the message has the following fields and values:
10
+ | field | value |
11
+ | ofp_version | 1 |
12
+ | message_type | 16 |
13
+ | length | 56 |
14
+ | transaction_id | 0 |
15
+ | xid | 0 |
16
+ | stats_type | :aggregate |
17
+ | match.in_port | 1 |
18
+ | match.wildcards.keys.size | 11 |
19
+ | match.wildcards.fetch(:ether_destination_address) | true |
20
+ | match.wildcards.fetch(:ether_source_address) | true |
21
+ | match.wildcards.fetch(:ether_type) | true |
22
+ | match.wildcards.fetch(:ip_destination_address_all) | true |
23
+ | match.wildcards.fetch(:ip_protocol) | true |
24
+ | match.wildcards.fetch(:ip_source_address_all) | true |
25
+ | match.wildcards.fetch(:ip_tos) | true |
26
+ | match.wildcards.fetch(:transport_destination_port) | true |
27
+ | match.wildcards.fetch(:transport_source_port) | true |
28
+ | match.wildcards.fetch(:vlan_priority) | true |
29
+ | match.wildcards.fetch(:vlan_vid) | true |
30
+ | table_id.to_hex | 0xff |
31
+ | out_port | :none |
32
+
33
+
34
+ Scenario: read
35
+ When I try to parse a file named "open_flow10/aggregate_stats_request.raw" with "AggregateStats::Request" class
36
+ Then it should finish successfully
37
+ And the message has the following fields and values:
38
+ | field | value |
39
+ | ofp_version | 1 |
40
+ | message_type | 16 |
41
+ | length | 56 |
42
+ | transaction_id | 14 |
43
+ | xid | 14 |
44
+ | stats_type | :aggregate |
45
+ | match.wildcards.keys.size | 12 |
46
+ | match.wildcards.fetch(:ether_destination_address) | true |
47
+ | match.wildcards.fetch(:ether_source_address) | true |
48
+ | match.wildcards.fetch(:ether_type) | true |
49
+ | match.wildcards.fetch(:in_port) | true |
50
+ | match.wildcards.fetch(:ip_destination_address_all) | true |
51
+ | match.wildcards.fetch(:ip_protocol) | true |
52
+ | match.wildcards.fetch(:ip_source_address_all) | true |
53
+ | match.wildcards.fetch(:ip_tos) | true |
54
+ | match.wildcards.fetch(:transport_destination_port) | true |
55
+ | match.wildcards.fetch(:transport_source_port) | true |
56
+ | match.wildcards.fetch(:vlan_priority) | true |
57
+ | match.wildcards.fetch(:vlan_vid) | true |
58
+ | table_id.to_hex | 0xff |
59
+ | out_port | :none |
60
+
@@ -0,0 +1,18 @@
1
+ @open_flow10
2
+ Feature: Pio::DescriptionStats::Reply
3
+ Scenario: read
4
+ When I try to parse a file named "open_flow10/description_stats_reply.raw" with "DescriptionStats::Reply" class
5
+ Then it should finish successfully
6
+ And the message has the following fields and values:
7
+ | field | value |
8
+ | ofp_version | 1 |
9
+ | message_type | 17 |
10
+ | length | 1068 |
11
+ | transaction_id | 12 |
12
+ | xid | 12 |
13
+ | stats_type | :description |
14
+ | manufacturer | Nicira, Inc. |
15
+ | hardware | |
16
+ | software | |
17
+ | serial_number | |
18
+ | datapath | |
@@ -0,0 +1,43 @@
1
+ @open_flow10
2
+ Feature: Pio::DescriptionStats::Request
3
+ Scenario: new
4
+ When I try to create an OpenFlow message with:
5
+ """
6
+ Pio::DescriptionStats::Request.new
7
+ """
8
+ Then it should finish successfully
9
+ And the message has the following fields and values:
10
+ | field | value |
11
+ | ofp_version | 1 |
12
+ | message_type | 16 |
13
+ | length | 12 |
14
+ | transaction_id | 0 |
15
+ | xid | 0 |
16
+ | stats_type | :description |
17
+
18
+ Scenario: new(transaction_id: 123)
19
+ When I try to create an OpenFlow message with:
20
+ """
21
+ Pio::DescriptionStats::Request.new(transaction_id: 123)
22
+ """
23
+ Then it should finish successfully
24
+ And the message has the following fields and values:
25
+ | field | value |
26
+ | ofp_version | 1 |
27
+ | message_type | 16 |
28
+ | length | 12 |
29
+ | transaction_id | 123 |
30
+ | xid | 123 |
31
+ | stats_type | :description |
32
+
33
+ Scenario: read
34
+ When I try to parse a file named "open_flow10/description_stats_request.raw" with "DescriptionStats::Request" class
35
+ Then it should finish successfully
36
+ And the message has the following fields and values:
37
+ | field | value |
38
+ | ofp_version | 1 |
39
+ | message_type | 16 |
40
+ | length | 12 |
41
+ | transaction_id | 12 |
42
+ | xid | 12 |
43
+ | stats_type | :description |
@@ -0,0 +1,19 @@
1
+ Feature: Pio::StatsRequest
2
+ Background:
3
+ Given I use OpenFlow 1.3
4
+
5
+ @wip
6
+ Scenario: new
7
+ When I try to create an OpenFlow message with:
8
+ """
9
+ Pio::StatsRequest.new(stats_type: :table)
10
+ """
11
+ Then it should finish successfully
12
+ And the message has the following fields and values:
13
+ | field | value |
14
+ | ofp_version | 4 |
15
+ | message_type | 16 |
16
+ | message_length | 12 |
17
+ | transaction_id | 0 |
18
+ | xid | 0 |
19
+ | stats_type | :table |
@@ -2,21 +2,27 @@ Feature: Pio::OpenFlow.read
2
2
  Scenario: OpenFlow10
3
3
  Given I switch the Pio::OpenFlow version to "OpenFlow10"
4
4
  Then the following each raw file should be parsed into its corresponding object using OpenFlow.read
5
- | raw file | result object |
6
- | open_flow10/hello.raw | Pio::OpenFlow10::Hello |
7
- | open_flow10/hello_failed.raw | Pio::OpenFlow10::Error::HelloFailed |
8
- | open_flow13/hello_failed.raw | Pio::OpenFlow13::Error::HelloFailed |
9
- | open_flow10/bad_request.raw | Pio::OpenFlow10::Error::BadRequest |
10
- | open_flow13/bad_request.raw | Pio::OpenFlow13::Error::BadRequest |
11
- | open_flow10/echo_request.raw | Pio::OpenFlow10::Echo::Request |
12
- | open_flow10/echo_reply.raw | Pio::OpenFlow10::Echo::Reply |
13
- | open_flow10/features_request.raw | Pio::OpenFlow10::Features::Request |
14
- | open_flow10/features_reply.raw | Pio::OpenFlow10::Features::Reply |
15
- | open_flow10/packet_in.raw | Pio::OpenFlow10::PacketIn |
16
- | open_flow10/packet_out.raw | Pio::OpenFlow10::PacketOut |
17
- | open_flow10/flow_mod_add.raw | Pio::OpenFlow10::FlowMod |
18
- | open_flow10/port_status.raw | Pio::OpenFlow10::PortStatus |
19
- | open_flow10/barrier_request.raw | Pio::OpenFlow10::Barrier::Request |
20
- | open_flow10/barrier_reply.raw | Pio::OpenFlow10::Barrier::Reply |
21
- | open_flow10/flow_stats_request.raw | Pio::OpenFlow10::FlowStats::Request |
22
- | open_flow10/flow_stats_reply.raw | Pio::OpenFlow10::FlowStats::Reply |
5
+ | raw file | result object |
6
+ | open_flow10/aggregate_stats_reply.raw | Pio::OpenFlow10::AggregateStats::Reply |
7
+ | open_flow10/aggregate_stats_request.raw | Pio::OpenFlow10::AggregateStats::Request |
8
+ | open_flow10/bad_request.raw | Pio::OpenFlow10::Error::BadRequest |
9
+ | open_flow10/barrier_reply.raw | Pio::OpenFlow10::Barrier::Reply |
10
+ | open_flow10/barrier_request.raw | Pio::OpenFlow10::Barrier::Request |
11
+ | open_flow10/description_stats_reply.raw | Pio::OpenFlow10::DescriptionStats::Reply |
12
+ | open_flow10/description_stats_request.raw | Pio::OpenFlow10::DescriptionStats::Request |
13
+ | open_flow10/echo_reply.raw | Pio::OpenFlow10::Echo::Reply |
14
+ | open_flow10/echo_request.raw | Pio::OpenFlow10::Echo::Request |
15
+ | open_flow10/features_reply.raw | Pio::OpenFlow10::Features::Reply |
16
+ | open_flow10/features_request.raw | Pio::OpenFlow10::Features::Request |
17
+ | open_flow10/flow_mod_add.raw | Pio::OpenFlow10::FlowMod |
18
+ | open_flow10/flow_stats_reply.raw | Pio::OpenFlow10::FlowStats::Reply |
19
+ | open_flow10/flow_stats_reply.raw | Pio::OpenFlow10::FlowStats::Reply |
20
+ | open_flow10/flow_stats_request.raw | Pio::OpenFlow10::FlowStats::Request |
21
+ | open_flow10/flow_stats_request.raw | Pio::OpenFlow10::FlowStats::Request |
22
+ | open_flow10/hello.raw | Pio::OpenFlow10::Hello |
23
+ | open_flow10/hello_failed.raw | Pio::OpenFlow10::Error::HelloFailed |
24
+ | open_flow10/packet_in.raw | Pio::OpenFlow10::PacketIn |
25
+ | open_flow10/packet_out.raw | Pio::OpenFlow10::PacketOut |
26
+ | open_flow10/port_status.raw | Pio::OpenFlow10::PortStatus |
27
+ | open_flow13/bad_request.raw | Pio::OpenFlow13::Error::BadRequest |
28
+ | open_flow13/hello_failed.raw | Pio::OpenFlow13::Error::HelloFailed |
@@ -4,6 +4,7 @@ require 'pio/type/ip_address'
4
4
  require 'pio/type/mac_address'
5
5
 
6
6
  module Pio
7
+ # ARP parser and generator.
7
8
  class Arp
8
9
  # ARP parser.
9
10
  class Format < BinData::Record
data/lib/pio/dhcp/ack.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'pio/dhcp/boot_reply'
2
2
 
3
3
  module Pio
4
+ # Dhcp parser and generator.
4
5
  class Dhcp
5
6
  # Dhcp Ack packet generator
6
7
  class Ack < BootReply
@@ -3,6 +3,7 @@ require 'pio/ethernet_header'
3
3
  require 'pio/ipv4_header'
4
4
 
5
5
  module Pio
6
+ # Icmp parser and generator.
6
7
  class Icmp
7
8
  # Icmp parser.
8
9
  class Format < BinData::Record
@@ -1,6 +1,7 @@
1
1
  require 'bindata'
2
2
 
3
3
  module Pio
4
+ # LLDP frame parser and generator.
4
5
  class Lldp
5
6
  # Chassis ID TLV
6
7
  class ChassisIdTlv < BinData::Primitive
@@ -7,6 +7,7 @@ require 'pio/lldp/port_id_tlv'
7
7
  require 'pio/lldp/ttl_tlv'
8
8
 
9
9
  module Pio
10
+ # LLDP frame parser and generator.
10
11
  class Lldp
11
12
  # LLDP frame
12
13
  class Frame < BinData::Record
data/lib/pio/open_flow.rb CHANGED
@@ -17,8 +17,8 @@ module Pio
17
17
 
18
18
  def self.switch_version(version)
19
19
  [:Barrier, :Echo, :Features, :FlowMod, :Hello, :Match,
20
- :PacketIn, :PacketOut, :SendOutPort, :PortStatus,
21
- :FlowStats, :Error].each do |each|
20
+ :PacketIn, :PacketOut, :SendOutPort, :PortStatus, :Stats,
21
+ :FlowStats, :DescriptionStats, :AggregateStats, :Error].each do |each|
22
22
  set_message_class_name each, version
23
23
  @version = version.to_s
24
24
  end
@@ -37,8 +37,8 @@ module Pio
37
37
  12 => Pio::PortStatus,
38
38
  13 => Pio::PacketOut,
39
39
  14 => Pio::FlowMod,
40
- 16 => Pio::FlowStats::Request,
41
- 17 => Pio::FlowStats::Reply,
40
+ 16 => Pio::Stats::Request,
41
+ 17 => Pio::Stats::Reply,
42
42
  18 => Pio::Barrier::Request,
43
43
  19 => Pio::Barrier::Reply
44
44
  }
@@ -1,5 +1,9 @@
1
+ require 'pio/open_flow10/aggregate_stats_reply.rb'
2
+ require 'pio/open_flow10/aggregate_stats_request.rb'
1
3
  require 'pio/open_flow10/barrier_reply'
2
4
  require 'pio/open_flow10/barrier_request'
5
+ require 'pio/open_flow10/description_stats_reply'
6
+ require 'pio/open_flow10/description_stats_request'
3
7
  require 'pio/open_flow10/echo'
4
8
  require 'pio/open_flow10/error'
5
9
  require 'pio/open_flow10/error/bad_request'
@@ -16,3 +20,5 @@ require 'pio/open_flow10/phy_port16'
16
20
  require 'pio/open_flow10/port16'
17
21
  require 'pio/open_flow10/port_status'
18
22
  require 'pio/open_flow10/send_out_port'
23
+ require 'pio/open_flow10/stats_reply'
24
+ require 'pio/open_flow10/stats_request'
@@ -0,0 +1,38 @@
1
+ require 'pio/open_flow10/stats_type'
2
+
3
+ # Base module.
4
+ module Pio
5
+ # OpenFlow 1.0 messages
6
+ module OpenFlow10
7
+ # Aggregate Stats messages
8
+ module AggregateStats
9
+ # Aggregate Stats Reply message
10
+ class Reply < OpenFlow::Message
11
+ # Message body of Flow Stats Request.
12
+ class Body < BinData::Record
13
+ endian :big
14
+
15
+ stats_type :stats_type, value: -> { :aggregate }
16
+ uint16 :flags
17
+ uint64 :packet_count
18
+ uint64 :byte_count
19
+ uint32 :flow_count
20
+ string :padding, length: 4
21
+ hide :padding
22
+
23
+ def length
24
+ 24
25
+ end
26
+ end
27
+
28
+ # Aggregate Stats Reply message format.
29
+ class Format < BinData::Record
30
+ extend OpenFlow::Format
31
+
32
+ header version: 1, message_type: 17
33
+ body :body
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,42 @@
1
+ require 'pio/open_flow10/match'
2
+ require 'pio/open_flow10/port16'
3
+ require 'pio/open_flow10/stats_type'
4
+
5
+ # Base module.
6
+ module Pio
7
+ # OpenFlow 1.0 messages
8
+ module OpenFlow10
9
+ # OpenFlow 1.0 Aggregate Stats messages
10
+ module AggregateStats
11
+ # OpenFlow 1.0 Aggregate Stats Request message
12
+ class Request < OpenFlow::Message
13
+ # Message body of Flow Stats Request.
14
+ class Body < BinData::Record
15
+ endian :big
16
+
17
+ stats_type :stats_type, value: -> { :aggregate }
18
+ uint16 :flags
19
+ match10 :match
20
+ uint8 :table_id, initial_value: 0xff
21
+ string :padding, length: 1
22
+ hide :padding
23
+ port16 :out_port, initial_value: -> { :none }
24
+
25
+ def length
26
+ 48
27
+ end
28
+ end
29
+
30
+ # OpenFlow 1.0 Aggregate Stats Request message format.
31
+ class Format < BinData::Record
32
+ extend OpenFlow::Format
33
+
34
+ header version: 1, message_type: 16
35
+ body :body
36
+ end
37
+
38
+ body_option :match
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,35 @@
1
+ require 'pio/open_flow10/stats_type'
2
+
3
+ # Base module.
4
+ module Pio
5
+ # OpenFlow 1.0 messages
6
+ module OpenFlow10
7
+ # OpenFlow 1.0 Description Stats messages
8
+ module DescriptionStats
9
+ # OpenFlow 1.0 Description Stats Reply message
10
+ class Reply < OpenFlow::Message
11
+ # Message body of Flow Stats Reply.
12
+ class Body < BinData::Record
13
+ endian :big
14
+
15
+ stats_type :stats_type, value: -> { :description }
16
+ uint16 :flags
17
+
18
+ stringz :manufacturer, length: 256
19
+ stringz :hardware, length: 256
20
+ stringz :software, length: 256
21
+ stringz :serial_number, length: 32
22
+ stringz :datapath, length: 256
23
+ end
24
+
25
+ # OpenFlow 1.0 Description Stats Reply message format.
26
+ class Format < BinData::Record
27
+ extend OpenFlow::Format
28
+
29
+ header version: 1, message_type: 17
30
+ body :body
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,36 @@
1
+ require 'pio/open_flow10/stats_type'
2
+ require 'pio/open_flow/format'
3
+ require 'pio/open_flow/message'
4
+
5
+ # Base module.
6
+ module Pio
7
+ # OpenFlow 1.0 messages
8
+ module OpenFlow10
9
+ # OpenFlow 1.0 Description Stats messages
10
+ module DescriptionStats
11
+ # OpenFlow 1.0 Description Stats Request message
12
+ class Request < OpenFlow::Message
13
+ # Message body of Flow Stats Request.
14
+ class Body < BinData::Record
15
+ endian :big
16
+
17
+ stats_type :stats_type, value: -> { :description }
18
+ uint16 :flags
19
+ string :body, value: ''
20
+
21
+ def length
22
+ 4
23
+ end
24
+ end
25
+
26
+ # OpenFlow 1.0 Description Stats Request message format.
27
+ class Format < BinData::Record
28
+ extend OpenFlow::Format
29
+
30
+ header version: 1, message_type: 16
31
+ body :body
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,25 +1,27 @@
1
1
  module Pio
2
2
  module OpenFlow10
3
- # enum ofp_error_type
4
- class ErrorType10 < BinData::Primitive
5
- ERROR_TYPES = {
6
- hello_failed: 0,
7
- bad_request: 1,
8
- bad_action: 2,
9
- flow_mod_failed: 3,
10
- port_mod_failed: 4,
11
- queue_operation_failed: 5
12
- }
3
+ module Error
4
+ # enum ofp_error_type
5
+ class ErrorType10 < BinData::Primitive
6
+ ERROR_TYPES = {
7
+ hello_failed: 0,
8
+ bad_request: 1,
9
+ bad_action: 2,
10
+ flow_mod_failed: 3,
11
+ port_mod_failed: 4,
12
+ queue_operation_failed: 5
13
+ }
13
14
 
14
- endian :big
15
- uint16 :error_type
15
+ endian :big
16
+ uint16 :error_type
16
17
 
17
- def get
18
- ERROR_TYPES.invert.fetch(error_type)
19
- end
18
+ def get
19
+ ERROR_TYPES.invert.fetch(error_type)
20
+ end
20
21
 
21
- def set(value)
22
- self.error_type = ERROR_TYPES.fetch(value)
22
+ def set(value)
23
+ self.error_type = ERROR_TYPES.fetch(value)
24
+ end
23
25
  end
24
26
  end
25
27
  end
@@ -40,7 +40,7 @@ module Pio
40
40
 
41
41
  endian :big
42
42
 
43
- match_open_flow10 :match
43
+ match10 :match
44
44
  uint64 :cookie
45
45
  command :command
46
46
  uint16 :idle_timeout
@@ -17,7 +17,7 @@ module Pio
17
17
  uint8 :table_id
18
18
  string :padding1, length: 1
19
19
  hide :padding1
20
- match_open_flow10 :match
20
+ match10 :match
21
21
  uint32 :duration_sec
22
22
  uint32 :duration_nsec
23
23
  uint16 :priority
@@ -15,7 +15,7 @@ module Pio
15
15
  class FlowStatsRequestBody < BinData::Record
16
16
  endian :big
17
17
 
18
- match_open_flow10 :match
18
+ match10 :match
19
19
  uint8 :table_id, initial_value: 0xff
20
20
  string :padding, length: 1
21
21
  hide :padding
@@ -163,7 +163,7 @@ module Pio
163
163
  end
164
164
 
165
165
  # Pio::MatchFormat wrapper.
166
- class MatchOpenFlow10 < BinData::Primitive
166
+ class Match10 < BinData::Primitive
167
167
  endian :big
168
168
 
169
169
  string :match,
@@ -0,0 +1,28 @@
1
+ module Pio
2
+ module OpenFlow10
3
+ class Stats
4
+ # Stats reply parser.
5
+ class Reply
6
+ # Stats reply format.
7
+ class Format < BinData::Record
8
+ extend OpenFlow::Format
9
+
10
+ header version: 1, message_type: 17
11
+ stats_type :stats_type
12
+ end
13
+
14
+ TYPES = {
15
+ description: OpenFlow10::DescriptionStats::Reply,
16
+ flow: OpenFlow10::FlowStats::Reply,
17
+ aggregate: OpenFlow10::AggregateStats::Reply
18
+ }
19
+
20
+ def self.read(binary)
21
+ TYPES.fetch(Format.read(binary).stats_type.to_sym).read(binary)
22
+ rescue KeyError
23
+ raise "Unknown stats type: #{stats_type}"
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ module Pio
2
+ module OpenFlow10
3
+ class Stats
4
+ # Stats request parser.
5
+ class Request
6
+ # Stats request format.
7
+ class Format < BinData::Record
8
+ extend OpenFlow::Format
9
+
10
+ header version: 1, message_type: 16
11
+ stats_type :stats_type
12
+ end
13
+
14
+ TYPES = {
15
+ description: OpenFlow10::DescriptionStats::Request,
16
+ flow: OpenFlow10::FlowStats::Request,
17
+ aggregate: OpenFlow10::AggregateStats::Request
18
+ }
19
+
20
+ def self.read(binary)
21
+ TYPES.fetch(Format.read(binary).stats_type.to_sym).read(binary)
22
+ rescue KeyError
23
+ raise "Unknown stats type: #{stats_type}"
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -12,4 +12,5 @@ require 'pio/open_flow13/meter'
12
12
  require 'pio/open_flow13/packet_in'
13
13
  require 'pio/open_flow13/packet_out'
14
14
  require 'pio/open_flow13/send_out_port'
15
+ require 'pio/open_flow13/stats_request'
15
16
  require 'pio/open_flow13/write_metadata'
@@ -36,6 +36,10 @@ module Pio
36
36
  capabilities :capabilities
37
37
  uint32 :reserved
38
38
 
39
+ def dpid
40
+ datapath_id
41
+ end
42
+
39
43
  def length
40
44
  24
41
45
  end
@@ -45,10 +49,6 @@ module Pio
45
49
 
46
50
  header version: 4, message_type: 6
47
51
  body :body
48
-
49
- def dpid
50
- datapath_id
51
- end
52
52
  end
53
53
 
54
54
  body_option :dpid
@@ -14,10 +14,6 @@ module Pio
14
14
 
15
15
  header version: 4, message_type: 5
16
16
  string :body, value: ''
17
-
18
- def user_data
19
- body
20
- end
21
17
  end
22
18
  end
23
19
  end
@@ -2,7 +2,7 @@ require 'forwardable'
2
2
 
3
3
  # Base module.
4
4
  module Pio
5
- # Metering
5
+ # Apply meter (rate limiter)
6
6
  class Meter
7
7
  # OpenFlow 1.3.4 OFPIT_METER instruction format
8
8
  class Format < BinData::Record
@@ -0,0 +1,53 @@
1
+ require 'pio/open_flow'
2
+
3
+ module Pio
4
+ module OpenFlow13
5
+ # OpenFlow 1.3 Stats Request message
6
+ class StatsRequest < OpenFlow::Message
7
+ # Request type of Stats Request message
8
+ class StatsType < BinData::Primitive
9
+ TYPES = [:description,
10
+ :flow,
11
+ :aggregate,
12
+ :table,
13
+ :port,
14
+ :queue,
15
+ :vendor]
16
+
17
+ endian :big
18
+
19
+ uint16 :stats_type
20
+
21
+ def set(value)
22
+ self.stats_type = TYPES.find_index(value)
23
+ end
24
+
25
+ def get
26
+ TYPES[stats_type]
27
+ end
28
+ end
29
+
30
+ # OpenFlow 1.3 Stats Request message body
31
+ class Body < BinData::Record
32
+ endian :big
33
+
34
+ stats_type :stats_type
35
+ uint16 :stats_flags
36
+
37
+ def length
38
+ 4
39
+ end
40
+ end
41
+
42
+ # OpenFlow 1.3 Stats Request message format
43
+ class Format < BinData::Record
44
+ extend OpenFlow::Format
45
+
46
+ header version: 4, message_type: 16
47
+ body :body
48
+ end
49
+
50
+ body_option :stats_type
51
+ end
52
+ end
53
+ end
data/lib/pio/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Base module.
2
2
  module Pio
3
3
  # gem version.
4
- VERSION = '0.26.0'.freeze
4
+ VERSION = '0.27.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhito Takamiya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-08 00:00:00.000000000 Z
11
+ date: 2015-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -423,7 +423,9 @@ files:
423
423
  - features/lldp.detailed.pcap
424
424
  - features/lldp.feature
425
425
  - features/lldp.minimal.pcap
426
+ - features/open_flow10/aggregate_stats_reply.feature
426
427
  - features/open_flow10/aggregate_stats_reply.raw
428
+ - features/open_flow10/aggregate_stats_request.feature
427
429
  - features/open_flow10/aggregate_stats_request.raw
428
430
  - features/open_flow10/bad_request.feature
429
431
  - features/open_flow10/bad_request.raw
@@ -431,8 +433,10 @@ files:
431
433
  - features/open_flow10/barrier_reply.raw
432
434
  - features/open_flow10/barrier_request.feature
433
435
  - features/open_flow10/barrier_request.raw
434
- - features/open_flow10/desc_stats_reply.raw
435
- - features/open_flow10/desc_stats_request.raw
436
+ - features/open_flow10/description_stats_reply.feature
437
+ - features/open_flow10/description_stats_reply.raw
438
+ - features/open_flow10/description_stats_request.feature
439
+ - features/open_flow10/description_stats_request.raw
436
440
  - features/open_flow10/echo_reply.feature
437
441
  - features/open_flow10/echo_reply.raw
438
442
  - features/open_flow10/echo_request.feature
@@ -461,6 +465,11 @@ files:
461
465
  - features/open_flow10/hello.raw
462
466
  - features/open_flow10/hello_failed.feature
463
467
  - features/open_flow10/hello_failed.raw
468
+ - features/open_flow10/nx_flow_mod_add.raw
469
+ - features/open_flow10/nx_flow_mod_delete.raw
470
+ - features/open_flow10/nx_flow_mod_delete_strict.raw
471
+ - features/open_flow10/nx_flow_mod_modify.raw
472
+ - features/open_flow10/nx_flow_mod_modify_strict.raw
464
473
  - features/open_flow10/nxast_learn.raw
465
474
  - features/open_flow10/packet_in.feature
466
475
  - features/open_flow10/packet_in.raw
@@ -589,13 +598,13 @@ files:
589
598
  - features/open_flow13/packet_out.raw
590
599
  - features/open_flow13/send_out_port.feature
591
600
  - features/open_flow13/send_out_port.raw
601
+ - features/open_flow13/stats_request.feature
592
602
  - features/open_flow13/table_stats_reply.raw
593
603
  - features/open_flow13/table_stats_request.raw
594
604
  - features/open_flow13/write_metadata.feature
595
605
  - features/open_flow_read.feature
596
606
  - features/open_flow_version.feature
597
607
  - features/step_definitions/Gemfile
598
- - features/step_definitions/Gemfile.lock
599
608
  - features/step_definitions/Guardfile
600
609
  - features/step_definitions/LICENSE
601
610
  - features/step_definitions/README.md
@@ -677,8 +686,12 @@ files:
677
686
  - lib/pio/open_flow/transaction_id.rb
678
687
  - lib/pio/open_flow10.rb
679
688
  - lib/pio/open_flow10/actions.rb
689
+ - lib/pio/open_flow10/aggregate_stats_reply.rb
690
+ - lib/pio/open_flow10/aggregate_stats_request.rb
680
691
  - lib/pio/open_flow10/barrier_reply.rb
681
692
  - lib/pio/open_flow10/barrier_request.rb
693
+ - lib/pio/open_flow10/description_stats_reply.rb
694
+ - lib/pio/open_flow10/description_stats_request.rb
682
695
  - lib/pio/open_flow10/echo.rb
683
696
  - lib/pio/open_flow10/enqueue.rb
684
697
  - lib/pio/open_flow10/error.rb
@@ -705,6 +718,8 @@ files:
705
718
  - lib/pio/open_flow10/set_vlan.rb
706
719
  - lib/pio/open_flow10/set_vlan_priority.rb
707
720
  - lib/pio/open_flow10/set_vlan_vid.rb
721
+ - lib/pio/open_flow10/stats_reply.rb
722
+ - lib/pio/open_flow10/stats_request.rb
708
723
  - lib/pio/open_flow10/stats_type.rb
709
724
  - lib/pio/open_flow10/strip_vlan_header.rb
710
725
  - lib/pio/open_flow10/vendor_action.rb
@@ -728,6 +743,7 @@ files:
728
743
  - lib/pio/open_flow13/packet_out.rb
729
744
  - lib/pio/open_flow13/port32.rb
730
745
  - lib/pio/open_flow13/send_out_port.rb
746
+ - lib/pio/open_flow13/stats_request.rb
731
747
  - lib/pio/open_flow13/write_metadata.rb
732
748
  - lib/pio/options.rb
733
749
  - lib/pio/parse_error.rb
@@ -892,7 +908,9 @@ test_files:
892
908
  - features/lldp.detailed.pcap
893
909
  - features/lldp.feature
894
910
  - features/lldp.minimal.pcap
911
+ - features/open_flow10/aggregate_stats_reply.feature
895
912
  - features/open_flow10/aggregate_stats_reply.raw
913
+ - features/open_flow10/aggregate_stats_request.feature
896
914
  - features/open_flow10/aggregate_stats_request.raw
897
915
  - features/open_flow10/bad_request.feature
898
916
  - features/open_flow10/bad_request.raw
@@ -900,8 +918,10 @@ test_files:
900
918
  - features/open_flow10/barrier_reply.raw
901
919
  - features/open_flow10/barrier_request.feature
902
920
  - features/open_flow10/barrier_request.raw
903
- - features/open_flow10/desc_stats_reply.raw
904
- - features/open_flow10/desc_stats_request.raw
921
+ - features/open_flow10/description_stats_reply.feature
922
+ - features/open_flow10/description_stats_reply.raw
923
+ - features/open_flow10/description_stats_request.feature
924
+ - features/open_flow10/description_stats_request.raw
905
925
  - features/open_flow10/echo_reply.feature
906
926
  - features/open_flow10/echo_reply.raw
907
927
  - features/open_flow10/echo_request.feature
@@ -930,6 +950,11 @@ test_files:
930
950
  - features/open_flow10/hello.raw
931
951
  - features/open_flow10/hello_failed.feature
932
952
  - features/open_flow10/hello_failed.raw
953
+ - features/open_flow10/nx_flow_mod_add.raw
954
+ - features/open_flow10/nx_flow_mod_delete.raw
955
+ - features/open_flow10/nx_flow_mod_delete_strict.raw
956
+ - features/open_flow10/nx_flow_mod_modify.raw
957
+ - features/open_flow10/nx_flow_mod_modify_strict.raw
933
958
  - features/open_flow10/nxast_learn.raw
934
959
  - features/open_flow10/packet_in.feature
935
960
  - features/open_flow10/packet_in.raw
@@ -1058,6 +1083,7 @@ test_files:
1058
1083
  - features/open_flow13/packet_out.raw
1059
1084
  - features/open_flow13/send_out_port.feature
1060
1085
  - features/open_flow13/send_out_port.raw
1086
+ - features/open_flow13/stats_request.feature
1061
1087
  - features/open_flow13/table_stats_reply.raw
1062
1088
  - features/open_flow13/table_stats_request.raw
1063
1089
  - features/open_flow13/write_metadata.feature
@@ -1065,7 +1091,6 @@ test_files:
1065
1091
  - features/open_flow_version.feature
1066
1092
  - features/step_definitions/dump_flows_steps.rb
1067
1093
  - features/step_definitions/Gemfile
1068
- - features/step_definitions/Gemfile.lock
1069
1094
  - features/step_definitions/Guardfile
1070
1095
  - features/step_definitions/LICENSE
1071
1096
  - features/step_definitions/open_flow_steps.rb
@@ -1,76 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- ast (2.0.0)
5
- astrolabe (1.3.0)
6
- parser (>= 2.2.0.pre.3, < 3.0)
7
- celluloid (0.16.0)
8
- timers (~> 4.0.0)
9
- coderay (1.1.0)
10
- ffi (1.9.8)
11
- formatador (0.2.5)
12
- guard (2.12.5)
13
- formatador (>= 0.2.4)
14
- listen (~> 2.7)
15
- lumberjack (~> 1.0)
16
- nenv (~> 0.1)
17
- notiffany (~> 0.0)
18
- pry (>= 0.9.12)
19
- shellany (~> 0.0)
20
- thor (>= 0.18.1)
21
- guard-bundler (2.1.0)
22
- bundler (~> 1.0)
23
- guard (~> 2.2)
24
- guard-compat (~> 1.1)
25
- guard-compat (1.2.1)
26
- guard-rubocop (1.2.0)
27
- guard (~> 2.0)
28
- rubocop (~> 0.20)
29
- hitimes (1.2.2)
30
- listen (2.10.0)
31
- celluloid (~> 0.16.0)
32
- rb-fsevent (>= 0.9.3)
33
- rb-inotify (>= 0.9)
34
- lumberjack (1.0.9)
35
- method_source (0.8.2)
36
- nenv (0.2.0)
37
- notiffany (0.0.6)
38
- nenv (~> 0.1)
39
- shellany (~> 0.0)
40
- parser (2.2.2.1)
41
- ast (>= 1.1, < 3.0)
42
- powerpack (0.1.0)
43
- pry (0.10.1)
44
- coderay (~> 1.1.0)
45
- method_source (~> 0.8.1)
46
- slop (~> 3.4)
47
- rainbow (2.0.0)
48
- rake (10.4.2)
49
- rb-fsevent (0.9.5)
50
- rb-inotify (0.9.5)
51
- ffi (>= 0.5.0)
52
- rubocop (0.30.1)
53
- astrolabe (~> 1.3)
54
- parser (>= 2.2.2.1, < 3.0)
55
- powerpack (~> 0.1)
56
- rainbow (>= 1.99.1, < 3.0)
57
- ruby-progressbar (~> 1.4)
58
- ruby-progressbar (1.7.5)
59
- shellany (0.0.1)
60
- slop (3.6.0)
61
- thor (0.19.1)
62
- timers (4.0.1)
63
- hitimes
64
-
65
- PLATFORMS
66
- ruby
67
-
68
- DEPENDENCIES
69
- guard
70
- guard-bundler
71
- guard-rubocop
72
- rake
73
- rubocop
74
-
75
- BUNDLED WITH
76
- 1.10.6