Class: Trema::Controller::PacketOutOption
- Inherits:
-
Object
- Object
- Trema::Controller::PacketOutOption
- Defined in:
- lib/trema/controller.rb
Overview
Pio::PacketOut.new argument
Instance Method Summary collapse
-
#initialize(user_options) ⇒ PacketOutOption
constructor
A new instance of PacketOutOption.
-
#to_hash ⇒ Object
rubocop:disable MethodLength.
Constructor Details
#initialize(user_options) ⇒ PacketOutOption
Returns a new instance of PacketOutOption.
85 86 87 |
# File 'lib/trema/controller.rb', line 85 def initialize() @user_options = end |
Instance Method Details
#to_hash ⇒ Object
rubocop:disable MethodLength
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/trema/controller.rb', line 90 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 |