From 0491e2edd09eef3c40e0c91b9f5242dda869afa8 Mon Sep 17 00:00:00 2001 From: mattie47 <4696925+mattie47@users.noreply.github.com> Date: Thu, 15 Mar 2018 22:52:29 +1300 Subject: [PATCH] device: Improve Allied Telesis Chassis product support (#8139) * device: Improve Allied Telesis Chassis product support Fix - Wrong Serial number was displayed Enhancement - Show the type of Controller card in chassis Controller card can be either CFC400, or CFC960. Tests: - Checked Chassis x8106, and x8112 - Checked with CFC400 and CFC960 -- Checked behaviour with/without CFC in bay 1.5 * device: Update awplus to use snmp_get_multi_oid * update awplus device support * device: Fix awplus snmptranslate logic error * device: awplus chassis support improvements * device: update awplus test data * device: fix awplus serial number info * device: fix awplus test data --- includes/polling/os/awplus.inc.php | 25 ++++++++++++++++++++----- tests/data/awplus.json | 10 +++++----- tests/snmpsim/awplus.snmprec | 16 +++++++++++++++- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/includes/polling/os/awplus.inc.php b/includes/polling/os/awplus.inc.php index 34a132dad2..7a90744c45 100644 --- a/includes/polling/os/awplus.inc.php +++ b/includes/polling/os/awplus.inc.php @@ -3,13 +3,28 @@ //$hardware and $serial use snmp_getnext as the OID for these is not always fixed. //However, the first OID is the device baseboard. -$hardware = snmp_getnext($device, "rscBoardName", "-OQv", "AT-RESOURCE-MIB"); +$data = snmp_getnext_multi($device, 'rscBoardName rscBoardSerialNumber', '-OQs', 'AT-RESOURCE-MIB'); +$hardware = $data['rscBoardName']; +$serial = $data['rscBoardSerialNumber']; $version = snmp_get($device, "currSoftVersion.0", "-OQv", "AT-SETUP-MIB"); -$hostname = snmp_get($device, "sysName.0", "-OQv", "SNMPv2-MIB"); -$serial = snmp_getnext($device, "rscBoardSerialNumber", "-OQv", "AT-RESOURCE-MIB"); // SBx8100 platform has line cards show up first in "rscBoardName" above. +//Instead use sysObjectID.0 + if (strpos($hardware, 'SBx81') !== false) { - $hardware = snmp_get($device, "sysObjectID.0", "-OQvs", "SNMPv2-MIB:AT-PRODUCT-MIB"); - $hardware = str_replace('at', '', $hardware); + $data_array = snmpwalk_cache_multi_oid($device, 'rscBoardName', $data_array, 'AT-RESOURCE-MIB', '-OUsb'); + $data_array = snmpwalk_cache_multi_oid($device, 'rscBoardSerialNumber', $data_array, 'AT-RESOURCE-MIB', '-OUsb'); + + $hardware = snmp_translate($device['sysObjectID'], 'AT-PRODUCT-MIB', null, null, $device); + $hardware = str_replace('at', 'AT-', $hardware); + +// Features and Serial is set to Controller card 1.5 + $features = $data_array['5.6']['rscBoardName']; + $serial = $data_array['5.6']['rscBoardSerialNumber']; + +// If bay 1.5 is empty, set to Controller card 1.6 + if (!$features && !$serial) { + $features = $data_array['6.6']['rscBoardName']; + $serial = $data_array['6.6']['rscBoardSerialNumber']; + } } diff --git a/tests/data/awplus.json b/tests/data/awplus.json index d1c2cc38d0..6e2f22e7ec 100644 --- a/tests/data/awplus.json +++ b/tests/data/awplus.json @@ -9704,7 +9704,7 @@ "devices": [ { "sysName": "", - "sysObjectID": ".1.3.6.1.4.1.207.1.14.137", + "sysObjectID": ".1.3.6.1.4.1.207.1.14.114", "sysDescr": "Allied Telesis router/switch, AW+ v5.4.7-2.1", "sysContact": null, "version": null, @@ -9722,16 +9722,16 @@ "devices": [ { "sysName": "", - "sysObjectID": ".1.3.6.1.4.1.207.1.14.137", + "sysObjectID": ".1.3.6.1.4.1.207.1.14.114", "sysDescr": "Allied Telesis router/switch, AW+ v5.4.7-2.1", "sysContact": "", "version": "5.4.7-2.1", - "hardware": "AT-SBx908 GEN2", - "features": null, + "hardware": "AT-SBx8106", + "features": "AT-SBx81CFC960", "location": "", "os": "awplus", "type": "network", - "serial": "A12345678900000", + "serial": "A04699H130900048", "icon": "alliedtelesis.svg" } ] diff --git a/tests/snmpsim/awplus.snmprec b/tests/snmpsim/awplus.snmprec index 1b46d76cd0..0e7def5d9e 100644 --- a/tests/snmpsim/awplus.snmprec +++ b/tests/snmpsim/awplus.snmprec @@ -1,5 +1,5 @@ 1.3.6.1.2.1.1.1.0|4|Allied Telesis router/switch, AW+ v5.4.7-2.1 -1.3.6.1.2.1.1.2.0|6|.1.3.6.1.4.1.207.1.14.137 +1.3.6.1.2.1.1.2.0|6|.1.3.6.1.4.1.207.1.14.114 1.3.6.1.2.1.1.3.0|67|17317200 1.3.6.1.2.1.1.4.0|4| 1.3.6.1.2.1.1.5.0|4| @@ -2429,7 +2429,21 @@ 1.3.6.1.4.1.207.8.4.4.3.12.4.2.1.7.2.1.2|2|1 1.3.6.1.4.1.207.8.4.4.3.12.4.2.1.7.2.1.3|2|2 1.3.6.1.4.1.207.8.4.4.3.12.4.2.1.7.2.1.4|2|2 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.4.1.1|4|AT-SBx81GP24 1.3.6.1.4.1.207.8.4.4.3.21.1.1.4.1.3|4|AT-SBx908 GEN2 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.4.1.5|4|AT-SBx908 GEN2 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.4.5.6|4|AT-SBx81CFC960 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.4.5.7|4|AT-SBx8112 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.4.5.10|4|AT-SBxPWRSYS1/AC +1.3.6.1.4.1.207.8.4.4.3.21.1.1.4.5.11|4|AT-SBxFAN12 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.4.6.6|4|AT-SBx81CFC960 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.8.1.1|4|A1XQD500P 1.3.6.1.4.1.207.8.4.4.3.21.1.1.8.1.3|4|A12345678900000 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.8.1.5|4|A10064A172100016 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.8.5.6|4|A04699H130900048 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.8.5.7|4|A042764102400007 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.8.5.10|4|A045804134300032 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.8.5.11|4|A042844102400016 +1.3.6.1.4.1.207.8.4.4.3.21.1.1.8.6.6|4|A270F900C 1.3.6.1.4.1.207.8.4.4.4.500.2.1.1.0|4|5.4.7-2.1 1.3.6.1.6.3.10.2.1.3.0|2|173123