Class: Pio::OpenFlow13::Actions13

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/pio/open_flow13/actions.rb

Overview

Actions list of actions-apply instruction.

Instance Method Summary collapse

Instance Method Details

#getObject

rubocop:disable MethodLength



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/pio/open_flow13/actions.rb', line 33

def get
  actions = []
  tmp = binary
  until tmp.empty?
    action = case BinData::Uint16be.read(tmp)
             when 0
               OpenFlow13::SendOutPort.read(tmp)
             else
               UnsupportedAction.read(tmp)
             end
    tmp = tmp[action.action_length..-1]
    actions << action
  end
  actions
end

#set(actions) ⇒ Object



28
29
30
# File 'lib/pio/open_flow13/actions.rb', line 28

def set(actions)
  self.binary = Array(actions).map(&:to_binary).join
end