From 27930d5e50d8772948bdaa3c002ea5adf8a30002 Mon Sep 17 00:00:00 2001 From: Andrey Pazychev Date: Sat, 9 May 2020 19:15:00 +0300 Subject: [PATCH] Add support Raisecom --- lib/SNMP/Info.pm | 4 + lib/SNMP/Info/Layer3/Raisecom.pm | 145 +++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100755 lib/SNMP/Info/Layer3/Raisecom.pm diff --git a/lib/SNMP/Info.pm b/lib/SNMP/Info.pm index f1bb8bca..66295a02 100644 --- a/lib/SNMP/Info.pm +++ b/lib/SNMP/Info.pm @@ -1673,6 +1673,7 @@ sub device_type { 244 => 'SNMP::Info::Layer3::Lantronix', 311 => 'SNMP::Info::Layer3::Microsoft', 637 => 'SNMP::Info::Layer3::AlcatelLucent', + 655 => 'SNMP::Info::Layer2::Carelink', 664 => 'SNMP::Info::Layer2::Adtran', 674 => 'SNMP::Info::Layer3::Dell', 1588 => 'SNMP::Info::Layer3::Foundry', @@ -1701,6 +1702,7 @@ sub device_type { 6527 => 'SNMP::Info::Layer3::Timetra', 6876 => 'SNMP::Info::Layer3::VMware', 8072 => 'SNMP::Info::Layer3::NetSNMP', + 8886 => 'SNMP::Info::Layer3::Raisecom', 9303 => 'SNMP::Info::Layer3::PacketFront', 10002 => 'SNMP::Info::Layer2::Ubiquiti', 10418 => 'SNMP::Info::Layer1::Cyclades', @@ -1736,6 +1738,7 @@ sub device_type { 171 => 'SNMP::Info::Layer3::DLink', 207 => 'SNMP::Info::Layer2::Allied', 266 => 'SNMP::Info::Layer2::Nexans', + 637 => 'SNMP::Info::Layer3::AlcatelLucent', 655 => 'SNMP::Info::Layer2::Carelink', 664 => 'SNMP::Info::Layer2::Adtran', 674 => 'SNMP::Info::Layer3::Dell', @@ -1752,6 +1755,7 @@ sub device_type { 5624 => 'SNMP::Info::Layer3::Enterasys', 6141 => 'SNMP::Info::Layer3::Ciena', 6486 => 'SNMP::Info::Layer3::AlcatelLucent', + 8886 => 'SNMP::Info::Layer3::Raisecom', 9303 => 'SNMP::Info::Layer3::PacketFront', 10418 => 'SNMP::Info::Layer1::Cyclades', 11898 => 'SNMP::Info::Layer2::Orinoco', diff --git a/lib/SNMP/Info/Layer3/Raisecom.pm b/lib/SNMP/Info/Layer3/Raisecom.pm new file mode 100755 index 00000000..926ee5e3 --- /dev/null +++ b/lib/SNMP/Info/Layer3/Raisecom.pm @@ -0,0 +1,145 @@ +# SNMP::Info::Layer3::Raisecom - SNMP Interface to Raisecom Devices +# +# Copyright (c) 2020 by 135. + +package SNMP::Info::Layer3::Raisecom; + +use strict; +use warnings; +use Exporter; +use SNMP::Info::Layer3; + +@SNMP::Info::Layer3::Raisecom::ISA = qw/SNMP::Info::Layer3 Exporter/; +@SNMP::Info::Layer3::Raisecom::EXPORT_OK = qw//; + +our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %MUNGE); + +$VERSION = '3.70-135'; + +# This will be filled in with the device's index into the EntPhysicalEntry +# table by the serial() function. +our $index = undef; + +%MIBS = ( %SNMP::Info::Layer3::MIBS, ); + +%GLOBALS = ( + %SNMP::Info::Layer3::GLOBALS, + 'model_oid' => 'mib-2.47.1.1.1.1.13.1', + 'serial_oid' => 'mib-2.47.1.1.1.1.11.1', + 'os_ver_oid' => 'mib-2.47.1.1.1.1.10.1', + 'brom_oid' => 'mib-2.47.1.1.1.1.9.1', + 'hw_oid' => 'mib-2.47.1.1.1.1.8.1', +); + +%FUNCS = ( %SNMP::Info::Layer3::FUNCS, ); + +%MUNGE = ( %SNMP::Info::Layer3::MUNGE, ); + +sub vendor { + return 'raisecom'; +} + +sub os { + return 'rcios'; +} + +sub os_ver { + my $rcios = shift; + my $os_ver = $rcios->os_ver_oid || undef; + my $brom = $rcios->brom_oid || undef; + if (defined $os_ver and defined $brom) { + return $os_ver . ' bootrom: ' . $brom; + } + elsif (defined $os_ver) { + return $os_ver; + } + return 'unknown'; +} +sub model { + my $rcios = shift; + my $model = $rcios->model_oid || undef; + my $hw = $rcios->hw_oid || undef; + if (defined $model and defined $hw) { + return $model . ' HW:' . $hw; + } + elsif (defined $model) { + return $model; + } + return 'unknown'; +} + +sub serial { + my $rcios = shift; + my $serial = $rcios->serial_oid || 'unknown'; + return $serial; +} + +1; +__END__ + +=head1 NAME + +SNMP::Info::Layer3::Raisecom - SNMP Interface to Raisecom Devices + +=head1 SYNOPSIS + + # Let SNMP::Info determine the correct subclass for you. + my $rcios = new SNMP::Info( + AutoSpecify => 1, + Debug => 1, + DestHost => 'myrouter', + Community => 'public', + Version => 2 + ) + or die "Can't connect to DestHost.\n"; + + my $class = $rcios->class(); + print "SNMP::Info determined this device to fall under subclass : $class\n"; + +=head1 DESCRIPTION + +Subclass for rcios Devices running IOS-like software + +=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 $rcios->vendor() + +Returns 'adtran' + +=item $rcios->os() + +Returns 'caos' + +=item $rcios->layers() + +Ensures that layer two is reported, at least. + +=item $rcios->os_ver() + +Returns the software version. + +=item $rcios->model() + +Returns the model extracted. + +=item $rcios->serial() + +Returns serial number. + +=cut