mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Extra VLAN mapping in bridge FDB module to fix HP ProCurve (#11230)
* Extra mapping for dot1qVlanFdbId to allow FDB VLANs to work on ProCurve * Test data from joseUPV for ProCurve FDB VLANs
This commit is contained in:
@@ -19,12 +19,11 @@
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 Tony Murray
|
||||
* @copyright 2017 Tony Murray
|
||||
* @copyright LibreNMS contributors
|
||||
* @author Tony Murray <murraytony@gmail.com>
|
||||
* @author cjwbath
|
||||
*/
|
||||
|
||||
|
||||
// Try Q-BRIDGE-MIB::dot1qTpFdbPort first
|
||||
$fdbPort_table = snmpwalk_group($device, 'dot1qTpFdbPort', 'Q-BRIDGE-MIB');
|
||||
if (!empty($fdbPort_table)) {
|
||||
@@ -48,9 +47,27 @@ if (!empty($fdbPort_table)) {
|
||||
$port = get_port_by_index_cache($device['device_id'], $data['dot1dBasePortIfIndex']);
|
||||
$portid_dict[$portLocal] = $port['port_id'];
|
||||
}
|
||||
|
||||
// Build VLAN fdb index to real VLAN ID dictionary
|
||||
$vlan_cur_table = snmpwalk_group($device, 'dot1qVlanFdbId', 'Q-BRIDGE-MIB', 2);
|
||||
$vlan_fdb_dict = array();
|
||||
|
||||
// Indexed first by dot1qVlanTimeMark, which we ignore
|
||||
foreach ($vlan_cur_table as $dot1qVlanTimeMark => $a) {
|
||||
// Then by VLAN ID mapped to a single member array with the dot1qVlanFdbId
|
||||
foreach ($a as $vid => $data) {
|
||||
// Flip it round into the dictionary
|
||||
$vlan_fdb_dict[$data['dot1qVlanFdbId']] = $vid;
|
||||
}
|
||||
}
|
||||
|
||||
// Collect data and populate $insert
|
||||
foreach ($fdbPort_table as $vlan => $data) {
|
||||
foreach ($fdbPort_table as $vlanIndex => $data) {
|
||||
// Look the dot1qVlanFdbId up to a real VLAN number; if undefined assume the
|
||||
// index *is* the VLAN number. Code in fdb-table.inc.php to map to the
|
||||
// device VLANs table should catch anything invalid.
|
||||
$vlan = isset($vlan_fdb_dict[$vlanIndex]) ? $vlan_fdb_dict[$vlanIndex] : $vlanIndex;
|
||||
|
||||
foreach ($data[$data_oid] as $mac => $dot1dBasePort) {
|
||||
if ($dot1dBasePort == 0) {
|
||||
d_echo("No port known for $mac\n");
|
||||
|
||||
14030
tests/data/procurve_2520.json
Normal file
14030
tests/data/procurve_2520.json
Normal file
File diff suppressed because it is too large
Load Diff
2633
tests/snmpsim/procurve_2520.snmprec
Normal file
2633
tests/snmpsim/procurve_2520.snmprec
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user