Files
snmp-info/lib/SNMP/Info/Layer2/Telindus.pm
Andrey Pazychev b73f0d8d57 WIP. Telindus
2020-05-17 23:43:02 +03:00

124 lines
2.3 KiB
Perl
Executable File

# SNMP::Info::Layer2::Telindus - SNMP Interface to Telindus Devices
#
# Copyright (c) 2020 by 135.
package SNMP::Info::Layer2::Telindus;
use strict;
use warnings;
use Exporter;
use SNMP::Info::Layer2;
@SNMP::Info::Layer2::Telindus::ISA = qw/SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::Telindus::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::Layer2::MIBS, );
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
);
%FUNCS = ( %SNMP::Info::Layer2::FUNCS, );
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, );
sub vendor {
return 'telindus';
}
sub os {
return 'telind-os';
}
sub os_ver {
my $obj = shift;
$obj->description =~ /\$Telindus\s(\d+)(\$\s(.*)|\s(.*)\$)\s(T\d+\/\d+)/;
return $5
if defined $5;
return $obj->SUPER::os_ver();
}
sub model {
my $obj = shift;
$obj->description =~ /\$Telindus\s(\d+)(\$\s(.*)|\s(.*)\$)\s(T\d+\/\d+)/;
if (defined $1 and defined $3) {
return $1 . ' ' . $3;
}
elsif (defined $1 and defined $4) {
return $1 . ' ' . $4;
}
return $obj->SUPER::model();
}
1;
__END__
=head1 NAME
SNMP::Info::Layer2::Telindus - SNMP Interface to Telindus 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 Telindus Devices
=head2 Inherited Classes
=over
=item SNMP::Info::Layer2
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item $obj->vendor()
Returns 'zyxel'
=item $obj->os()
Returns 'zynos'
=item $obj->layers()
Ensures that layer two is reported, at least.
=item $obj->os_ver()
Returns the software version.
=item $obj->model
Returns the model extracted.
=cut
=back