Class: Trema::Controller::FlowModAdd13Option

Inherits:
Object
  • Object
show all
Defined in:
lib/trema/controller.rb

Overview

Pio::FlowMod.new argument (OpenFlow 1.3)

Instance Method Summary collapse

Constructor Details

#initialize(user_options) ⇒ FlowModAdd13Option


39
40
41
# File 'lib/trema/controller.rb', line 39

def initialize(user_options)
  @user_options = user_options
end

Instance Method Details

#to_hashObject

rubocop:disable MethodLength rubocop:disable CyclomaticComplexity rubocop:disable PerceivedComplexity


46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/trema/controller.rb', line 46

def to_hash
  {
    command: :add,
    priority: @user_options[:priority] || 0,
    transaction_id: rand(0xffffffff),
    idle_timeout: @user_options[:idle_timeout] || 0,
    hard_timeout: @user_options[:hard_timeout] || 0,
    buffer_id: @user_options[:buffer_id] || 0xffffffff,
    match: @user_options.fetch(:match),
    table_id: @user_options[:table_id] || 0,
    flags: @user_options[:flags] || [],
    instructions: @user_options[:instructions] || []
  }
end