diff --git a/Rakefile b/Rakefile index 49de6e54..f2066f58 100644 --- a/Rakefile +++ b/Rakefile @@ -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] diff --git a/features/open_flow13/set_arp_sender_hardware_address.feature b/features/open_flow13/set_arp_sender_hardware_address.feature new file mode 100644 index 00000000..ab6ac774 --- /dev/null +++ b/features/open_flow13/set_arp_sender_hardware_address.feature @@ -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 | diff --git a/lib/pio/open_flow.rb b/lib/pio/open_flow.rb index f13ac64d..b183e574 100644 --- a/lib/pio/open_flow.rb +++ b/lib/pio/open_flow.rb @@ -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 diff --git a/lib/pio/open_flow13.rb b/lib/pio/open_flow13.rb index e70e851b..29ea0da4 100644 --- a/lib/pio/open_flow13.rb +++ b/lib/pio/open_flow13.rb @@ -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' diff --git a/lib/pio/open_flow13/set_arp_sender_hardware_address.rb b/lib/pio/open_flow13/set_arp_sender_hardware_address.rb new file mode 100644 index 00000000..a224b523 --- /dev/null +++ b/lib/pio/open_flow13/set_arp_sender_hardware_address.rb @@ -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