Skip to content

Commit

Permalink
Refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Jul 16, 2015
1 parent 23e0026 commit 524bf7d
Show file tree
Hide file tree
Showing 63 changed files with 1,480 additions and 1,544 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'bundler/gem_tasks'

RELISH_PROJECT = 'trema/pio'
FLAY_THRESHOLD = 757
FLAY_THRESHOLD = 480

task default: :travis
task test: [:spec, :cucumber]
Expand Down
91 changes: 44 additions & 47 deletions features/open_flow10/echo_reply.feature
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
Feature: Pio::Echo::Reply
Background:
Given I use OpenFlow 1.0

Scenario: new
When I try to create an OpenFlow message with:
"""
Pio::Echo::Reply.new
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Reply |
| ofp_version | 1 |
| message_type | 3 |
| message_length | 8 |
| transaction_id | 0 |
| xid | 0 |
| body | |
| user_data | |
| field | value |
| ofp_version | 1 |
| message_type | 3 |
| message_length | 8 |
| transaction_id | 0 |
| xid | 0 |
| body | |
| user_data | |

Scenario: new(transaction_id: 123)
When I try to create an OpenFlow message with:
Expand All @@ -23,15 +25,14 @@ Feature: Pio::Echo::Reply
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Reply |
| ofp_version | 1 |
| message_type | 3 |
| message_length | 8 |
| transaction_id | 123 |
| xid | 123 |
| body | |
| user_data | |
| field | value |
| ofp_version | 1 |
| message_type | 3 |
| message_length | 8 |
| transaction_id | 123 |
| xid | 123 |
| body | |
| user_data | |

Scenario: new(xid: 123)
When I try to create an OpenFlow message with:
Expand All @@ -40,15 +41,14 @@ Feature: Pio::Echo::Reply
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Reply |
| ofp_version | 1 |
| message_type | 3 |
| message_length | 8 |
| transaction_id | 123 |
| xid | 123 |
| body | |
| user_data | |
| field | value |
| ofp_version | 1 |
| message_type | 3 |
| message_length | 8 |
| transaction_id | 123 |
| xid | 123 |
| body | |
| user_data | |

Scenario: new(unknown_attr: 'foo') and error
When I try to create an OpenFlow message with:
Expand All @@ -64,15 +64,14 @@ Feature: Pio::Echo::Reply
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Reply |
| ofp_version | 1 |
| message_type | 3 |
| message_length | 23 |
| transaction_id | 0 |
| xid | 0 |
| body | echo reply body |
| user_data | echo reply body |
| field | value |
| ofp_version | 1 |
| message_type | 3 |
| message_length | 23 |
| transaction_id | 0 |
| xid | 0 |
| body | echo reply body |
| user_data | echo reply body |

Scenario: new(user_data: 'echo reply body')
When I try to create an OpenFlow message with:
Expand All @@ -81,22 +80,20 @@ Feature: Pio::Echo::Reply
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Reply |
| ofp_version | 1 |
| message_type | 3 |
| message_length | 23 |
| transaction_id | 0 |
| xid | 0 |
| body | echo reply body |
| user_data | echo reply body |
| field | value |
| ofp_version | 1 |
| message_type | 3 |
| message_length | 23 |
| transaction_id | 0 |
| xid | 0 |
| body | echo reply body |
| user_data | echo reply body |

Scenario: read (no message body)
When I try to parse a file named "open_flow10/echo_reply.raw" with "Pio::Echo::Reply" class
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Reply |
| ofp_version | 1 |
| message_type | 3 |
| message_length | 8 |
Expand All @@ -107,4 +104,4 @@ Feature: Pio::Echo::Reply

Scenario: parse error
When I try to parse a file named "open_flow10/features_reply.raw" with "Pio::Echo::Reply" class
Then it should fail with "Pio::ParseError", "Invalid Echo Reply message."
Then it should fail with "Pio::ParseError", "Invalid OpenFlow10 Echo Reply message."
107 changes: 52 additions & 55 deletions features/open_flow10/echo_request.feature
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
Feature: Pio::Echo::Request
Background:
Given I use OpenFlow 1.0

Scenario: new
When I try to create an OpenFlow message with:
"""
Pio::Echo::Request.new
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 0 |
| xid | 0 |
| body | |
| user_data | |
| field | value |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 0 |
| xid | 0 |
| body | |
| user_data | |

Scenario: new(transaction_id: 123)
When I try to create an OpenFlow message with:
Expand All @@ -23,15 +25,14 @@ Feature: Pio::Echo::Request
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 123 |
| xid | 123 |
| body | |
| user_data | |
| field | value |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 123 |
| xid | 123 |
| body | |
| user_data | |

Scenario: new(xid: 123)
When I try to create an OpenFlow message with:
Expand All @@ -40,15 +41,14 @@ Feature: Pio::Echo::Request
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 123 |
| xid | 123 |
| body | |
| user_data | |
| field | value |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 123 |
| xid | 123 |
| body | |
| user_data | |

Scenario: new(body: 'echo request body')
When I try to create an OpenFlow message with:
Expand All @@ -57,15 +57,14 @@ Feature: Pio::Echo::Request
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 25 |
| transaction_id | 0 |
| xid | 0 |
| body | echo request body |
| user_data | echo request body |
| field | value |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 25 |
| transaction_id | 0 |
| xid | 0 |
| body | echo request body |
| user_data | echo request body |

Scenario: new(user_data: 'echo request body')
When I try to create an OpenFlow message with:
Expand All @@ -74,30 +73,28 @@ Feature: Pio::Echo::Request
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 25 |
| transaction_id | 0 |
| xid | 0 |
| body | echo request body |
| user_data | echo request body |
| field | value |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 25 |
| transaction_id | 0 |
| xid | 0 |
| body | echo request body |
| user_data | echo request body |

Scenario: read (no message body)
When I try to parse a file named "open_flow10/echo_request.raw" with "Pio::Echo::Request" class
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 0 |
| xid | 0 |
| body | |
| user_data | |
| field | value |
| ofp_version | 1 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 0 |
| xid | 0 |
| body | |
| user_data | |

Scenario: parse error
When I try to parse a file named "open_flow10/features_request.raw" with "Pio::Echo::Request" class
Then it should fail with "Pio::ParseError", "Invalid Echo Request message."
Then it should fail with "Pio::ParseError", "Invalid OpenFlow10 Echo Request message."
Loading

0 comments on commit 524bf7d

Please sign in to comment.