Class: Trema::Controller::FlowModAddOption

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

Overview

Pio::FlowMod.new argument

Instance Method Summary collapse

Constructor Details

#initialize(user_options) ⇒ FlowModAddOption

Returns a new instance of FlowModAddOption.



20
21
22
# File 'lib/trema/controller.rb', line 20

def initialize(user_options)
  @user_options = user_options
end

Instance Method Details

#to_hashObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/trema/controller.rb', line 24

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),
    actions: @user_options[:actions] || []
  }
end