Class: SetNwSrcAction

Inherits:
Action
  • Object
show all
Defined in:
lib/openflowdev/actions/set_nw_src_action.rb

Overview

Class used to define OpenFlow action for setting the Source IP address (network layer)

Instance Attribute Summary

Attributes inherited from Action

#order

Instance Method Summary collapse

Constructor Details

#initialize(order: nil, ip_addr: nil) ⇒ SetNwSrcAction

Parameters

  • order

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

  • ip_addr

    string : The IP address to set in source IP

Raises:

  • (ArgumentError)


37
38
39
40
41
# File 'lib/openflowdev/actions/set_nw_src_action.rb', line 37

def initialize(order: nil, ip_addr: nil)
  super(order: order)
  raise ArgumentError, "IP Address (ip_addr) required" unless ip_addr
  @ip = ip_addr
end

Instance Method Details

#to_hashObject

:nodoc:



43
44
45
# File 'lib/openflowdev/actions/set_nw_src_action.rb', line 43

def to_hash #:nodoc:
  {:order => @order, 'set-nw-src-action' => {:address => @ip}}
end