Skip to content

Commit

Permalink
Merge branch 'feature/nicira_resubmit' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Oct 26, 2015
2 parents 4d1e495 + ec0f55f commit b9790da
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 1 deletion.
30 changes: 30 additions & 0 deletions features/open_flow10/nicira_resubmit.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@open_flow10
Feature: Pio::NiciraResubmit

Scenario: new(1)
When I try to create an OpenFlow action with:
"""
Pio::NiciraResubmit.new(1)
"""
Then it should finish successfully
And the action has the following fields and values:
| field | value |
| action_type.to_hex | 0xffff |
| action_length | 16 |
| vendor.to_hex | 0x2320 |
| subtype | 1 |
| in_port | 1 |

Scenario: new(:in_port)
When I try to create an OpenFlow action with:
"""
Pio::NiciraResubmit.new(:in_port)
"""
Then it should finish successfully
And the action has the following fields and values:
| field | value |
| action_type.to_hex | 0xffff |
| action_length | 16 |
| vendor.to_hex | 0x2320 |
| subtype | 1 |
| in_port | :in_port |
32 changes: 32 additions & 0 deletions features/open_flow10/nicira_resubmit_table.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@open_flow10
Feature: Pio::NiciraResubmitTable

Scenario: new(in_port: 1, table: 1)
When I try to create an OpenFlow action with:
"""
Pio::NiciraResubmitTable.new(in_port: 1, table: 1)
"""
Then it should finish successfully
And the action has the following fields and values:
| field | value |
| action_type.to_hex | 0xffff |
| action_length | 16 |
| vendor.to_hex | 0x2320 |
| subtype | 14 |
| in_port | 1 |
| table | 1 |

Scenario: new(:in_port)
When I try to create an OpenFlow action with:
"""
Pio::NiciraResubmitTable.new(in_port: 1)
"""
Then it should finish successfully
And the action has the following fields and values:
| field | value |
| action_type.to_hex | 0xffff |
| action_length | 16 |
| vendor.to_hex | 0x2320 |
| subtype | 14 |
| in_port | 1 |
| table.to_hex | 0xff |
3 changes: 2 additions & 1 deletion lib/pio/open_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def self.switch_version(version)
[:Barrier, :Echo, :Features, :FlowMod, :Hello, :Match,
:PacketIn, :FlowRemoved, :PacketOut, :SendOutPort, :PortStatus,
:Stats, :FlowStats, :DescriptionStats, :AggregateStats,
:TableStats, :Error].each do |each|
:TableStats, :Error, :NiciraResubmit,
:NiciraResubmitTable].each do |each|
set_message_class_name each, version
@version = version.to_s
end
Expand Down
17 changes: 17 additions & 0 deletions lib/pio/open_flow/nicira_action.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'pio/open_flow/action'

module Pio
module OpenFlow
# NXAST_* actions
class NiciraAction < Action
def self.nicira_action_header(options)
module_eval do
action_header action_type: options.fetch(:action_type),
action_length: options.fetch(:action_length)
uint32 :vendor, value: 0x2320
uint16 :subtype, value: options.fetch(:subtype)
end
end
end
end
end
2 changes: 2 additions & 0 deletions lib/pio/open_flow10.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
require 'pio/open_flow10/table_stats/request'

# Actions
require 'pio/open_flow10/nicira_resubmit'
require 'pio/open_flow10/nicira_resubmit_table'
require 'pio/open_flow10/send_out_port'
require 'pio/open_flow10/set_vlan_priority'
require 'pio/open_flow10/set_vlan_vid'
Expand Down
20 changes: 20 additions & 0 deletions lib/pio/open_flow10/nicira_resubmit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'pio/open_flow/nicira_action'
require 'pio/open_flow10/port16'

module Pio
module OpenFlow10
# NXAST_RESUBMIT action
class NiciraResubmit < OpenFlow::NiciraAction
nicira_action_header action_type: 0xffff,
action_length: 16,
subtype: 1
port16 :in_port
string :padding, length: 4
hide :padding

def initialize(port_number)
super(in_port: port_number)
end
end
end
end
17 changes: 17 additions & 0 deletions lib/pio/open_flow10/nicira_resubmit_table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'pio/open_flow/nicira_action'
require 'pio/open_flow10/port16'

module Pio
module OpenFlow10
# NXAST_RESUBMIT_TABLE action
class NiciraResubmitTable < OpenFlow::NiciraAction
nicira_action_header action_type: 0xffff,
action_length: 16,
subtype: 14
port16 :in_port
uint8 :table, initial_value: 0xff
string :padding, length: 3
hide :padding
end
end
end

0 comments on commit b9790da

Please sign in to comment.