Skip to content

Commit

Permalink
Add SetIpTtl action
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Nov 24, 2015
1 parent f1603a1 commit 15ca8a4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
13 changes: 13 additions & 0 deletions features/open_flow13/set_ip_ttl.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@open_flow13
Feature: Pio::SetIpTtl

Scenario: new(10)
When I try to create an OpenFlow action with:
"""
Pio::SetIpTtl.new(10)
"""
Then it should finish successfully
And the action has the following fields and values:
| field | value |
| action_type | 23 |
| ttl | 10 |
2 changes: 1 addition & 1 deletion lib/pio/open_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def self.switch_version(version)
:QueueStats, :Error, :SetArpOperation, :SetArpSenderProtocolAddress,
:SetArpSenderHardwareAddress, :NiciraRegMove, :SetMetadata,
:NiciraRegLoad, :NiciraSendOutPort, :NiciraStackPush,
:NiciraStackPop, :DecrementIpTtl].each do |each|
:NiciraStackPop, :DecrementIpTtl, :SetIpTtl].each do |each|
set_message_class_name each, version
@version = version.to_s
end
Expand Down
1 change: 1 addition & 0 deletions lib/pio/open_flow13.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
require 'pio/open_flow13/set_arp_sender_hardware_address'
require 'pio/open_flow13/set_arp_sender_protocol_address'
require 'pio/open_flow13/set_destination_mac_address'
require 'pio/open_flow13/set_ip_ttl'
require 'pio/open_flow13/set_metadata'
require 'pio/open_flow13/set_source_mac_address'

Expand Down
16 changes: 16 additions & 0 deletions lib/pio/open_flow13/set_ip_ttl.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'pio/open_flow/action'

module Pio
module OpenFlow13
# Sets IP TTL
class SetIpTtl < OpenFlow::Action
action_header action_type: 23, action_length: 8
uint8 :ttl
string :padding, length: 3

def initialize(ttl)
super(ttl: ttl)
end
end
end
end

0 comments on commit 15ca8a4

Please sign in to comment.