Skip to content

Commit

Permalink
Add SetArpSenderProtocolAddress action
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Nov 9, 2015
1 parent e72eacb commit 7646833
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'bundler/gem_tasks'

RELISH_PROJECT = 'trema/pio'
FLAY_THRESHOLD = 1245
FLAY_THRESHOLD = 1294

task default: :travis
task test: [:spec, :cucumber]
Expand Down
14 changes: 14 additions & 0 deletions features/open_flow13/set_arp_sender_protocol_address.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@open_flow13
Feature: Pio::SetArpSenderProtocolAddress

Scenario: new('192.168.1.1')
When I try to create an OpenFlow action with:
"""
Pio::SetArpSenderProtocolAddress.new('192.168.1.1')
"""
Then it should finish successfully
And the action has the following fields and values:
| field | value |
| action_type | 25 |
| action_length | 16 |
| ip_address | 192.168.1.1 |
2 changes: 1 addition & 1 deletion lib/pio/open_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.switch_version(version)
:SetSourceMacAddress, :SetDestinationMacAddress, :PortStatus, :Stats,
:FlowStats, :DescriptionStats, :AggregateStats, :TableStats, :PortStats,
:QueueStats, :Error, :NiciraResubmit, :SetArpOperation,
:NiciraResubmitTable].each do |each|
:SetArpSenderProtocolAddress, :NiciraResubmitTable].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 @@ -15,6 +15,7 @@
# Actions
require 'pio/open_flow13/send_out_port'
require 'pio/open_flow13/set_arp_operation'
require 'pio/open_flow13/set_arp_sender_protocol_address'
require 'pio/open_flow13/set_destination_mac_address'
require 'pio/open_flow13/set_source_mac_address'

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

module Pio
module OpenFlow13
# Set ARP sender protocol address field
class SetArpSenderProtocolAddress < OpenFlow::Action
action_header action_type: 25, action_length: 16

uint16 :oxm_class, value: Match::OXM_CLASS_OPENFLOW_BASIC
bit7 :oxm_field, value: Match::ArpSenderProtocolAddress::OXM_FIELD
bit1 :oxm_hasmask, value: 0
uint8 :oxm_length, value: 4
ip_address :ip_address
string :padding, length: 4
hide :padding

def initialize(ip_address)
super ip_address: ip_address
end
end
end
end

0 comments on commit 7646833

Please sign in to comment.