Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SetArpSenderProtocolAddress action #277

Merged
merged 1 commit into from
Nov 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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