mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
Merge pull request #1705 from vitalisator/issue-1702
add LLDP discovery support on PBN devices
This commit is contained in:
@@ -78,11 +78,44 @@ if ($config['autodiscovery']['xdp'] === true) {
|
||||
}//end if
|
||||
}//end if
|
||||
|
||||
echo ' LLDP-MIB: ';
|
||||
|
||||
unset($lldp_array);
|
||||
|
||||
if ($config['autodiscovery']['xdp'] === true) {
|
||||
if ($device['os'] == 'pbn' && $config['autodiscovery']['xdp'] === true) {
|
||||
|
||||
echo ' NMS-LLDP-MIB: ';
|
||||
$lldp_array = snmpwalk_cache_oid($device, 'lldpRemoteSystemsData', array(), 'NMS-LLDP-MIB');
|
||||
d_echo($lldp_array);
|
||||
if ($lldp_array) {
|
||||
unset($lldp_links);
|
||||
foreach (array_keys($lldp_array) as $key) {
|
||||
$lldp = $lldp_array[$key];
|
||||
d_echo($lldp);
|
||||
$interface = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $lldp['lldpRemLocalPortNum']));
|
||||
$remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?', array($lldp['lldpRemSysName'], $lldp['lldpRemSysName']));
|
||||
|
||||
if (!$remote_device_id && is_valid_hostname($lldp['lldpRemSysName'])) {
|
||||
$remote_device_id = discover_new_device($lldp['lldpRemSysName'], $device, 'LLDP', $interface);
|
||||
}
|
||||
|
||||
if ($remote_device_id) {
|
||||
$if = $lldp['lldpRemPortDesc'];
|
||||
$id = $lldp['lldpRemPortId'];
|
||||
$remote_port_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE (`ifDescr` = ? OR `ifName` = ? OR `ifDescr` = ? OR `ifName` = ?) AND `device_id` = ?', array($if, $if, $id, $id, $remote_device_id));
|
||||
}
|
||||
else {
|
||||
$remote_port_id = '0';
|
||||
}
|
||||
|
||||
if (is_numeric($interface['port_id']) && isset($lldp['lldpRemSysName']) && isset($lldp['lldpRemPortId'])) {
|
||||
discover_link($interface['port_id'], 'lldp', $remote_port_id, $lldp['lldpRemSysName'], $lldp['lldpRemPortId'], null, $lldp['lldpRemSysDesc'], $device['device_id'], $remote_device_id);
|
||||
}
|
||||
}//end foreach
|
||||
}//end if
|
||||
|
||||
} elseif ($config['autodiscovery']['xdp'] === true) {
|
||||
|
||||
echo ' LLDP-MIB: ';
|
||||
$lldp_array = snmpwalk_cache_threepart_oid($device, 'lldpRemoteSystemsData', array(), 'LLDP-MIB');
|
||||
d_echo($lldp_array);
|
||||
$dot1d_array = snmpwalk_cache_oid($device, 'dot1dBasePortIfIndex', array(), 'BRIDGE-MIB');
|
||||
@@ -127,7 +160,7 @@ if ($config['autodiscovery']['xdp'] === true) {
|
||||
}//end foreach
|
||||
}//end foreach
|
||||
}//end if
|
||||
}//end if
|
||||
}//end elseif
|
||||
|
||||
echo 'OSPF Discovery: ';
|
||||
|
||||
|
||||
+2112
File diff suppressed because it is too large
Load Diff
+100
@@ -0,0 +1,100 @@
|
||||
-- *****************************************************************
|
||||
-- NMS-SMI.my: NMS Enterprise Structure of Management Information
|
||||
--
|
||||
-- June 2000
|
||||
-- December 2010 PBN V2
|
||||
-- *****************************************************************
|
||||
|
||||
NMS-SMI DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
|
||||
OBJECT-IDENTITY,
|
||||
FROM SNMPv2-SMI
|
||||
|
||||
pbn
|
||||
FROM PBN-ROOT;
|
||||
|
||||
|
||||
nms OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"nms Products is the root OBJECT IDENTIFIER from
|
||||
which sysObjectID values are assigned."
|
||||
::= { pbn 10}
|
||||
|
||||
|
||||
|
||||
nmsProducts OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"nms Products is the root OBJECT IDENTIFIER from
|
||||
which sysObjectID values are assigned."
|
||||
::= { nms 1 }
|
||||
|
||||
nmslocal OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Subtree beneath which pre-10.2 MIBS were built."
|
||||
::= { nms 2 }
|
||||
|
||||
nmstemporary OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Subtree beneath which pre-10.2 experiments were
|
||||
placed."
|
||||
::= { nms 3 }
|
||||
|
||||
nmsMgmt OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"nmsMgmt is the main subtree for new mib development."
|
||||
::= { nms 9 }
|
||||
nmsModules OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"nmsModules provides a root object identifier
|
||||
from which MODULE-IDENTITY values may be assigned."
|
||||
::= { nms 12 }
|
||||
nmsPolicyAuto OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"nmsPolicyAuto is the root of the nms-assigned
|
||||
OID subtree for OIDs which are automatically assigned
|
||||
for use in Policy Management."
|
||||
::= { nms 18 }
|
||||
|
||||
-- Note that 1.3.6.1.4.1.9.18.1 is currently unassigned
|
||||
|
||||
nmsPibToMib OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"nmsPibToMib is the root of the nms-assigned
|
||||
OID subtree for MIBs which are algorithmically
|
||||
generated/translated from nms PIBs with OIDs
|
||||
assigned under the nmsPIB subtree.
|
||||
These generated MIBs allow management
|
||||
entities (other the current Policy Server) to
|
||||
read the downloaded policy. By convention, for PIB
|
||||
'nmsPIB.x', the generated MIB shall have the
|
||||
name 'nmsPibToMib.x'."
|
||||
::= { nmsPolicyAuto 2 }
|
||||
|
||||
nmsWorkGroup OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"nmsWorkGroup is the main subtree for new mib development categorized by module function."
|
||||
::= { nms 20 }
|
||||
|
||||
|
||||
nmsEPONGroup OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"nmsEPONGroup is the main subtree for new epon mib ."
|
||||
::= { nms 101 }
|
||||
|
||||
|
||||
|
||||
|
||||
END
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
-- ****************************************************************************
|
||||
-- *
|
||||
-- *
|
||||
-- * File Status: ADOPTED JULY 11, 2010
|
||||
-- *
|
||||
-- * This MIB provides the root object identifier for the
|
||||
-- * Pacific Broadband Networks (PBN) as an enterprise,
|
||||
-- * as assigned by the Internet Assigned Numbers Authority (IANA).
|
||||
-- *
|
||||
-- *
|
||||
-- ****************************************************************************
|
||||
|
||||
PBN-ROOT DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
enterprises
|
||||
FROM RFC1155-SMI
|
||||
;
|
||||
|
||||
pbn OBJECT IDENTIFIER ::= { enterprises 11606 }
|
||||
|
||||
-- DESCRIPTION
|
||||
-- "pbn defines the main root of the PBN Enterprises MIB tree. "
|
||||
|
||||
|
||||
END
|
||||
|
||||
Reference in New Issue
Block a user