195 lines
4.0 KiB
Perl
195 lines
4.0 KiB
Perl
# SNMP::Info::Layer3::Eltex - SNMP Interface to Eltex Devices
|
|
#
|
|
# Copyright (c) 2020 by The 135.
|
|
|
|
|
|
package SNMP::Info::Layer3::Eltex;
|
|
|
|
use strict;
|
|
use warnings;
|
|
use Exporter;
|
|
#use SNMP::Info::Layer2;
|
|
use SNMP::Info::Layer3;
|
|
|
|
@SNMP::Info::Layer3::Eltex::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
|
@SNMP::Info::Layer3::Eltex::EXPORT_OK = qw//;
|
|
|
|
our ( $VERSION, %GLOBALS, %FUNCS, %MIBS, %MUNGE );
|
|
|
|
$VERSION = '3.70-135';
|
|
|
|
%MIBS = ( %SNMP::Info::Layer3::MIBS, );
|
|
|
|
%GLOBALS = (
|
|
#%SNMP::Info::Layer2::GLOBALS,
|
|
%SNMP::Info::Layer3::GLOBALS,
|
|
'model_oid' => 'mib-2.47.1.1.1.1.13.67108992',
|
|
'hw_oid' => 'mib-2.47.1.1.1.1.8.67108992',
|
|
'serial_oid' => 'mib-2.47.1.1.1.1.11.67108992',
|
|
'os_ver_oid' => 'mib-2.47.1.1.1.1.10.67108992',
|
|
'bootrom_oid' => 'mib-2.47.1.1.1.1.9.67108992',
|
|
#'model_oid_140' => '',
|
|
'hw_oid_140' => 'mib-2.47.1.1.1.1.8.1',
|
|
#'serial_oid_140' => '',
|
|
'os_ver_oid_140' => 'mib-2.47.1.1.1.1.9.1',
|
|
#'bootrom_oid_140' => '',
|
|
|
|
);
|
|
|
|
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
|
|
|
|
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
|
|
|
|
sub model {
|
|
my $eltex = shift;
|
|
my $model; my $hw;
|
|
my $id = $eltex->id();
|
|
if ($id =~ /35265\.(140|158)$/) {
|
|
return;
|
|
}
|
|
# default behaviour for 35265.1.120
|
|
elsif ($id =~ /35265\.1\.(24|43|30|120|5[2,4]|74|8[1,9])$/) {
|
|
$model = $eltex->model_oid;
|
|
$hw = $eltex->hw_oid;
|
|
}
|
|
else {
|
|
return 'unknown';
|
|
}
|
|
return $model . ' HW:' . $hw;
|
|
}
|
|
|
|
sub vendor {
|
|
return 'eltex';
|
|
}
|
|
|
|
sub os {
|
|
return 'eltex';
|
|
}
|
|
|
|
sub os_ver {
|
|
my $eltex = shift;
|
|
my $os_ver; my $bootrom;
|
|
my $id = $eltex->id();
|
|
if ($id =~ /35265\.(140|158)$/) {
|
|
$os_ver = $eltex->os_ver_oid_140;
|
|
return $os_ver;
|
|
}
|
|
elsif ($id =~ /35265\.1\.(24|43|30|120|5[2,4]|74|8[1,9])$/) {
|
|
$os_ver = $eltex->os_ver_oid;
|
|
$bootrom = $eltex->bootrom_oid;
|
|
}
|
|
else {
|
|
return 'unknown';
|
|
}
|
|
return $os_ver . ' bootrom: ' . $bootrom;
|
|
}
|
|
|
|
sub serial {
|
|
my $eltex = shift;
|
|
my $serial;
|
|
my $id = $eltex->id();
|
|
if ($id =~ /35265\.(140|158)$/) {
|
|
return;
|
|
}
|
|
elsif ($id =~ /35265\.1\.(24|43|30|120|5[2,4]|74|8[1,9]])$/) {
|
|
$serial = $eltex->serial_oid;
|
|
}
|
|
else {
|
|
return 'unknown';
|
|
}
|
|
return $serial;
|
|
}
|
|
|
|
1;
|
|
__END__
|
|
|
|
=head1 NAME
|
|
|
|
SNMP::Info::Layer3::Eltex - SNMP Interface to Eltex Devices
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
# Let SNMP::Info determine the correct subclass for you.
|
|
my $eltex = new SNMP::Info(
|
|
AutoSpecify => 1,
|
|
Debug => 1,
|
|
DestHost => 'myrouter',
|
|
Community => 'public',
|
|
Version => 2
|
|
)
|
|
or die "Can't connect to DestHost.\n";
|
|
|
|
my $class = $eltex->class();
|
|
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
Subclass for Eltex devices.
|
|
|
|
=head2 Inherited Classes
|
|
|
|
=over
|
|
|
|
=item SNMP::Info::Layer3
|
|
|
|
=back
|
|
|
|
=head2 Inherited Classes' MIBs
|
|
|
|
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
|
|
|
=head1 GLOBALS
|
|
|
|
These are methods that return scalar value from SNMP
|
|
|
|
=over
|
|
|
|
=item $eltex->model()
|
|
|
|
Returns the ID or else description.
|
|
|
|
=item $eltex->vendor()
|
|
|
|
Returns 'eltex'.
|
|
|
|
=item $eltex->serial()
|
|
|
|
Returns serial number.
|
|
|
|
=item $eltex->fwver()
|
|
|
|
Returns the firmware version.
|
|
|
|
=item $eltex->hwver()
|
|
|
|
Returns the hardware version.
|
|
|
|
=item $eltex->stp_i_root_port()
|
|
|
|
Returns the STP root port.
|
|
|
|
=back
|
|
|
|
=head2 Globals imported from SNMP::Info::Layer3
|
|
|
|
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
|
|
|
=head1 TABLE METHODS
|
|
|
|
These are methods that return tables of information in the form of a reference
|
|
to a hash.
|
|
|
|
=over
|
|
|
|
=item $eltex->interfaces();
|
|
|
|
Returns the map between SNMP Interface Identifier (iid) and C<ifName>.
|
|
|
|
=back
|
|
|
|
=head2 Table Methods imported from SNMP::Info::Layer3
|
|
|
|
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
|
|
|
=cut
|