diff --git a/lib/SNMP/Info.pm b/lib/SNMP/Info.pm index ea2d665b..a440e1be 100644 --- a/lib/SNMP/Info.pm +++ b/lib/SNMP/Info.pm @@ -25,7 +25,7 @@ our ($VERSION, %FUNCS, %GLOBALS, %MIBS, %MUNGE, $AUTOLOAD, $INIT, $DEBUG, %SPEED_MAP, $NOSUCH, $BIGINT, $REPEATERS); -$VERSION = '3.70-135-20.5.6'; +$VERSION = '3.70-135-20.5.7'; =head1 NAME @@ -1739,6 +1739,7 @@ sub device_type { 41112 => 'SNMP::Info::Layer2::Ubiquiti', 44641 => 'SNMP::Info::Layer3::VyOS', 41752 => 'SNMP::Info::Layer3::Raisecom', + 42926 => 'SNMP::Info::Layer2::NSC', ); my %l2sysoidmap = ( @@ -1792,6 +1793,7 @@ sub device_type { 35265 => 'SNMP::Info::Layer3::Eltex', 40418 => 'SNMP::Info::Layer3::Nag', 41752 => 'SNMP::Info::Layer3::Raisecom', + 42926 => 'SNMP::Info::Layer2::NSC', ); my %l1sysoidmap = ( diff --git a/lib/SNMP/Info/Layer2/NSC.pm b/lib/SNMP/Info/Layer2/NSC.pm new file mode 100755 index 00000000..388fe177 --- /dev/null +++ b/lib/SNMP/Info/Layer2/NSC.pm @@ -0,0 +1,144 @@ +# SNMP::Info::Layer2::NSC - SNMP Interface to NSC Devices +# +# Copyright (c) 2020 by 135. + +package SNMP::Info::Layer2::NSC; + +use strict; +use warnings; +use Exporter; +use SNMP::Info::Layer2; + +@SNMP::Info::Layer2::NSC::ISA = qw/SNMP::Info::Layer2 Exporter/; +@SNMP::Info::Layer2::NSC::EXPORT_OK = qw//; + +our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %MUNGE); + +$VERSION = '3.70-135'; + +%MIBS = ( %SNMP::Info::Layer2::MIBS, ); + +%GLOBALS = ( + %SNMP::Info::Layer2::GLOBALS, + 'model_oid' => 'enterprises.42926.2.3.1.3.0', + 'serial_oid' => 'enterprises.42926.2.3.1.8.0', + 'hw_oid' => 'enterprises.42926.2.3.1.1.0', + 'os_ver_oid' => 'enterprises.42926.2.3.1.2.0', +); + +%FUNCS = ( %SNMP::Info::Layer2::FUNCS, ); + +%MUNGE = ( %SNMP::Info::Layer2::MUNGE, ); + +sub vendor { + return 'nsc-oem'; +} + +sub os { + return 'nsc-oem'; +} + +sub os_ver { + my $obj = shift; + my $os_ver = $obj->os_ver_oid || undef; + + return $os_ver + if defined $os_ver; + return 'unknown'; +} +sub model { + my $obj = shift; + my $model = $obj->model_oid || undef; + my $hwver = $obj->hwver || undef; + + return $model . ' HW:' . $hwver + if defined $model and defined $hwver; + return $model + if defined $model; + return $obj->SUPER::model(); +} + +sub hwver { + my $obj = shift; + my $hwver = $obj->hw_oid || undef; + + return $hwver + if defined $hwver; +} + +sub serial { + my $obj = shift; + my $serial = $obj->serial_oid || undef; + + return $serial + if defined $serial; + return $obj->SUPER::serial(); +} + +1; +__END__ + +=head1 NAME + +SNMP::Info::Layer2::NSC - SNMP Interface to NSC 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 NSC Devices + +=head2 Inherited Classes + +=over + +=item SNMP::Info::Layer2 + +=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 'nsc-oem' + +=item $obj->os() + +Returns 'nsc-oem' + +=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