Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
79 additions
and
3 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,34 @@ | ||
@open_flow10 | ||
Feature: Pio::FlowRemoved | ||
|
||
@open_flow10 | ||
Scenario: read | ||
When I try to parse a file named "open_flow10/flow_removed.raw" with "FlowRemoved" class | ||
Then it should finish successfully | ||
And the message has the following fields and values: | ||
| field | value | | ||
| ofp_version | 1 | | ||
| message_type | 11 | | ||
| message_length | 88 | | ||
| transaction_id | 0 | | ||
| xid | 0 | | ||
| match.wildcards.keys.size | 11 | | ||
| match.wildcards.fetch(:ether_destination_address) | true | | ||
| match.wildcards.fetch(:ether_source_address) | true | | ||
| match.wildcards.fetch(:ether_type) | true | | ||
| match.wildcards.fetch(:ip_destination_address_all) | true | | ||
| match.wildcards.fetch(:ip_protocol) | true | | ||
| match.wildcards.fetch(:ip_source_address_all) | true | | ||
| match.wildcards.fetch(:ip_tos) | true | | ||
| match.wildcards.fetch(:transport_destination_port) | true | | ||
| match.wildcards.fetch(:transport_source_port) | true | | ||
| match.wildcards.fetch(:vlan_priority) | true | | ||
| match.wildcards.fetch(:vlan_vid) | true | | ||
| cookie | 1 | | ||
| priority | 65535 | | ||
| reason | :delete | | ||
| duration_sec | 0 | | ||
| duration_nsec | 0 | | ||
| idle_timeout | 0 | | ||
| packet_count | 0 | | ||
| byte_count | 0 | |
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,40 @@ | ||
require 'pio/open_flow/message' | ||
require 'pio/open_flow10/match10' | ||
|
||
module Pio | ||
module OpenFlow10 | ||
# Flow Removed message | ||
class FlowRemoved < OpenFlow::Message | ||
# Why was this flow removed? | ||
# (enum ofp_flow_removed_reason) | ||
class Reason < BinData::Primitive | ||
REASONS = { idle_timeout: 0, hard_timeout: 1, delete: 2 } | ||
|
||
uint8 :reason | ||
|
||
def get | ||
REASONS.invert.fetch(reason) | ||
end | ||
|
||
def set(value) | ||
self.reason = REASONS.fetch(value) | ||
end | ||
end | ||
|
||
open_flow_header version: 1, message_type: 11, message_length: 88 | ||
match10 :match | ||
uint64 :cookie | ||
uint16 :priority | ||
reason :reason | ||
string :padding1, length: 1 | ||
hide :padding1 | ||
uint32 :duration_sec | ||
uint32 :duration_nsec | ||
uint16 :idle_timeout | ||
string :padding2, length: 2 | ||
hide :padding2 | ||
uint64 :packet_count | ||
uint64 :byte_count | ||
end | ||
end | ||
end |