Skip to content

Commit

Permalink
Merge branch 'release/0.18.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Mar 11, 2015
2 parents 73ab68d + 0577716 commit c0b857e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog

## develop (unreleased)


## 0.18.1 (3/11/2015)
### Changes
* `Lldp#port_number` returns primitive Ruby objects.


## 0.18.0 (3/9/2015)
### Changes
* Deprecated `Pio::Mac#== Integer`.
* `Pio::PacketIn#source_mac` and `Pio::PacketIn#destination_mac` returns `Pio::Mac`.
Expand Down
16 changes: 16 additions & 0 deletions features/lldp_read.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ Feature: Pio::Lldp.read
Given a packet data file "lldp.minimal.pcap"
When I try to parse the file with "Lldp" class
Then it should finish successfully
Then the parsed data #1 have the following field and value:
| field | value |
| class | Pio::Lldp |
| destination_mac | 01:80:c2:00:00:0e |
| source_mac | 00:04:96:1f:a7:26 |
| ether_type | 35020 |
| chassis_id | 19698525990 |
| dpid | 19698525990 |
| port_id | 1/3 |
| ttl | 120 |
| port_description | |
| system_name | |
| system_description | |
| system_capabilities | |
| management_address | |
| organizationally_specific | |

Scenario: lldp.detailed.pcap
Given a packet data file "lldp.detailed.pcap"
Expand Down
5 changes: 4 additions & 1 deletion lib/pio/lldp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class Lldp
def_delegator :@frame, :dpid
def_delegator :@frame, :optional_tlv
def_delegator :@frame, :port_id
alias_method :port_number, :port_id
def_delegator :@frame, :ttl
def_delegator :@frame, :port_description
def_delegator :@frame, :system_name
Expand All @@ -42,6 +41,10 @@ def initialize(options)
@frame = Frame.new(Options.new(options).to_hash)
end

def port_number
@frame.port_id.get.snapshot
end

def to_binary
@frame.to_binary_s + "\000" * (64 - @frame.num_bytes)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pio/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base module.
module Pio
# gem version.
VERSION = '0.18.0'.freeze
VERSION = '0.18.1'.freeze
end
2 changes: 2 additions & 0 deletions spec/pio/lldp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
Then { lldp.chassis_id == 0x192fa7b28d }
Then { lldp.port_id == 'Uplink to S1' }
Then { lldp.port_number == 'Uplink to S1' }
Then { lldp.port_number.class == String }
Then { lldp.ttl == 120 }
Then { lldp.port_description == nil }
Then { lldp.system_name == nil }
Expand Down Expand Up @@ -214,6 +215,7 @@
Then { lldp.chassis_id == 0x192fa7b28d }
Then { lldp.port_id == 'Uplink to S1' }
Then { lldp.port_number == 'Uplink to S1' }
Then { lldp.port_number.class == String }
Then { lldp.ttl == 120 }
Then { lldp.port_description == 'Summit300-48-Port 1001' }
Then { lldp.system_name == 'Summit300-48' }
Expand Down

0 comments on commit c0b857e

Please sign in to comment.