Sha256: 74d778d4198797a6657c7afcfbd2729291ab0b6ece87a7eb33916add69ba9ff2

Contents?: true

Size: 647 Bytes

Versions: 4

Compression:

Stored size: 647 Bytes

Contents

require 'pio/open_flow/action'

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

      def initialize(number)
        priority = number.to_i
        if priority < 0 || priority > 7
          fail ArgumentError, 'VLAN priority must be between 0 and 7 inclusive'
        end
        super(vlan_priority: priority)
      rescue NoMethodError
        raise TypeError, 'VLAN priority 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_priority.rb
pio-0.29.0 lib/pio/open_flow10/set_vlan_priority.rb
pio-0.28.1 lib/pio/open_flow10/set_vlan_priority.rb
pio-0.28.0 lib/pio/open_flow10/set_vlan_priority.rb