Return serial number for Cisco 3850 from entPhysicalSerialNum

This commit is contained in:
Oliver Gorwits
2014-06-10 13:12:08 +01:00
parent 6519570839
commit c24e63ec4c
3 changed files with 33 additions and 8 deletions

View File

@@ -98,21 +98,17 @@ sub vendor {
return 'cisco';
}
# Walk the entPhysicalSerialNum table and return both the first serial
# number found as well as the index of that entry.
# Walk the entPhysicalSerialNum table and return the first serial found
sub serial {
my $ciscosb = shift;
my $serial = undef;
my $e_serial = $ciscosb->e_serial();
# Find entity table entry for this unit
foreach my $e ( keys %$e_serial ) {
if (defined ($e_serial->{$e}) and $e_serial->{$e} !~ /^\s*$/) {
$index = $e;
last;
foreach my $e ( sort keys %$e_serial ) {
if (defined $e_serial->{$e} and $e_serial->{$e} !~ /^\s*$/) {
return $e_serial->{$e};
}
}
return $e_serial->{$index} if defined $index;
}
sub os_ver {