Class: Pio::OpenFlow10::SetVlanVid

Inherits:
Pio::OpenFlow::Action show all
Defined in:
lib/pio/open_flow10/set_vlan_vid.rb

Overview

An action to modify the VLAN ID of a packet.

Instance Method Summary collapse

Methods inherited from Pio::OpenFlow::Action

action_header, method_missing, read, #to_binary

Constructor Details

#initialize(number) ⇒ SetVlanVid

Returns a new instance of SetVlanVid.



14
15
16
17
18
19
20
21
22
# File 'lib/pio/open_flow10/set_vlan_vid.rb', line 14

def initialize(number)
  vlan_id = number.to_i
  unless vlan_id >= 1 && vlan_id <= 4095
    raise ArgumentError, 'VLAN ID must be between 1 and 4095 inclusive'
  end
  super(vlan_id: vlan_id)
rescue NoMethodError
  raise TypeError, 'VLAN ID must be an Integer.'
end