From 2fada0c31c74e9e1fbb19a9954bc8f5789eeab6a Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 28 Nov 2015 20:19:33 +0000 Subject: [PATCH] Support for CiscoSB OS and Version (D. Tuecks) --- ChangeLog | 10 ++++++++++ Info/Layer2/CiscoSB.pm | 26 ++++++++++++++++---------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 273a020b..fa633a31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ SNMP::Info - Friendly OO-style interface to Network devices using SNMP. +version 3.31 () + + [ENHANCEMENTS] + + * Support for CiscoSB OS and Version (D. Tuecks) + + [BUG FIXES] + + * Correct link to MIB tarball + version 3.30 (2015-11-16) [ENHANCEMENTS] diff --git a/Info/Layer2/CiscoSB.pm b/Info/Layer2/CiscoSB.pm index d7923ec6..1907b2b6 100644 --- a/Info/Layer2/CiscoSB.pm +++ b/Info/Layer2/CiscoSB.pm @@ -52,10 +52,6 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; $VERSION = '3.30'; -# This will be filled in with the device's index into the EntPhysicalEntry -# table by the serial() function. -our $index = undef; - %GLOBALS = ( %SNMP::Info::Layer2::GLOBALS, %SNMP::Info::Entity::GLOBALS, @@ -98,6 +94,10 @@ sub vendor { return 'cisco'; } +sub os { + return 'ros'; +} + # Walk the entPhysicalSerialNum table and return the first serial found sub serial { my $ciscosb = shift; @@ -113,20 +113,26 @@ sub serial { sub os_ver { my $ciscosb = shift; - my $os_ver = $ciscosb->e_swver(); + my $e_swver = $ciscosb->e_swver(); - return $os_ver->{$index} if defined $index; + foreach my $e ( sort keys %$e_swver ) { + if (defined $e_swver->{$e} and $e_swver->{$e} !~ /^\s*$/) { + return $e_swver->{$e}; + } + } } # Grab e_model from Entity and tag on e_hwver sub model { my $ciscosb = shift; - my $e_model = $ciscosb->e_model(); + my $e_model = $ciscosb->e_model(); my $e_hwver = $ciscosb->e_hwver(); - if (defined ($index)) { - my $model = "$e_model->{$index} $e_hwver->{$index}"; - return $model; + foreach my $e ( sort keys %$e_model ) { + if (defined $e_model->{$e} and $e_model->{$e} !~ /^\s*$/) { + my $model = "$e_model->{$e} $e_hwver->{$e}"; + return $model; + } } return $ciscosb->description(); }