class Pio::OpenFlow13::NiciraRegMove

NXAST_REG_MOVE action

Attributes

destination[R]
source[R]

rubocop:enable MethodLength

Public Class Methods

new(arguments) click to toggle source

rubocop:disable MethodLength

Calls superclass method Pio::OpenFlow::Action::new
# File lib/pio/open_flow13/nicira_reg_move.rb, line 30
def initialize(arguments)
  @source = arguments.fetch(:source)
  @destination = arguments.fetch(:destination)
  registers = { _source: { oxm_class: source_oxm_class,
                           oxm_field: source_oxm_field,
                           oxm_length: source_oxm_length },
                _destination: { oxm_class: destination_oxm_class,
                                oxm_field: destination_oxm_field,
                                oxm_length: destination_oxm_length } }
  options = %i[n_bits
               source_offset
               destination_offset].each_with_object({}) do |each, opts|
    opts[each] = arguments[each] if arguments[each]
  end
  super registers.merge(options)
end

Private Instance Methods

destination_class() click to toggle source
# File lib/pio/open_flow13/nicira_reg_move.rb, line 81
def destination_class
  Match.const_get(@destination.to_s.split('_').map(&:capitalize).join)
end
destination_oxm_class() click to toggle source
# File lib/pio/open_flow13/nicira_reg_move.rb, line 69
def destination_oxm_class
  destination_class.const_get(:OXM_CLASS)
end
destination_oxm_field() click to toggle source
# File lib/pio/open_flow13/nicira_reg_move.rb, line 73
def destination_oxm_field
  destination_class.const_get(:OXM_FIELD)
end
destination_oxm_length() click to toggle source
# File lib/pio/open_flow13/nicira_reg_move.rb, line 77
def destination_oxm_length
  destination_class.new.length
end
source_class() click to toggle source
# File lib/pio/open_flow13/nicira_reg_move.rb, line 65
def source_class
  Match.const_get(@source.to_s.split('_').map(&:capitalize).join)
end
source_oxm_class() click to toggle source
# File lib/pio/open_flow13/nicira_reg_move.rb, line 53
def source_oxm_class
  source_class.const_get(:OXM_CLASS)
end
source_oxm_field() click to toggle source
# File lib/pio/open_flow13/nicira_reg_move.rb, line 57
def source_oxm_field
  source_class.const_get(:OXM_FIELD)
end
source_oxm_length() click to toggle source
# File lib/pio/open_flow13/nicira_reg_move.rb, line 61
def source_oxm_length
  source_class.new.length
end