From 391a918e2ecda71ca10ce22414a1c62bc7c76b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Hukkam=C3=A4ki?= Date: Sat, 3 Feb 2024 23:32:07 +0200 Subject: [PATCH] refactor - Use ->table(2) rather than ::pivotTable function. (#15796) --- LibreNMS/OS/Powerconnect.php | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/LibreNMS/OS/Powerconnect.php b/LibreNMS/OS/Powerconnect.php index f0190f02cc..8407e498e2 100644 --- a/LibreNMS/OS/Powerconnect.php +++ b/LibreNMS/OS/Powerconnect.php @@ -137,18 +137,6 @@ class Powerconnect extends OS implements ProcessorDiscovery, ProcessorPolling, N return $res; } - private static function pivotTable(array $table): array - { - $res = []; - foreach ($table as $column => $data) { - foreach ($data as $index => $value) { - $res[$index][$column] = $value; - } - } - - return $res; - } - public function pollNac() { $nac = new Collection(); @@ -160,15 +148,13 @@ class Powerconnect extends OS implements ProcessorDiscovery, ProcessorPolling, N return $nac; } - $table = SnmpQuery::mibs(['DNOS-AUTHENTICATION-MANAGER-MIB'])->mibDir('dell')->hideMib()->enumStrings()->walk('agentAuthMgrClientStatusTable')->table(); + $table = SnmpQuery::mibs(['DNOS-AUTHENTICATION-MANAGER-MIB'])->mibDir('dell')->hideMib()->enumStrings()->walk('agentAuthMgrClientStatusTable')->table(2); if (count($table) === 0) { d_echo('Client status table is empty, not processing NAC entries.'); return $nac; } - $table = self::pivotTable($table); - $hostmode = SnmpQuery::mibs(['DNOS-AUTHENTICATION-MANAGER-MIB'])->mibDir('dell')->hideMib()->enumStrings()->walk('agentAuthMgrPortHostMode')->valuesByIndex(); foreach ($table as &$row) { if ($row['agentAuthMgrClientAuthState'] === 'success') {