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

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

View File

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

View File

@@ -51,6 +51,9 @@ sub setup : Tests(setup) {
'_description' =>
'Nortel Wireless Security Switch 2380, 7.0.13.3 REL',
# NTWS-BASIC-MIB
'_ntwsSerialNumber' => 'STP1E4013Z',
# NTWS-REGISTRATION-DEVICES-MIB::ntwsSwitch2380
'_id' => '.1.3.6.1.4.1.45.6.1.3.1.3',
'store' => {},
@@ -72,4 +75,15 @@ sub vendor : Tests(2) {
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;

View File

@@ -51,6 +51,9 @@ sub setup : Tests(setup) {
'_description' =>
'Juniper Networks, Inc WLC880R 7.5.1.6 REL',
# TRAPEZE-NETWORKS-BASIC-MIB
'_trpzSerialNumber' => '0882200159',
# TRAPEZE-NETWORKS-REGISTRATION-DEVICES-MIB::wirelessLANController880R
'_id' => '.1.3.6.1.4.1.14525.3.3.1',
'store' => {},
@@ -79,4 +82,15 @@ sub vendor : Tests(2) {
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;