Class: Pio::OpenFlow13::FlowMod::Instructions
- Inherits:
-
BinData::Primitive
- Object
- BinData::Primitive
- Pio::OpenFlow13::FlowMod::Instructions
- Defined in:
- lib/pio/open_flow13/flow_mod.rb
Overview
OpenFlow 1.3 instructions
Instance Method Summary collapse
-
#get ⇒ Object
rubocop:disable MethodLength.
-
#length ⇒ Object
rubocop:enable MethodLength.
- #set(instructions) ⇒ Object
Instance Method Details
#get ⇒ Object
rubocop:disable MethodLength
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/pio/open_flow13/flow_mod.rb', line 78 def get list = [] tmp = instructions until tmp.empty? instruction_type = BinData::Uint16be.read(tmp) instruction = case instruction_type when 1 GotoTable.read(tmp) when 2 WriteMetadata.read(tmp) when 4 Apply.read(tmp) when 6 Meter.read(tmp) else raise "Unsupported instruction #{instruction_type}" end tmp = tmp[instruction.instruction_length..-1] list << instruction end list end |
#length ⇒ Object
rubocop:enable MethodLength
102 103 104 |
# File 'lib/pio/open_flow13/flow_mod.rb', line 102 def length instructions.length end |
#set(instructions) ⇒ Object
73 74 75 |
# File 'lib/pio/open_flow13/flow_mod.rb', line 73 def set(instructions) self.instructions = Array(instructions).map(&:to_binary_s).join end |