diff --git a/lib/SNMP/Info.pm b/lib/SNMP/Info.pm index 1559297e..143767e9 100644 --- a/lib/SNMP/Info.pm +++ b/lib/SNMP/Info.pm @@ -1725,6 +1725,7 @@ sub device_type { 27514 => 'SNMP::Info::Layer3::Qtech', 30065 => 'SNMP::Info::Layer3::Arista', 30803 => 'SNMP::Info::Layer3::VyOS', + 32761 => 'SNMP::Info::Layer3::Rotek', 34300 => 'SNMP::Info::Layer3::Eltex', 35098 => 'SNMP::Info::Layer3::Pica8', 35265 => 'SNMP::Info::Layer3::Eltex', @@ -1775,6 +1776,7 @@ sub device_type { 26543 => 'SNMP::Info::Layer3::IBMGbTor', 26928 => 'SNMP::Info::Layer2::Aerohive', 27514 => 'SNMP::Info::Layer3::Qtech', + 32761 => 'SNMP::Info::Layer3::Rotek', 34300 => 'SNMP::Info::Layer3::Eltex', 35265 => 'SNMP::Info::Layer3::Eltex', 41752 => 'SNMP::Info::Layer3::Raisecom', diff --git a/lib/SNMP/Info/Layer3/Raisecom.pm b/lib/SNMP/Info/Layer3/Raisecom.pm index 23683f12..f7faabb9 100755 --- a/lib/SNMP/Info/Layer3/Raisecom.pm +++ b/lib/SNMP/Info/Layer3/Raisecom.pm @@ -8,6 +8,7 @@ use strict; use warnings; use Exporter; use SNMP::Info::Layer3; +use SNMP::Info::Layer3::Rotek; @SNMP::Info::Layer3::Raisecom::ISA = qw/SNMP::Info::Layer3 Exporter/; @SNMP::Info::Layer3::Raisecom::EXPORT_OK = qw//; @@ -36,6 +37,7 @@ $VERSION = '3.70-135'; 'hw_oid_41752' => 'enterprises.41752.6.1.1.1.2.0', 'hw_oid_8886_6_140' => 'enterprises.8886.6.1.1.1.2.0', 'model_rotek' => 'enterprises.41752.3.1.1.1.3.0', + 'model_41752' => 'enterprises.41752.3.1.1.1.3.0', ); %FUNCS = ( %SNMP::Info::Layer3::FUNCS, ); @@ -44,8 +46,9 @@ $VERSION = '3.70-135'; sub vendor { my $obj = shift; - if ($obj->id() =~ /41752$/) { - return 'rotek'; + my $id = $obj->id(); + if ($id =~ /41752$/) { + return SNMP::Info::Layer3::Rotek::vendor($obj); } return 'raisecom'; } @@ -57,7 +60,7 @@ sub os { return 'ros'; } elsif ($id =~ /41752$/) { - return 'rotek'; + return SNMP::Info::Layer3::Rotek::os($obj); } return 'rcios'; } @@ -91,9 +94,7 @@ sub os_ver { $brom = $obj->brom_oid_8886_6_140; } elsif ($id =~ /41752$/) { - my $os_ver_oid = $obj->description(); - $os_ver_oid =~ /\,\s(.*)/; - $os_ver = $1; + return SNMP::Info::Layer3::Rotek::os_ver($obj); } else { $os_ver = $obj->os_ver_oid || undef; @@ -126,7 +127,7 @@ sub model { return $obj->model_oid_8886_6_140 . ' HW:' . $obj->hvver; } elsif ($id =~ /41752$/) { - return $obj->model_rotek; + return SNMP::Info::Layer3::Rotek::model($obj); } return $obj->SUPER::model(); } diff --git a/lib/SNMP/Info/Layer3/Rotek.pm b/lib/SNMP/Info/Layer3/Rotek.pm new file mode 100755 index 00000000..58fcb15c --- /dev/null +++ b/lib/SNMP/Info/Layer3/Rotek.pm @@ -0,0 +1,130 @@ +# SNMP::Info::Layer3::Rotek - SNMP Interface to Rotek Devices +# +# Copyright (c) 2020 by 135. + +package SNMP::Info::Layer3::Rotek; + +use strict; +use warnings; +use Exporter; +use SNMP::Info::Layer3; + +@SNMP::Info::Layer3::Rotek::ISA = qw/SNMP::Info::Layer3 Exporter/; +@SNMP::Info::Layer3::Rotek::EXPORT_OK = qw//; + +our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %MUNGE); + +$VERSION = '3.70-135'; + +%MIBS = ( %SNMP::Info::Layer3::MIBS, ); + +%GLOBALS = ( + %SNMP::Info::Layer3::GLOBALS, + 'model_41752' => 'enterprises.41752.3.1.1.1.3.0', + 'model_rotek' => 'enterprises.32761.3.1.1.1.3.0', + 'submodel' => 'enterprises.32761.3.1.1.1.2.0', +); + +%FUNCS = ( %SNMP::Info::Layer3::FUNCS, ); + +%MUNGE = ( %SNMP::Info::Layer3::MUNGE, ); + +sub vendor { + return 'rotek'; +} + +sub os { + return 'rotek'; +} + +sub os_ver { + my $obj = shift; + my $os_ver; + my $os_ver_oid = $obj->description(); + $os_ver_oid =~ /\,\s(.*)/; + $os_ver = $1; + + if (defined $os_ver) { + return $os_ver; + } + return 'unknown'; +} +sub model { + my $obj = shift; + my $id = $obj->id(); + if ($id =~ /32761$/) { + return $obj->model_rotek . ' (' . $obj->submodel . ')'; + } + elsif ($id =~ /41752$/) { + return $obj->model_41752; + } + return $obj->SUPER::model(); +} + +1; +__END__ + +=head1 NAME + +SNMP::Info::Layer3::Rotek - SNMP Interface to Rotek Devices + +=head1 SYNOPSIS + + # Let SNMP::Info determine the correct subclass for you. + my $obj = new SNMP::Info( + AutoSpecify => 1, + Debug => 1, + DestHost => 'myrouter', + Community => 'public', + Version => 2 + ) + or die "Can't connect to DestHost.\n"; + + my $class = $obj->class(); + print "SNMP::Info determined this device to fall under subclass : $class\n"; + +=head1 DESCRIPTION + +Subclass for Rotek Devices + +=head2 Inherited Classes + +=over + +=item SNMP::Info::Layer3 + +=back + +=head2 Inherited Classes' MIBs + +See L for its own MIB requirements. + +=head1 GLOBALS + +These are methods that return scalar value from SNMP + +=over + +=item $obj->vendor() + +Returns 'rotek' + +=item $obj->os() + +Returns 'rotek' + +=item $obj->os_ver() + +Returns the software version. + +=item $obj->model() + +Returns the model extracted. + +=item $obj->serial() + +Returns serial number. + +=cut + +=back \ No newline at end of file