Class: Trema::Enqueue
Overview
An action to enqueue the packet on the specified queue attached to a port.
Instance Attribute Summary collapse
-
#port_number ⇒ Object
readonly
Returns the value of attribute port_number.
-
#queue_id ⇒ Object
readonly
Returns the value of attribute queue_id.
Instance Method Summary collapse
-
#initialize(options) ⇒ Enqueue
constructor
Creates an action to enqueue the packet on the specified queue attached to a port.
Constructor Details
#initialize(options) ⇒ Enqueue
Creates an action to enqueue the packet on the specified queue attached to a port. When a queue is configured the user can associate a flow with this action to forward a packet through the specific queue in that port.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'ruby/trema/enqueue.rb', line 56 def initialize if .is_a?( Hash ) @port_number = [ :port_number ] @queue_id = [ :queue_id ] if @port_number.nil? raise ArgumentError, "Port number is a mandatory option" end unless @port_number.unsigned_16bit? raise ArgumentError, "Port number must be an unsigned 16-bit integer" end if @queue_id.nil? raise ArgumentError, "Queue ID is a mandatory option" end unless @queue_id.unsigned_32bit? raise ArgumentError, "Queue ID must be an unsigned 32-bit integer" end else raise "Invalid option" end end |
Instance Attribute Details
#port_number ⇒ Object (readonly)
Returns the value of attribute port_number.
29 30 31 |
# File 'ruby/trema/enqueue.rb', line 29 def port_number @port_number end |
#queue_id ⇒ Object (readonly)
Returns the value of attribute queue_id.
30 31 32 |
# File 'ruby/trema/enqueue.rb', line 30 def queue_id @queue_id end |