Class: Pio::OpenFlow::Actions10
- Inherits:
-
BinData::Primitive
- Object
- BinData::Primitive
- Pio::OpenFlow::Actions10
- Defined in:
- lib/pio/open_flow10/actions.rb
Overview
Actions list.
Constant Summary collapse
- ACTION_CLASS =
{ 0 => OpenFlow10::SendOutPort, 1 => OpenFlow10::SetVlanVid, 2 => OpenFlow10::SetVlanPriority, 3 => OpenFlow10::StripVlanHeader, 4 => OpenFlow10::SetSourceMacAddress, 5 => OpenFlow10::SetDestinationMacAddress, 6 => OpenFlow10::SetSourceIpAddress, 7 => OpenFlow10::SetDestinationIpAddress, 8 => OpenFlow10::SetTos, 9 => OpenFlow10::SetTransportSourcePort, 10 => OpenFlow10::SetTransportDestinationPort, 11 => OpenFlow10::Enqueue, 0xffff => OpenFlow10::VendorAction }.freeze
Instance Method Summary collapse
-
#[](index) ⇒ Object
rubocop:enable MethodLength.
-
#get ⇒ Object
rubocop:disable MethodLength This method smells of :reek:TooManyStatements.
- #set(actions) ⇒ Object
Instance Method Details
#[](index) ⇒ Object
rubocop:enable MethodLength
66 67 68 |
# File 'lib/pio/open_flow10/actions.rb', line 66 def [](index) get[index] end |
#get ⇒ Object
rubocop:disable MethodLength This method smells of :reek:TooManyStatements
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/pio/open_flow10/actions.rb', line 49 def get actions = [] tmp = binary until tmp.empty? type = BinData::Uint16be.read(tmp) begin action = ACTION_CLASS.fetch(type).read(tmp) tmp = tmp[action.action_length..-1] actions << action rescue KeyError raise "action type #{type} is not supported." end end actions end |
#set(actions) ⇒ Object
43 44 45 |
# File 'lib/pio/open_flow10/actions.rb', line 43 def set(actions) self.binary = Array(actions).map(&:to_binary).join end |