Class: Netdisco::XDP

Inherits:
Object
  • Object
show all
Includes:
NameMap
Defined in:
lib/netdisco/method/xdp.rb

Direct Known Subclasses

CDP, LLDP

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NameMap

#name_map

Constructor Details

#initialize(host) ⇒ XDP

对象实例化入口函数



15
16
17
# File 'lib/netdisco/method/xdp.rb', line 15

def initialize(host)
  @snmp = SNMP.new host
end

Instance Attribute Details

#mibObject (readonly)

类对象方法属性



9
10
11
# File 'lib/netdisco/method/xdp.rb', line 9

def mib
  @mib
end

Class Method Details

.peers(host) ⇒ Array(Netdisco::Peer)

类属性方法

Parameters:

  • host (String)

    host to query

Returns:



22
23
24
# File 'lib/netdisco/method/xdp.rb', line 22

def self.peers(host)
  new(host).poll
end

Instance Method Details

#pollObject

轮询设备邻居关系



27
28
29
30
31
32
# File 'lib/netdisco/method/xdp.rb', line 27

def poll
  @mib = @snmp.hashwalk self.class::MIB
  make_peers
rescue SNMP::NoResponse
  []
end