Don't assume entity index 1 is the chassis and has serial in Layer3.

This commit is contained in:
Eric A. Miller
2013-11-17 14:50:21 -05:00
parent fb478d3c7b
commit d6a7a944cc
2 changed files with 18 additions and 12 deletions

View File

@@ -19,6 +19,7 @@ version 3.09 ()
* When determining the BSSID in Airespace there is only one hexadecimal * When determining the BSSID in Airespace there is only one hexadecimal
digit available so skip if outside the range of 1-16, 17 is reserved digit available so skip if outside the range of 1-16, 17 is reserved
for 3rd party AP's. for 3rd party AP's.
* Don't assume entity index 1 is the chassis and has serial in Layer3.
version 3.08 (2013-10-22) version 3.08 (2013-10-22)

View File

@@ -206,19 +206,24 @@ sub serial {
my $l3 = shift; my $l3 = shift;
my $serial1 = $l3->serial1(); my $serial1 = $l3->serial1();
my $e_descr = $l3->e_descr() || {}; my $e_parent = $l3->e_parent() || {};
my $e_serial = $l3->e_serial() || {};
my $serial2 = $e_serial->{1} || undef; foreach my $iid ( keys %$e_parent ) {
my $chassis = $e_descr->{1} || undef; my $parent = $e_parent->{$iid};
if ( $parent eq '0' ) {
# precedence my $serial = $l3->e_serial($iid);
# serial2,chassis parse,serial1 if ( $serial ) {
return $serial2 if ( defined $serial2 and $serial2 !~ /^\s*$/ ); return $serial->{$iid};
}
if ( defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i ) { else {
my $descr = $l3->e_descr($iid);
if ( $descr and $descr =~ /serial#?:\s*([a-z0-9]+)/i )
{
return $1; return $1;
} }
}
}
}
return $serial1 if ( defined $serial1 and $serial1 !~ /^\s*$/ ); return $serial1 if ( defined $serial1 and $serial1 !~ /^\s*$/ );