mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: Fixed Q-BRIDGE-MIB VLANs (#8623)
* Fix Q-BRIDGE-MIB VLANs Properly handle dot1qVlanTimeMark index (by ignoring it instead of assuming it is 0) Adds test data for at least one device that uses Q-BRIDGE-MIB. Fixes: #8516 * fix whitespace * remove unused variable
This commit is contained in:
committed by
Neil Lathwood
parent
df763931d7
commit
d1e8e2177f
@@ -53,6 +53,7 @@ class ModuleTestHelper
|
||||
private $exclude_from_all = ['arp-table'];
|
||||
private $module_deps = [
|
||||
'arp-table' => ['ports', 'arp-table'],
|
||||
'vlans' => ['ports', 'vlans'],
|
||||
];
|
||||
|
||||
|
||||
@@ -686,7 +687,7 @@ class ModuleTestHelper
|
||||
return array_diff_key($row, $keys);
|
||||
}, $rows);
|
||||
}
|
||||
|
||||
|
||||
if (isset($key)) {
|
||||
$data[$module][$key][$table] = $rows;
|
||||
} else {
|
||||
|
@@ -11,6 +11,18 @@ if ($vlanversion == 'version1' || $vlanversion == '2') {
|
||||
$tagoruntag = snmpwalk_cache_oid($device, 'dot1qVlanCurrentEgressPorts', array(), 'Q-BRIDGE-MIB', null, '-OQUs --hexOutputLength=0');
|
||||
$untag = snmpwalk_cache_oid($device, 'dot1qVlanCurrentUntaggedPorts', array(), 'Q-BRIDGE-MIB', null, '-OQUs --hexOutputLength=0');
|
||||
|
||||
// drop dot1qVlanTimeMark, we don't care about it
|
||||
$tagoruntag = array_reduce(array_keys($tagoruntag), function ($result, $key) use ($tagoruntag) {
|
||||
list(, $new_key) = explode('.', $key);
|
||||
$result[$new_key] = $tagoruntag[$key];
|
||||
return $result;
|
||||
}, []);
|
||||
$untag = array_reduce(array_keys($untag), function ($result, $key) use ($untag) {
|
||||
list(, $new_key) = explode('.', $key);
|
||||
$result[$new_key] = $untag[$key];
|
||||
return $result;
|
||||
}, []);
|
||||
|
||||
foreach ($vlans as $vlan_id => $vlan) {
|
||||
d_echo(" $vlan_id");
|
||||
if (is_array($vlans_db[$vtpdomain_id][$vlan_id])) {
|
||||
@@ -36,13 +48,14 @@ if ($vlanversion == 'version1' || $vlanversion == '2') {
|
||||
|
||||
$device['vlans'][$vtpdomain_id][$vlan_id] = $vlan_id;
|
||||
|
||||
$id = "0.$vlan_id";
|
||||
$untagged_ids = q_bridge_bits2indices($untag[$id]['dot1qVlanCurrentUntaggedPorts']);
|
||||
$egress_ids = q_bridge_bits2indices($tagoruntag[$id]['dot1qVlanCurrentEgressPorts']);
|
||||
$untagged_ids = q_bridge_bits2indices($untag[$vlan_id]['dot1qVlanCurrentUntaggedPorts']);
|
||||
$egress_ids = q_bridge_bits2indices($tagoruntag[$vlan_id]['dot1qVlanCurrentEgressPorts']);
|
||||
|
||||
foreach ($egress_ids as $port_id) {
|
||||
$ifIndex = $base_to_index[$port_id];
|
||||
$per_vlan_data[$vlan_id][$ifIndex]['untagged'] = (in_array($port_id, $untagged_ids) ? 1 : 0);
|
||||
if (isset($base_to_index[$port_id])) {
|
||||
$ifIndex = $base_to_index[$port_id];
|
||||
$per_vlan_data[$vlan_id][$ifIndex]['untagged'] = (in_array($port_id, $untagged_ids) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -53,6 +53,13 @@ toner:
|
||||
toner:
|
||||
excluded_fields: [device_id, toner_id]
|
||||
order_by: toner_oid, toner_index
|
||||
vlans:
|
||||
vlans:
|
||||
excluded_fields: [vlan_id, device_id]
|
||||
order_by: vlan_domain, vlan_vlan
|
||||
ports_vlans:
|
||||
excluded_fields: [port_vlan_id, device_id, port_id]
|
||||
order_by: vlan, baseport
|
||||
wireless:
|
||||
wireless_sensors:
|
||||
excluded_fields: [device_id, sensor_id, access_point_id, lastupdate]
|
||||
|
Reference in New Issue
Block a user