Sha256: 7641dd6650f589afb87ff559ea12e6427d4198ec12a20f82c070b721c2c56754

Contents?: true

Size: 620 Bytes

Versions: 4

Compression:

Stored size: 620 Bytes

Contents

require 'pio/open_flow/action'

module Pio
  module OpenFlow10
    # An action to modify the VLAN ID of a packet.
    class SetVlanVid < OpenFlow::Action
      action_header action_type: 1, action_length: 8
      uint16 :vlan_id
      string :padding, length: 2
      hide :padding

      def initialize(number)
        vlan_id = number.to_i
        unless vlan_id >= 1 && vlan_id <= 4095
          fail 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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pio-0.30.0 lib/pio/open_flow10/set_vlan_vid.rb
pio-0.29.0 lib/pio/open_flow10/set_vlan_vid.rb
pio-0.28.1 lib/pio/open_flow10/set_vlan_vid.rb
pio-0.28.0 lib/pio/open_flow10/set_vlan_vid.rb