Skip to content

Commit

Permalink
Merge pull request #227 from trema/feature/set_ip_tos
Browse files Browse the repository at this point in the history
Add open_flow10/set_ip_tos.feature
  • Loading branch information
yasuhito committed Sep 1, 2015
2 parents c9a0a28 + 1b65a55 commit 524f1e7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
16 changes: 16 additions & 0 deletions features/open_flow10/set_ip_tos.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@open_flow10
Feature: Pio::SetIpTos

Scenario: new(0b11111100)
When I try to create an OpenFlow action with:
"""
Pio::SetIpTos.new(0b11111100)
"""
Then it should finish successfully
And the action has the following fields and values:
| field | value |
| action_type | 8 |
| message_length | 8 |
| type_of_service | 252 |


4 changes: 2 additions & 2 deletions lib/pio/open_flow10/set_ip_tos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SetIpTos
class Format < BinData::Record
endian :big

uint16 :type, value: 8
uint16 :action_type, value: 8
uint16 :message_length, value: 8
uint8 :type_of_service
uint24 :padding
Expand All @@ -24,7 +24,7 @@ def self.read(raw_data)

extend Forwardable

def_delegators :@format, :type
def_delegators :@format, :action_type
def_delegators :@format, :message_length
def_delegators :@format, :type_of_service
def_delegator :@format, :to_binary_s, :to_binary
Expand Down
4 changes: 2 additions & 2 deletions spec/pio/open_flow10/set_ip_tos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
Then { set_ip_tos.type_of_service == 32 }
end

describe '#type' do
Then { set_ip_tos.type == 8 }
describe '#action_type' do
Then { set_ip_tos.action_type == 8 }
end

describe '#message_length' do
Expand Down

0 comments on commit 524f1e7

Please sign in to comment.