mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix missing PoE port graphs for Cisco Catalyst 9K (#11698)
* Fix missing PoE port graphs for Cisco Catalyst 9K * Reworked code: 2 assignments, added tests * Simplify code Checking the MIBs... CISCO-POWER-ETHERNET-EXT-MIB: AUGMENTS { pethPsePortEntry } POWER-ETHERNET-MIB: INDEX { pethPsePortGroupIndex , pethPsePortIndex } This means cpeExtPsePortEntry is always indexed by exactly 2 values. No point in populating slot.subslot.port Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -333,8 +333,13 @@ if (Config::get('enable_ports_poe')) {
|
||||
$ifTable_ifDescr = snmpwalk_cache_oid($device, 'ifDescr', [], 'IF-MIB');
|
||||
$port_ent_to_if = [];
|
||||
foreach ($ifTable_ifDescr as $if_index => $if_descr) {
|
||||
if (preg_match('/^[[:alpha:]]+ethernet([0-9\/.]+)$/i', $if_descr['ifDescr'], $matches)) {
|
||||
$port_ent_to_if[str_replace('/', '.', $matches[1])] = ['portIfIndex' => $if_index];
|
||||
/*
|
||||
The ...EthernetX/Y/Z SNMP entries on Catalyst 9x00 iosxe
|
||||
are cpeExtStuff.X.Z instead of cpeExtStuff.X.Y.Z
|
||||
We need to ignore the middle subslot number so this is slot.port
|
||||
*/
|
||||
if (preg_match('/^[a-z]+ethernet(\d+)\/(\d+)(?:\/(\d+))?$/i', $if_descr['ifDescr'], $matches)) {
|
||||
$port_ent_to_if[$matches[1] . '.' . ($matches[3] ?: $matches[2])] = ['portIfIndex' => $if_index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34817
tests/data/iosxe_c9400.json
Normal file
34817
tests/data/iosxe_c9400.json
Normal file
File diff suppressed because it is too large
Load Diff
13007
tests/snmpsim/iosxe_c9400.snmprec
Normal file
13007
tests/snmpsim/iosxe_c9400.snmprec
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user