From cc95aa14a96e3a9ca0b5fbe24632c18339f06c89 Mon Sep 17 00:00:00 2001 From: thl-cmk <thl-cmk@outlook.com> Date: Sat, 3 Jun 2023 15:10:11 +0000 Subject: [PATCH] Delete huawei_hw_components --- inventory/huawei_hw_components | 97 ---------------------------------- 1 file changed, 97 deletions(-) delete mode 100644 inventory/huawei_hw_components diff --git a/inventory/huawei_hw_components b/inventory/huawei_hw_components deleted file mode 100644 index 66d3afb..0000000 --- a/inventory/huawei_hw_components +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/python -# -*- encoding: utf-8; py-indent-offset: 4 -*- -# -# License: GNU General Public License v2 -# -# Author: thl-cmk[at]outlook[dot]com -# URL : https://thl-cmk.hopto.org -# Date : 2020-07-14 -# -# extended inventory of Huawei hardware components -# - - -def inv_huawei_hw_components(info, params): - def parse_huawei_hw_components(info): - def get_snmp_date(hwEntityManufacturedDate): - year = (ord(hwEntityManufacturedDate[0]) << 8) + ord(hwEntityManufacturedDate[1]) - month = ord(hwEntityManufacturedDate[2]) - day = ord(hwEntityManufacturedDate[3]) - snmpDate = '%d-%02d-%02d' % (year, month, day) - return snmpDate - - defaultEntities, huaweiEntities = info - entities = {} - - for entry in huaweiEntities: - hwOID_END, hwEntityBomId, hwEntityBomEnDesc, hwEntityManufacturedDate, hwEntityBoardType, hwEntityOpticalVendorSn = entry - - if hwEntityBomEnDesc != '': - entity = {} - entity['hwEntityBomId'] = hwEntityBomId - entity['hwEntityBomEnDesc'] = hwEntityBomEnDesc - entity['hwEntityManufacturedDate'] = get_snmp_date(hwEntityManufacturedDate) - entity['hwEntityBoardType'] = hwEntityBoardType - entity['serial_number'] = hwEntityOpticalVendorSn - - for entry in defaultEntities: - OID_END, entPhysicalDescr, entPhysicalName, entPhysicalHardwareRev, entPhysicalFirmwareRev, entPhysicalSoftwareRev, entPhysicalSerialNum, entPhysicalMfgName = entry - if OID_END == hwOID_END: - entity['entPhysicalDescr'] = entPhysicalDescr - entity['entPhysicalName'] = entPhysicalName - entity['entPhysicalHardwareRev'] = entPhysicalHardwareRev - entity['entPhysicalFirmwareRev'] = entPhysicalFirmwareRev - entity['entPhysicalSoftwareRev'] = entPhysicalSoftwareRev - entity['entPhysicalMfgName'] = entPhysicalMfgName - if entity['serial_number'] == '': - entity['serial_number'] = entPhysicalSerialNum - - entities[hwOID_END] = entity - return entities - - node = inv_tree_list('hardware.components.huawei:') - entities = parse_huawei_hw_components(info) - - for key, value in entities.items(): - node.append({ - 'index': key, - 'bom_id': value['hwEntityBomId'], - 'bom_decription': value['hwEntityBomEnDesc'], - 'manufactured_date': value['hwEntityManufacturedDate'], - 'board_type': value['hwEntityBoardType'], - 'description': value['entPhysicalDescr'], - 'name': value['entPhysicalName'], - 'hardware_revision': value['entPhysicalHardwareRev'], - 'firmware_revision': value['entPhysicalFirmwareRev'], - 'software_revision': value['entPhysicalSoftwareRev'], - 'serial_number': value['serial_number'], - 'vendor': value['entPhysicalMfgName'], - }) - - return node - - -inv_info['inv_huawei_hw_components'] = { - 'inv_function': inv_huawei_hw_components, - 'snmp_info': [ - ('.1.3.6.1.2.1.47.1.1.1.1', [ - OID_END, - '2', # entPhysicalDescr - '7', # entPhysicalName - '8', # entPhysicalHardwareRev - '9', # entPhysicalFirmwareRev - '10', # entPhysicalSoftwareRev - '11', # entPhysicalSerialNum - '12', # entPhysicalMfgName - ]), - ('.1.3.6.1.4.1.2011.5.25.31.1.1', [ - OID_END, - '2.1.1', # hwEntityBomId - '2.1.2', # hwEntityBomEnDesc - '2.1.4', # hwEntityManufacturedDate - '2.1.11', # hwEntityBoardType - '3.1.4' # hwEntityOpticalVendorSn - ]) - ], - 'snmp_scan_function': lambda oid: oid('.1.3.6.1.2.1.1.2.0').startswith('.1.3.6.1.4.1.2011'), -} -- GitLab