class Trema::Controller::PacketOutOption

Pio::PacketOut.new argument

Public Class Methods

new(user_options) click to toggle source
# File lib/trema/controller.rb, line 84
def initialize(user_options)
  @user_options = user_options
end

Public Instance Methods

to_hash() click to toggle source

rubocop:disable MethodLength

# File lib/trema/controller.rb, line 89
def to_hash
  if @user_options[:packet_in]
    {
      transaction_id: rand(0xffffffff),
      buffer_id: 0xffffffff,
      actions: @user_options[:actions],
      in_port: @user_options.fetch(:packet_in).in_port,
      raw_data: @user_options.fetch(:packet_in).raw_data
    }
  else
    {
      transaction_id: rand(0xffffffff),
      buffer_id: 0xffffffff,
      actions: @user_options[:actions],
      raw_data: @user_options.fetch(:raw_data)
    }
  end
end