Skip to content

Commit

Permalink
Add Pio::OpenFlow10::PacketIn.inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Jul 11, 2016
1 parent b835460 commit 6ab3bf7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions features/open_flow10/packet_in.feature
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,13 @@ Feature: PacketIn
"""
#<PacketIn open_flow_version: 1, message_type: 10, message_length: 82, transaction_id: 0x0, buffer_id: 0xffffff00, total_length: 64, in_port: 1, reason: :no_match, data: #<Arp::Request destination_mac: "ff:ff:ff:ff:ff:ff", source_mac: "fa:ce:b0:00:00:cc", ether_type: 0x0806, hardware_type: 1, protocol_length: 4, operation: 1, sender_hardware_address: "fa:ce:b0:00:00:cc", sender_protocol_address: "192.168.0.1", target_hardware_address: "00:00:00:00:00:00", target_protocol_address: "192.168.0.2">>
"""

Scenario: PacketIn class inspection
When I eval the following Ruby code:
"""ruby
Pio::PacketIn.inspect
"""
Then the result of eval should be:
"""
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)
"""
6 changes: 6 additions & 0 deletions lib/pio/open_flow10/packet_in.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ def to_ruby
@format.to_ruby
end

# rubocop:disable LineLength
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
# rubocop:enable LineLength

# rubocop:disable LineLength
def inspect
data_inspection = if raw_data.empty?
Expand Down

0 comments on commit 6ab3bf7

Please sign in to comment.