Skip to content

Commit

Permalink
Add open_flow10/set_ip_source_address.feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Aug 31, 2015
1 parent 84108ce commit 08aa9fa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
16 changes: 16 additions & 0 deletions features/open_flow10/set_ip_source_address.feature
@@ -0,0 +1,16 @@
@open_flow10
Feature: Pio::SetIpSourceAddress

Scenario: new('192.168.0.1')
When I try to create an OpenFlow action with:
"""
Pio::SetIpSourceAddress.new('192.168.0.1')
"""
Then it should finish successfully
And the action has the following fields and values:
| field | value |
| action_type | 6 |
| message_length | 8 |
| ip_address | 192.168.0.1 |


4 changes: 2 additions & 2 deletions lib/pio/open_flow10/set_ip_address.rb
Expand Up @@ -10,7 +10,7 @@ def self.def_format(action_type)
class Format < BinData::Record
endian :big
uint16 :type, value: #{action_type}
uint16 :action_type, value: #{action_type}
uint16 :message_length, value: 8
ip_address :ip_address
end
Expand All @@ -27,7 +27,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, :ip_address
def_delegator :@format, :to_binary_s, :to_binary
Expand Down
4 changes: 2 additions & 2 deletions spec/pio/open_flow10/set_ip_destination_address_spec.rb
Expand Up @@ -11,8 +11,8 @@
Then { set_ip_destination_addr.ip_address == '1.2.3.4' }
end

describe '#type' do
Then { set_ip_destination_addr.type == 7 }
describe '#action_type' do
Then { set_ip_destination_addr.action_type == 7 }
end

describe '#message_length' do
Expand Down
4 changes: 2 additions & 2 deletions spec/pio/open_flow10/set_ip_source_address_spec.rb
Expand Up @@ -9,8 +9,8 @@
Then { set_ip_source_addr.ip_address == '1.2.3.4' }
end

describe '#type' do
Then { set_ip_source_addr.type == 6 }
describe '#action_type' do
Then { set_ip_source_addr.action_type == 6 }
end

describe '#message_length' do
Expand Down

0 comments on commit 08aa9fa

Please sign in to comment.