Class: SetVlanPCPAction

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

Overview

Class used to define OpenFlow action to set the PCP field in VLAN header

Instance Attribute Summary

Attributes inherited from Action

#order

Instance Method Summary collapse

Constructor Details

#initialize(order: nil, vlan_pcp: nil) ⇒ SetVlanPCPAction

Parameters

  • order

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

  • vlan_pcp

    integer : The valoue to set in the PCP field in VLAN header.

Raises:

  • (ArgumentError)


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

def initialize(order: nil, vlan_pcp: nil)
  super(order: order)
  raise ArgumentError, "VLAN PCP (vlan_pcp) required" unless vlan_pcp
  @vlan_pcp = vlan_pcp
end

Instance Method Details

#to_hashObject

:nodoc:



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

def to_hash #:nodoc:
  {:order => @order, 'set-vlan-pcp-action' => {'vlan-pcp' => @vlan_pcp}}
end