trapeze and nws deep recursion fix (#443)

* trapeze serial deep recursion

* NWSS2300 has the same problem

* same workaround as trapeze

* return empty if not found
This commit is contained in:
nick n
2021-10-07 09:52:45 +02:00
committed by GitHub
parent dd1688a587
commit 9f12bcf676
4 changed files with 52 additions and 8 deletions

View File

@@ -54,7 +54,7 @@ $VERSION = '3.80';
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::Layer2::GLOBALS,
'os_ver' => 'ntwsVersionString', 'os_ver' => 'ntwsVersionString',
'serial' => 'ntwsSerialNumber', 'nws_serial' => 'ntwsSerialNumber',
'mac' => 'dot1dBaseBridgeAddress', 'mac' => 'dot1dBaseBridgeAddress',
); );
@@ -139,6 +139,14 @@ sub vendor {
return 'avaya'; return 'avaya';
} }
sub serial {
my $nwss2300 = shift;
my $ser = $nwss2300->ntwsSerialNumber();
# my $ser = $nwss2300->nws_serial();
return $ser;
}
sub model { sub model {
my $nwss2300 = shift; my $nwss2300 = shift;
my $id = $nwss2300->id(); my $id = $nwss2300->id();
@@ -654,7 +662,7 @@ sub e_serial {
my %e_serial; my %e_serial;
# Chassis # Chassis
$e_serial{1} = $nwss2300->serial(); $e_serial{1} = $nwss2300->serial() || '';
# APs # APs
foreach my $iid ( keys %$ap_serial ) { foreach my $iid ( keys %$ap_serial ) {

View File

@@ -54,7 +54,7 @@ $VERSION = '3.80';
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::Layer2::GLOBALS,
'os_ver' => 'trpzVersionString', 'os_ver' => 'trpzVersionString',
'serial' => 'trpzSerialNumber', 'tr_serial' => 'trpzSerialNumber',
'mac' => 'dot1dBaseBridgeAddress', 'mac' => 'dot1dBaseBridgeAddress',
); );
@@ -138,6 +138,14 @@ sub vendor {
return 'juniper'; return 'juniper';
} }
sub serial {
my $trapeze = shift;
my $ser = $trapeze->trpzSerialNumber();
# my $ser = $trapeze->tr_serial();
return $ser;
}
sub model { sub model {
my $trapeze = shift; my $trapeze = shift;
my $id = $trapeze->id(); my $id = $trapeze->id();
@@ -653,7 +661,7 @@ sub e_serial {
my %e_serial; my %e_serial;
# Chassis # Chassis
$e_serial{1} = $trapeze->serial(); $e_serial{1} = $trapeze->serial() || '';
# APs # APs
foreach my $iid ( keys %$ap_serial ) { foreach my $iid ( keys %$ap_serial ) {

View File

@@ -51,6 +51,9 @@ sub setup : Tests(setup) {
'_description' => '_description' =>
'Nortel Wireless Security Switch 2380, 7.0.13.3 REL', 'Nortel Wireless Security Switch 2380, 7.0.13.3 REL',
# NTWS-BASIC-MIB
'_ntwsSerialNumber' => 'STP1E4013Z',
# NTWS-REGISTRATION-DEVICES-MIB::ntwsSwitch2380 # NTWS-REGISTRATION-DEVICES-MIB::ntwsSwitch2380
'_id' => '.1.3.6.1.4.1.45.6.1.3.1.3', '_id' => '.1.3.6.1.4.1.45.6.1.3.1.3',
'store' => {}, 'store' => {},
@@ -72,4 +75,15 @@ sub vendor : Tests(2) {
is($test->{info}->vendor(), 'avaya', q(Vendor returns 'avaya')); is($test->{info}->vendor(), 'avaya', q(Vendor returns 'avaya'));
} }
sub serial : Tests(3) {
my $test = shift;
can_ok($test->{info}, 'serial');
is($test->{info}->serial(), 'STP1E4013Z', q(Serial is expected value));
$test->{info}->clear_cache();
is($test->{info}->serial(), undef,
q(No serial returns undef));
}
1; 1;

View File

@@ -51,6 +51,9 @@ sub setup : Tests(setup) {
'_description' => '_description' =>
'Juniper Networks, Inc WLC880R 7.5.1.6 REL', 'Juniper Networks, Inc WLC880R 7.5.1.6 REL',
# TRAPEZE-NETWORKS-BASIC-MIB
'_trpzSerialNumber' => '0882200159',
# TRAPEZE-NETWORKS-REGISTRATION-DEVICES-MIB::wirelessLANController880R # TRAPEZE-NETWORKS-REGISTRATION-DEVICES-MIB::wirelessLANController880R
'_id' => '.1.3.6.1.4.1.14525.3.3.1', '_id' => '.1.3.6.1.4.1.14525.3.3.1',
'store' => {}, 'store' => {},
@@ -79,4 +82,15 @@ sub vendor : Tests(2) {
is($test->{info}->vendor(), 'juniper', q(Vendor returns 'juniper')); is($test->{info}->vendor(), 'juniper', q(Vendor returns 'juniper'));
} }
sub serial : Tests(3) {
my $test = shift;
can_ok($test->{info}, 'serial');
is($test->{info}->serial(), '0882200159', q(Serial is expected value));
$test->{info}->clear_cache();
is($test->{info}->serial(), undef,
q(No serial returns undef));
}
1; 1;