Class: Pio::OpenFlow::Actions
- Inherits:
-
BinData::Primitive
- Object
- BinData::Primitive
- Pio::OpenFlow::Actions
- Defined in:
- lib/pio/open_flow/actions.rb
Overview
Actions list.
Constant Summary collapse
- ACTION_CLASS =
{ 0 => Pio::SendOutPort, 1 => Pio::SetVlanVid, 2 => Pio::SetVlanPriority, 3 => Pio::StripVlanHeader, 4 => Pio::SetEthSrcAddr, 5 => Pio::SetEthDstAddr, 6 => Pio::SetIpSrcAddr, 7 => Pio::SetIpDstAddr, 8 => Pio::SetIpTos, 9 => Pio::SetTransportSrcPort, 10 => Pio::SetTransportDstPort, 11 => Pio::Enqueue }
Instance Method Summary collapse
-
#[](index) ⇒ Object
rubocop:enable MethodLength.
-
#get ⇒ Object
rubocop:disable MethodLength This method smells of :reek:TooManyStatements.
- #set(value) ⇒ Object
Instance Method Details
#[](index) ⇒ Object
rubocop:enable MethodLength
60 61 62 |
# File 'lib/pio/open_flow/actions.rb', line 60 def [](index) get[index] end |
#get ⇒ Object
rubocop:disable MethodLength This method smells of :reek:TooManyStatements
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/pio/open_flow/actions.rb', line 43 def get actions = [] tmp = binary while tmp.length > 0 type = BinData::Uint16be.read(tmp) begin action = ACTION_CLASS.fetch(type).read(tmp) tmp = tmp[action...-1] actions << action rescue KeyError raise "action type #{type} is not supported." end end actions end |
#set(value) ⇒ Object
37 38 39 |
# File 'lib/pio/open_flow/actions.rb', line 37 def set(value) self.binary = [value].flatten.map(&:to_binary).join end |