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

Returns a new instance of FlowModAdd13Option.



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

def initialize(user_options)
  @user_options = user_options
end

Instance Method Details

#to_hashObject

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



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

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