From f1603a10081a3a11aeff870cb29c7a26d821ef8c Mon Sep 17 00:00:00 2001 From: Yasuhito Takamiya Date: Tue, 24 Nov 2015 10:41:40 +0900 Subject: [PATCH] Add DecrementIpTtl action --- features/open_flow13/decrement_ip_ttl.feature | 12 ++++++++++++ lib/pio/open_flow.rb | 2 +- lib/pio/open_flow13.rb | 1 + lib/pio/open_flow13/decrement_ip_ttl.rb | 15 +++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 features/open_flow13/decrement_ip_ttl.feature create mode 100644 lib/pio/open_flow13/decrement_ip_ttl.rb diff --git a/features/open_flow13/decrement_ip_ttl.feature b/features/open_flow13/decrement_ip_ttl.feature new file mode 100644 index 00000000..9b95c00a --- /dev/null +++ b/features/open_flow13/decrement_ip_ttl.feature @@ -0,0 +1,12 @@ +@open_flow13 +Feature: Pio::DecrementIpTtl + + Scenario: new + When I try to create an OpenFlow action with: + """ + Pio::DecrementIpTtl.new + """ + Then it should finish successfully + And the action has the following fields and values: + | field | value | + | action_type | 24 | diff --git a/lib/pio/open_flow.rb b/lib/pio/open_flow.rb index 1757e4fc..87adb744 100644 --- a/lib/pio/open_flow.rb +++ b/lib/pio/open_flow.rb @@ -23,7 +23,7 @@ def self.switch_version(version) :QueueStats, :Error, :SetArpOperation, :SetArpSenderProtocolAddress, :SetArpSenderHardwareAddress, :NiciraRegMove, :SetMetadata, :NiciraRegLoad, :NiciraSendOutPort, :NiciraStackPush, - :NiciraStackPop].each do |each| + :NiciraStackPop, :DecrementIpTtl].each do |each| set_message_class_name each, version @version = version.to_s end diff --git a/lib/pio/open_flow13.rb b/lib/pio/open_flow13.rb index fd3ee5ad..acfa1b9f 100644 --- a/lib/pio/open_flow13.rb +++ b/lib/pio/open_flow13.rb @@ -15,6 +15,7 @@ # Actions require 'pio/open_flow/nicira_resubmit' require 'pio/open_flow/nicira_resubmit_table' +require 'pio/open_flow13/decrement_ip_ttl' require 'pio/open_flow13/nicira_reg_load' require 'pio/open_flow13/nicira_reg_move' require 'pio/open_flow13/nicira_send_out_port' diff --git a/lib/pio/open_flow13/decrement_ip_ttl.rb b/lib/pio/open_flow13/decrement_ip_ttl.rb new file mode 100644 index 00000000..32327f4f --- /dev/null +++ b/lib/pio/open_flow13/decrement_ip_ttl.rb @@ -0,0 +1,15 @@ +require 'pio/open_flow/action' + +module Pio + module OpenFlow13 + # Decrements IP TTL + class DecrementIpTtl < OpenFlow::Action + action_header action_type: 24, action_length: 8 + string :padding, length: 4 + + def initialize + super({}) + end + end + end +end