Class: Pio::OpenFlow10::PacketIn

Inherits:
Pio::OpenFlow::Message show all
Defined in:
lib/pio/open_flow10/packet_in.rb,
lib/pio/open_flow10/packet_in/reason.rb

Overview

OpenFlow 1.0 Packet-In message

Defined Under Namespace

Classes: Reason

Instance Attribute Summary collapse

Attributes inherited from Pio::OpenFlow::Message

#format

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pio::OpenFlow::Message

#initialize, method_missing, open_flow_header, read, #to_binary

Methods included from Pio::OpenFlow::Flags

#_define_flags, #_flags, #define_flags_32bit, #flags_16bit, #flags_32bit

Constructor Details

This class inherits a constructor from Pio::OpenFlow::Message

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object

rubocop:enable LineLength



51
52
53
54
# File 'lib/pio/open_flow10/packet_in.rb', line 51

def method_missing(method, *args)
  bindata_value = data.__send__(method, *args)
  bindata_value.try(:snapshot) || bindata_value
end

Instance Attribute Details

#datapath_idObject Also known as: dpid

Returns the value of attribute datapath_id.



56
57
58
# File 'lib/pio/open_flow10/packet_in.rb', line 56

def datapath_id
  @datapath_id
end

Class Method Details

.inspectObject

rubocop:disable LineLength



35
36
37
# File 'lib/pio/open_flow10/packet_in.rb', line 35

def self.inspect
  'PacketIn(open_flow_version: uint8, message_type: uint8, message_length: uint16, transaction_id: uint32, buffer_id: uint32, total_length: uint16, in_port: uint16, reason: symbol, raw_data: string)'
end

Instance Method Details

#dataObject



22
23
24
# File 'lib/pio/open_flow10/packet_in.rb', line 22

def data
  @data ||= Pio::Parser.read(raw_data)
end

#inspectObject

rubocop:disable LineLength



41
42
43
44
45
46
47
48
# File 'lib/pio/open_flow10/packet_in.rb', line 41

def inspect
  data_inspection = if raw_data.empty?
                      %(raw_data: "")
                    else
                      %(data: #{data.inspect})
                    end
  %(#<PacketIn open_flow_version: #{version}, message_type: #{type}, message_length: #{_length}, transaction_id: #{Kernel.format('0x%x', transaction_id)}, buffer_id: #{Kernel.format('0x%x', buffer_id)}, total_length: #{total_length}, in_port: #{in_port}, reason: :#{reason}, #{data_inspection}>)
end

#lldp?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/pio/open_flow10/packet_in.rb', line 26

def lldp?
  data.is_a? Lldp
end

#to_rubyObject



30
31
32
# File 'lib/pio/open_flow10/packet_in.rb', line 30

def to_ruby
  @format.to_ruby
end