Class: Pio::OpenFlow10::SendOutPort

Inherits:
Pio::OpenFlow::Action show all
Defined in:
lib/pio/open_flow10/send_out_port.rb

Overview

An action to output a packet to a port.

Instance Method Summary collapse

Methods inherited from Pio::OpenFlow::Action

action_header, method_missing, read, #to_binary

Constructor Details

#initialize(user_options) ⇒ SendOutPort

rubocop:disable MethodLength



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pio/open_flow10/send_out_port.rb', line 16

def initialize(user_options)
  options = if user_options.respond_to?(:to_i)
              { port: user_options.to_i }
            elsif Port16.reserved_port_name?(user_options)
              { port: user_options }
            else
              user_options
            end
  max_length = options[:max_length]
  if max_length && !max_length.unsigned_16bit?
    raise(ArgumentError,
          'The max_length should be an unsigned 16bit integer.')
  end
  super(options)
end

Instance Method Details

#==(other) ⇒ Object

rubocop:enable MethodLength



33
34
35
36
# File 'lib/pio/open_flow10/send_out_port.rb', line 33

def ==(other)
  return false unless other
  to_binary == other.to_binary
end