From 1ea424d0a1112071fa8b6a944761ef04451f1c25 Mon Sep 17 00:00:00 2001 From: Guillaume Bougard Date: Fri, 26 Apr 2024 15:13:24 +0200 Subject: [PATCH] fix: Update Dell networking devices support for os10 based products --- lib/GLPI/Agent/SNMP/MibSupport/Dell.pm | 45 +++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/lib/GLPI/Agent/SNMP/MibSupport/Dell.pm b/lib/GLPI/Agent/SNMP/MibSupport/Dell.pm index 38f948238..e13014146 100644 --- a/lib/GLPI/Agent/SNMP/MibSupport/Dell.pm +++ b/lib/GLPI/Agent/SNMP/MibSupport/Dell.pm @@ -23,6 +23,19 @@ use constant productIdentificationSerialNumber => productIdentification . ".8.1 use constant productIdentificationAssetTag => productIdentification . ".8.1.3.1" ; use constant productIdentificationServiceTag => productIdentification . ".8.1.4.1" ; +# Constant extracted from DELLEMC-OS10-SMI-MIB +use constant os10 => dell . '.11000.5000.100'; + +# Constant extracted from DELLEMC-OS10-PRODUCTS-MIB +use constant os10Products => os10 . '.2'; + +# Constant extracted from DELLEMC-OS10-CHASSIS-MIB +use constant os10ChassisMib => os10 . '.4'; +use constant os10ChassisObject => os10ChassisMib . '.1.1'; +use constant os10ChassisMacAddr => os10ChassisObject . '.3.1.3.1'; +use constant os10ChassisPPID => os10ChassisObject . '.3.1.5.1'; +use constant os10ChassisServiceTag => os10ChassisObject . '.3.1.7.1'; + use English qw(-no_match_vars); use UNIVERSAL::require; @@ -30,9 +43,17 @@ our $mibSupport = [ { name => "dell-powerconnect", oid => powerConnectVendorMIB + }, + { + name => "dell-os10-product", + sysobjectid => getRegexpOidMatch(os10Products) } ]; +sub getType { + return 'NETWORKING'; +} + sub getFirmware { my ($self) = @_; @@ -53,7 +74,19 @@ sub getManufacturer { sub getSerial { my ($self) = @_; - return getCanonicalString($self->get(productIdentificationSerialNumber)); + return getCanonicalString($self->get(productIdentificationSerialNumber)) + || getCanonicalString($self->get(os10ChassisPPID)); +} + +sub getMacAddress { + my ($self) = @_; + + my $device = $self->device + or return; + + return if $device->{MAC}; + + return getCanonicalMacAddress($self->get(os10ChassisMacAddr)); } sub getModel { @@ -75,12 +108,14 @@ sub run { my $assettag = getCanonicalString($self->get(productIdentificationAssetTag)); if (empty($assettag) || $assettag =~ /^none$/i) { - my $servicetag = getCanonicalString($self->get(productIdentificationServiceTag)); - $device->{INFO}->{ASSETTAG} = $servicetag + my $servicetag = getCanonicalString($self->get(productIdentificationServiceTag)) + || getCanonicalString($self->get(os10ChassisServiceTag)); + $assettag = $servicetag unless empty($servicetag) || $servicetag =~ /^none$/i; - } else { - $device->{INFO}->{ASSETTAG} = $assettag; } + + $device->{INFO}->{ASSETTAG} = $assettag + unless empty($assettag); } 1;