diff --git a/CHANGELOG.md b/CHANGELOG.md index a3473af7..55324205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * [#250](https://github.com/trema/pio/pull/250): Add Flow Removed message parser. * [#251](https://github.com/trema/pio/pull/251): Add Table Stats Request message generator. * [#266](https://github.com/trema/pio/pull/266): Add Port Stats Request message generator. +* [#267](https://github.com/trema/pio/pull/267): Add Queue Stats Request message generator. ### Changes * [#265](https://github.com/trema/pio/pull/265): Rename `SetIpTos` -> `SetTos`. diff --git a/features/open_flow10/queue_stats_request.feature b/features/open_flow10/queue_stats_request.feature new file mode 100644 index 00000000..a8ddec9a --- /dev/null +++ b/features/open_flow10/queue_stats_request.feature @@ -0,0 +1,51 @@ +Feature: Pio::OpenFlow10::QueueStats::Request + @open_flow10 + Scenario: new(port: 1, queue_id: 1) + When I try to create an OpenFlow message with: + """ + Pio::OpenFlow10::QueueStats::Request.new(port: 1, queue_id: 1) + """ + Then it should finish successfully + And the message has the following fields and values: + | field | value | + | ofp_version | 1 | + | message_type | 16 | + | message_length | 20 | + | transaction_id | 0 | + | xid | 0 | + | stats_type | :queue | + | port | 1 | + | queue_id | 1 | + + @open_flow10 + Scenario: new(port: 1, queue_id: 1, transaction_id: 123) + When I try to create an OpenFlow message with: + """ + Pio::OpenFlow10::QueueStats::Request.new(port: 1, queue_id: 1, transaction_id: 123) + """ + Then it should finish successfully + And the message has the following fields and values: + | field | value | + | ofp_version | 1 | + | message_type | 16 | + | message_length | 20 | + | transaction_id | 123 | + | xid | 123 | + | stats_type | :queue | + | port | 1 | + | queue_id | 1 | + + @open_flow10 + Scenario: read + When I try to parse a file named "open_flow10/queue_stats_request.raw" with "QueueStats::Request" class + Then it should finish successfully + And the message has the following fields and values: + | field | value | + | ofp_version | 1 | + | message_type | 16 | + | message_length | 20 | + | transaction_id | 123 | + | xid | 123 | + | stats_type | :queue | + | port | :all | + | queue_id | 1 | diff --git a/features/open_flow10/queue_stats_request.raw b/features/open_flow10/queue_stats_request.raw new file mode 100644 index 00000000..9cf3d3c9 Binary files /dev/null and b/features/open_flow10/queue_stats_request.raw differ diff --git a/lib/pio/open_flow.rb b/lib/pio/open_flow.rb index 8009a452..5c42ff8d 100644 --- a/lib/pio/open_flow.rb +++ b/lib/pio/open_flow.rb @@ -18,7 +18,7 @@ def self.switch_version(version) [:Barrier, :Echo, :Features, :FlowMod, :Hello, :Match, :PacketIn, :FlowRemoved, :PacketOut, :SendOutPort, :PortStatus, :Stats, :FlowStats, :DescriptionStats, :AggregateStats, - :TableStats, :PortStats, :Error, :NiciraResubmit, + :TableStats, :PortStats, :QueueStats, :Error, :NiciraResubmit, :NiciraResubmitTable].each do |each| set_message_class_name each, version @version = version.to_s diff --git a/lib/pio/open_flow10.rb b/lib/pio/open_flow10.rb index 5f9c955e..bf45b554 100644 --- a/lib/pio/open_flow10.rb +++ b/lib/pio/open_flow10.rb @@ -21,6 +21,7 @@ require 'pio/open_flow10/packet_out' require 'pio/open_flow10/port_stats/request' require 'pio/open_flow10/port_status' +require 'pio/open_flow10/queue_stats/request' require 'pio/open_flow10/stats_reply' require 'pio/open_flow10/stats_request' require 'pio/open_flow10/table_stats/request' diff --git a/lib/pio/open_flow10/queue_stats/request.rb b/lib/pio/open_flow10/queue_stats/request.rb new file mode 100644 index 00000000..2896bb7c --- /dev/null +++ b/lib/pio/open_flow10/queue_stats/request.rb @@ -0,0 +1,22 @@ +require 'pio/open_flow/message' + +module Pio + module OpenFlow10 + # Queue Stats messages + class QueueStats + # Queue Stats Request message + class Request < OpenFlow::Message + open_flow_header version: 1, + message_type: 16, + message_length: 20 + + stats_type :stats_type, value: -> { :queue } + uint16 :flags + port16 :port + string :padding, length: 2 + hide :padding + uint32 :queue_id + end + end + end +end