Skip to content

Commit

Permalink
Add SetArpSenderHardwareAddress action
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Nov 9, 2015
1 parent 7646833 commit 925cf72
Show file tree
Hide file tree
Showing 5 changed files with 41 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 = 1294
FLAY_THRESHOLD = 1343

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

Scenario: new('00:00:de:ad:be:ef')
When I try to create an OpenFlow action with:
"""
Pio::SetArpSenderHardwareAddress.new('00:00:de:ad:be:ef')
"""
Then it should finish successfully
And the action has the following fields and values:
| field | value |
| action_type | 25 |
| action_length | 16 |
| mac_address | 00:00:de:ad:be:ef |
3 changes: 2 additions & 1 deletion lib/pio/open_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def self.switch_version(version)
:SetSourceMacAddress, :SetDestinationMacAddress, :PortStatus, :Stats,
:FlowStats, :DescriptionStats, :AggregateStats, :TableStats, :PortStats,
:QueueStats, :Error, :NiciraResubmit, :SetArpOperation,
:SetArpSenderProtocolAddress, :NiciraResubmitTable].each do |each|
:SetArpSenderProtocolAddress, :SetArpSenderHardwareAddress,
: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_hardware_address'
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_hardware_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 hardware address field
class SetArpSenderHardwareAddress < OpenFlow::Action
action_header action_type: 25, action_length: 16

uint16 :oxm_class, value: Match::OXM_CLASS_OPENFLOW_BASIC
bit7 :oxm_field, value: Match::ArpSenderHardwareAddress::OXM_FIELD
bit1 :oxm_hasmask, value: 0
uint8 :oxm_length, value: 6
mac_address :mac_address
string :padding, length: 2
hide :padding

def initialize(mac_address)
super mac_address: mac_address
end
end
end
end

0 comments on commit 925cf72

Please sign in to comment.