Class: Pio::Lldp::Options
Overview
User options for creating an LLDP frame.
Constant Summary collapse
- DEFAULT_DESTINATION_MAC =
'01:80:c2:00:00:0e'.freeze
- DEFAULT_SOURCE_MAC =
'01:02:03:04:05:06'.freeze
Instance Method Summary collapse
-
#initialize(options) ⇒ Options
constructor
A new instance of Options.
- #to_hash ⇒ Object
Methods inherited from Options
Constructor Details
#initialize(options) ⇒ Options
Returns a new instance of Options.
17 18 19 20 21 22 23 24 25 |
# File 'lib/pio/lldp/options.rb', line 17 def initialize() validate @dpid = [:dpid].freeze @port_id = [:port_number].freeze @destination_mac = Mac.new([:destination_mac] || DEFAULT_DESTINATION_MAC).freeze @source_mac = Mac.new([:source_mac] || DEFAULT_SOURCE_MAC).freeze end |
Instance Method Details
#to_hash ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/pio/lldp/options.rb', line 27 def to_hash { chassis_id: @dpid, port_id: @port_id, destination_mac: @destination_mac, source_mac: @source_mac }.freeze end |