Class: OutputAction

Inherits:
Action show all
Defined in:
lib/openflowdev/actions/output_action.rb

Overview

Class to define an OpenFlow output action

Instance Attribute Summary

Attributes inherited from Action

#order

Instance Method Summary collapse

Constructor Details

#initialize(order: 0, port: nil, max_length: nil) ⇒ OutputAction

Parameters

  • order

    integer : The order of the action relative to other actions in Instruction.

  • port

    integer : the port to target for output

  • max_length

    integer : When the ’port’ is the controller, this indicates the max number of

bytes to send. A value of zero means no bytes of the packet should be sent. A value of OFPCML_NO_BUFFER (0xffff) means that the packet is not buffered and the complete packet is to be sent to the controller.

Raises:

  • (ArgumentError)


41
42
43
44
45
46
# File 'lib/openflowdev/actions/output_action.rb', line 41

def initialize(order: 0, port: nil, max_length: nil)
  super(order: order)
  raise ArgumentError, "Port (port) required" unless port
  @port = port
  @max_length = max_length
end

Instance Method Details

#to_hashObject

:nodoc:



48
49
50
51
# File 'lib/openflowdev/actions/output_action.rb', line 48

def to_hash #:nodoc:
  {:order => @order, 'output-action' => {'max-length' => @max_length,
    'output-node-connector' => @port}}
end