Sha256: 347f6ea773da4cb86afdc413539db77871cd5c54404df0d30a7356b464a7d8e7

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'pio/open_flow/action'

module Pio
  module OpenFlow13
    # NXAST_OUTPUT_REG action
    class NiciraSendOutPort < OpenFlow::Action
      action_header action_type: 0xffff, action_length: 24
      uint32 :experimenter_id, value: 0x2320
      uint16 :experimenter_type, value: 15
      bit10 :offset_internal, value: 0
      bit6 :n_bits_internal
      uint32 :source_internal
      uint16 :max_length, value: 0
      string :zero, length: 6

      attr_reader :source

      # rubocop:disable AbcSize
      # rubocop:disable LineLength
      def initialize(source)
        @source = source
        oxm_klass = Match.const_get(source.to_s.split('_').map(&:capitalize).join)
        super(n_bits_internal: oxm_klass.new.length * 8 - 1,
              source_internal: ((oxm_klass.superclass.const_get(:OXM_CLASS) << 16) | (oxm_klass.const_get(:OXM_FIELD) << 9) | oxm_klass.new.length))
      end
      # rubocop:enable AbcSize
      # rubocop:enable LineLength

      def offset
        offset_internal
      end

      def n_bits
        n_bits_internal + 1
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pio-0.30.0 lib/pio/open_flow13/nicira_send_out_port.rb