class Pio::OpenFlow13::FlowMod::Instructions
OpenFlow
1.3 instructions
Public Instance Methods
get()
click to toggle source
rubocop:disable MethodLength
# 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()
click to toggle source
rubocop:enable MethodLength
# File lib/pio/open_flow13/flow_mod.rb, line 102 def length instructions.length end
set(instructions)
click to toggle source
# File lib/pio/open_flow13/flow_mod.rb, line 73 def set(instructions) self.instructions = Array(instructions).map(&:to_binary_s).join end