-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #235
- Loading branch information
Showing
7 changed files
with
79 additions
and
2 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,48 @@ | ||
Feature: Pio::OpenFlow10::PortStats::Request | ||
@open_flow10 | ||
Scenario: new(:none) | ||
When I try to create an OpenFlow message with: | ||
""" | ||
Pio::OpenFlow10::PortStats::Request.new(:none) | ||
""" | ||
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 | :port | | ||
| port | :none | | ||
|
||
@open_flow10 | ||
Scenario: new(:none, transaction_id: 123) | ||
When I try to create an OpenFlow message with: | ||
""" | ||
Pio::OpenFlow10::PortStats::Request.new(:none, 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 | :port | | ||
| port | :none | | ||
|
||
@open_flow10 | ||
Scenario: read | ||
When I try to parse a file named "open_flow10/port_stats_request.raw" with "PortStats::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 | :port | | ||
| port | :none | |
Binary file not shown.
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
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,25 @@ | ||
require 'pio/open_flow/message' | ||
|
||
module Pio | ||
module OpenFlow10 | ||
# Port Stats messages | ||
class PortStats | ||
# Port Stats Request message | ||
class Request < OpenFlow::Message | ||
open_flow_header version: 1, | ||
message_type: 16, | ||
message_length: 20 | ||
|
||
stats_type :stats_type, value: -> { :port } | ||
uint16 :flags | ||
port16 :port | ||
string :padding, length: 6 | ||
hide :padding | ||
|
||
def initialize(port, user_options = {}) | ||
super({ port: port }.merge user_options) | ||
end | ||
end | ||
end | ||
end | ||
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