Class: SetFieldAction

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

Overview

Class to define OpenFlow action to set a field.

Instance Attribute Summary

Attributes inherited from Action

#order

Instance Method Summary collapse

Constructor Details

#initialize(order: 0, vlan_id: nil, mpls_label: nil) ⇒ SetFieldAction

Parameters

  • order

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

  • vlan_id

    integer : VLAN identifier to set.

  • mpls_label

    integer : MPLS label to set.



38
39
40
41
42
# File 'lib/openflowdev/actions/set_field_action.rb', line 38

def initialize(order: 0, vlan_id: nil, mpls_label: nil)
  super(order: order)
  @vlan_id = vlan_id
  @mpls_label = mpls_label
end

Instance Method Details

#to_hashObject

:nodoc:



44
45
46
47
48
# File 'lib/openflowdev/actions/set_field_action.rb', line 44

def to_hash #:nodoc:
  {:order => @order, 'set-field' => {'vlan-match' => {'vlan-id' =>
          {'vlan-id' => @vlan_id, 'vlan-id-present' => !@vlan_id.nil?}},
      'protocol-match-fields' => {'mpls-label' => @mpls_label}}}
end