Qtech and Carelink support

This commit is contained in:
Andrey Pazychev
2020-05-08 20:47:41 +03:00
parent 1dc4baf1d9
commit f96d0df182
3 changed files with 308 additions and 0 deletions

View File

@@ -0,0 +1,172 @@
# SNMP::Info::Layer3::Qtech - SNMP Interface to Qtech Devices
#
# Copyright (c) 2020 by The 135.
package SNMP::Info::Layer3::Qtech;
use strict;
use warnings;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::Qtech::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Qtech::EXPORT_OK = qw//;
our ($VERSION, %GLOBALS, %FUNCS, %MIBS, %MUNGE);
$VERSION = '3.70-135';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::Layer3::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::Layer3::GLOBALS,
'hostname' => '.1.3.6.1.2.1.47.1.1.1.1.7.1',
'model_oid' => '.1.3.6.1.2.1.47.1.1.1.1.13.1',
'hw_oid' => '.1.3.6.1.2.1.47.1.1.1.1.8.1',
'serial_oid' => '.1.3.6.1.2.1.47.1.1.1.1.11.1',
'bootrom_oid' => '.1.3.6.1.2.1.47.1.1.1.1.9.1',
'os_ver_oid' => '.1.3.6.1.2.1.47.1.1.1.1.10.1',
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::Layer3::FUNCS,
);
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, %SNMP::Info::Layer3::MUNGE, );
sub model {
my $qtech = shift;
my $model = $qtech->model_oid;
my $hw = $qtech->hw_oid;
return $model . ' HW:(' . $hw . ')';
}
# ifDescr is the same for all interfaces in a class, but the ifName is
# unique, so let's use that for port name.
sub interfaces {
my $qtech = shift;
my $partial = shift;
my $interfaces = $qtech->orig_i_name($partial);
return $interfaces;
}
sub vendor {
return 'qtech';
}
sub os {
return 'qsw';
}
sub os_ver {
my $qtech = shift;
my $os_ver = $qtech->os_ver_oid();
return $os_ver . ' Bootrom: ' . $qtech->bootrom_oid;
}
sub serial {
my $qtech = shift;
my $serial = $qtech->serial_oid();
return $serial;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::Qtech - SNMP Interface to Qtech Devices
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $qtech = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
DestHost => 'myrouter',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $qtech->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
Subclass for Qtech 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 $qtech->model()
Returns the ID or else description.
=item $qtech->vendor()
Returns 'dlink'.
=item $qtech->serial()
Returns serial number.
=item $qtech->fwver()
Returns the firmware version.
=item $qtech->hwver()
Returns the hardware version.
=item $qtech->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 $qtech->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