Sha256: b34a50effc53ef3577fca62b5aa17a3428e37ab62cf486de0801cc4eb84336f7
Contents?: true
Size: 982 Bytes
Versions: 3
Compression:
Stored size: 982 Bytes
Contents
# frozen_string_literal: true require_relative "../snmp" class Netdisco class XDP # 类对象方法属性 attr_reader :mib # 加载模块方法到类对象 include NameMap # 对象实例化入口函数 def initialize(host) @snmp = SNMP.new host end # 类属性方法 # @param [String] host host to query # @return [Array(Netdisco::Peer)] neighbor information def self.peers(host) new(host).poll end # 轮询设备邻居关系 def poll @mib = @snmp.hashwalk self.class::MIB # require "pp"; PP.pp @mib make_peers rescue SNMP::NoResponse [] end private def get_ip(ip, name) DNS.getip(name_map(name)) || ip end def get_oid_hash(peer_id) oid_hash = {} self.class::OID.each do |name, oid| oid_hash[name] = @mib[oid, peer_id] end oid_hash end end end require_relative "cdp" require_relative "lldp"
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
netdisco-0.0.4 | lib/netdisco/method/xdp.rb |
netdisco-0.0.3 | lib/netdisco/method/xdp.rb |
netdisco-0.0.2 | lib/netdisco/method/xdp.rb |