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

@@ -6,6 +6,14 @@ version 3.15 ()
* Offline mode and Cache export/priming.
[ENHANCEMENTS]
* Return serial number for Cisco 3850 from entPhysicalSerialNum
[BUG FIXES]
* Cisco SB serial number probably did not work
version 3.14 (2014-06-07)
[ENHANCEMENTS]

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 {

View File

@@ -134,6 +134,23 @@ sub vendor {
sub cisco_comm_indexing { return 1; }
sub serial {
my $c6500 = shift;
my $serial = $c6500->SUPER::serial();
return $serial if defined $serial and $serial;
# now grab the table only if SUPER cannot find it
my $e_serial = $c6500->e_serial();
# Find entity table entry for this unit
foreach my $e ( sort keys %$e_serial ) {
if (defined $e_serial->{$e} and $e_serial->{$e} !~ /^\s*$/) {
return $e_serial->{$e};
}
}
}
# Newer versions use the ETHERLIKE-MIB to report operational duplex.
sub i_duplex {
@@ -389,6 +406,10 @@ Returns the Switch status: multiNode or standalone.
Return 1 if the switch (C<cvsSwitchMode>) is in multimode (VSS).
=item $c6500->serial()
Returns serial number of unit (falls back to C<entPhysicalSerialNum>).
=back
=head2 Global Methods imported from SNMP::Info::CiscoVTP