Fix vendors accoding to http://oidref.com/

- Lucent
- Deliberant
- Raisecom
- Rotek
This commit is contained in:
Andrey Pazychev
2020-05-21 03:55:54 +03:00
parent 535379b3a1
commit 91ce23ce4a
5 changed files with 210 additions and 57 deletions

View File

@@ -1730,7 +1730,7 @@ sub device_type {
27514 => 'SNMP::Info::Layer3::Qtech',
30065 => 'SNMP::Info::Layer3::Arista',
30803 => 'SNMP::Info::Layer3::VyOS',
32761 => 'SNMP::Info::Layer3::Rotek',
32761 => 'SNMP::Info::Layer3::Deliberant',
34300 => 'SNMP::Info::Layer3::Eltex',
35098 => 'SNMP::Info::Layer3::Pica8',
35265 => 'SNMP::Info::Layer3::Eltex',
@@ -1738,7 +1738,7 @@ sub device_type {
40418 => 'SNMP::Info::Layer3::Nag',
41112 => 'SNMP::Info::Layer2::Ubiquiti',
44641 => 'SNMP::Info::Layer3::VyOS',
41752 => 'SNMP::Info::Layer3::Raisecom',
41752 => 'SNMP::Info::Layer3::Rotek',
42926 => 'SNMP::Info::Layer2::NSC',
);
@@ -1788,11 +1788,11 @@ sub device_type {
26543 => 'SNMP::Info::Layer3::IBMGbTor',
26928 => 'SNMP::Info::Layer2::Aerohive',
27514 => 'SNMP::Info::Layer3::Qtech',
32761 => 'SNMP::Info::Layer3::Rotek',
32761 => 'SNMP::Info::Layer3::Deliberant',
34300 => 'SNMP::Info::Layer3::Eltex',
35265 => 'SNMP::Info::Layer3::Eltex',
40418 => 'SNMP::Info::Layer3::Nag',
41752 => 'SNMP::Info::Layer3::Raisecom',
41752 => 'SNMP::Info::Layer3::Rotek',
42926 => 'SNMP::Info::Layer2::NSC',
);
@@ -1809,6 +1809,7 @@ sub device_type {
12532 => 'SNMP::Info::Layer7::Neoteris',
14525 => 'SNMP::Info::Layer2::Trapeze',
26866 => 'SNMP::Info::Layer7::Gigamon',
41752 => 'SNMP::Info::Layer3::Rotek', #Rotek and Raisecom fucking crap -(
);
# Get just the enterprise number for generic mapping

View File

@@ -110,7 +110,7 @@ sub os {
}
sub vendor {
return 'alcatel-lucent';
return 'alcatel';
}
sub os_ver {

View File

@@ -0,0 +1,133 @@
# SNMP::Info::Layer3::Deliberant - SNMP Interface to Deliberant Devices
#
# Copyright (c) 2020 by 135.
package SNMP::Info::Layer3::Deliberant;
use strict;
use warnings;
use Exporter;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::Deliberant::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Deliberant::EXPORT_OK = qw//;
our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %MUNGE);
$VERSION = '3.70-135';
%MIBS = ( %SNMP::Info::Layer3::MIBS, );
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'model_oid' => 'enterprises.32761.3.1.1.1.3.0',
'submodel' => 'enterprises.32761.3.1.1.1.2.0',
);
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
sub vendor {
return 'deliberant';
}
sub os {
return 'deliberant-os';
}
sub os_ver {
my $obj = shift;
my $os_ver;
my $os_ver_oid = $obj->description;
$os_ver_oid =~ /\,\s(.*)/;
$os_ver = $1;
if (defined $os_ver) {
return $os_ver;
}
return 'unknown';
}
sub model {
my $obj = shift;
my $id = $obj->id();
my $model = $obj->model_oid || undef;
my $submodel = $obj->submodel || undef;
$model .= ' (' . $obj->submodel . ')' if defined($submodel);
return $model if defined $model;
return $obj->SUPER::model();
}
sub serial {
my $obj = shift;
return $obj->SUPER::serial();
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::Deliberant - SNMP Interface to Deliberant 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 Deliberant 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 $obj->vendor()
Returns 'deliberant-oem'
=item $obj->os()
Returns 'rotek-os'
=item $obj->os_ver()
Returns the software version.
=item $obj->model()
Returns the model extracted.
=item $obj->serial()
Returns serial number.
=cut
=back

View File

@@ -23,22 +23,15 @@ $VERSION = '3.70-135';
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'model_oid' => 'mib-2.47.1.1.1.1.13.1',
'model_oid_41752' => 'enterprises.41752.6.1.1.1.19.0',
'model_oid_8886_6_140' => 'enterprises.8886.6.1.1.1.19.0',
'serial_oid' => 'mib-2.47.1.1.1.1.11.1',
'serial_oid_41752' => 'enterprises.41752.6.1.1.1.14.0',
'serial_oid_8886_6_140' => 'enterprises.8886.6.1.1.1.14.0',
'os_ver_oid' => 'mib-2.47.1.1.1.1.10.1',
'os_ver_oid_41752' => 'enterprises.41752.6.1.1.1.1.0',
'os_ver_oid_8886_6_140' => 'enterprises.8886.6.1.1.1.1.0',
'brom_oid' => 'mib-2.47.1.1.1.1.9.1',
'brom_oid_41752' => 'enterprises.41752.6.1.1.1.13.0',
'brom_oid_8886_6_140' => 'enterprises.8886.6.1.1.1.13.0',
'hw_oid' => 'mib-2.47.1.1.1.1.8.1',
'hw_oid_41752' => 'enterprises.41752.6.1.1.1.2.0',
'hw_oid_8886_6_140' => 'enterprises.8886.6.1.1.1.2.0',
'model_rotek' => 'enterprises.41752.3.1.1.1.3.0',
'model_41752' => 'enterprises.41752.3.1.1.1.3.0',
);
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
@@ -47,45 +40,20 @@ $VERSION = '3.70-135';
sub vendor {
my $obj = shift;
return main($obj)->{vendor};
return 'raisecom';
}
sub os {
my $obj = shift;
return main($obj)->{os};
return 'raisecom-os';
}
sub main {
my $obj = shift;
my $response = undef; my $serial = undef; my $model = undef; my $hw = undef; my $os_ver = undef; my $brom = undef;
my $vendor = 'raisecom'; my $os = 'rcios';
my $id = $obj->id;
#Rotek kostilyng
if ($id =~ /41752$/) {
my %rotek = ();#undef;#('vendor', 'os', 'model', 'os_ver', 'serial');
for my $key ('vendor', 'os', 'model', 'os_ver', 'serial') {
no strict 'refs';
my $sub = *{'SNMP::Info::Layer3::Rotek::'.$key};
$rotek{$key} = &$sub($obj);
}
return %rotek;
}
if ( $id =~ /41752\.26\.502/ ) {
$model = $obj->model_oid_41752 || undef;
$hw = ($obj->hw_oid_41752 =~ /.*\sversion\s(.*)/)[0];
$obj->os_ver_oid_41752 =~ /ROS_(.*)\.(\d+)/;
$os_ver = $1 . ' (' . $2 . ')' if defined($1) and defined($2);
$obj->brom_oid_41752 =~ /.*_BOOT_(.*)_(\d+)/;
$brom = $1 . ' (' . $2 . ')' if defined($1) and defined($2);
$serial = $obj->serial_oid_41752 || undef;
}
elsif ($id =~ /8886\.6\.(140|191|150|21[3,4])$/) {
if ($id =~ /8886\.6\.(140|191|150|21[3,4])$/) {
$model = $obj->model_oid_8886_6_140 || undef;
$obj->os_ver_oid_8886_6_140 =~ /ROS_(.*)\.ISCOM.*\.(\d*\.+\d*)/;
@@ -137,7 +105,7 @@ sub main {
$model .= ' HW:' . $hw if defined($model) and defined($hw);
$os_ver .= ' bootrom:' . $brom if defined($os_ver) and defined($brom);
return { 'vendor' => $vendor, 'os' => $os, 'model' => $model, 'os_ver' => $os_ver, 'serial' => $serial };
return { 'model' => $model, 'os_ver' => $os_ver, 'serial' => $serial };
}
sub os_ver {

View File

@@ -20,9 +20,7 @@ $VERSION = '3.70-135';
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'model_41752' => 'enterprises.41752.3.1.1.1.3.0',
'model_rotek' => 'enterprises.32761.3.1.1.1.3.0',
'submodel' => 'enterprises.32761.3.1.1.1.2.0',
'model_oid' => 'enterprises.41752.3.1.1.1.3.0',
);
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
@@ -34,38 +32,91 @@ sub vendor {
}
sub os {
return 'rotek';
return 'rotek-os';
}
sub os_ver {
my $obj = shift;
my $os_ver;
my $os_ver_oid = $obj->description;
$os_ver_oid =~ /\,\s(.*)/;
$os_ver = $1;
my $os_ver = undef;
if (defined $os_ver) {
return $os_ver;
my $os_ver_oid = $obj->os_ver_oid_41752 || undef;
$os_ver_oid =~ /ROS_(.*)\.(\d+)/ || undef $_ if defined $os_ver_oid;
$os_ver = $1 . ' (' . $2 . ')' if defined($1) and defined($2);
while(not defined $os_ver) {
$obj->description =~ /\,\s(.*)/;
$os_ver = $1 if defined $1;
last if defined $os_ver;
$obj->description() =~ /[\w,\W,\d,\-]+v\d+rev\d+\s+([\d,\.]+)\s+[\w,\-,\d]+$/;
$os_ver = $1 if defined $1;
last;
}
return $os_ver if defined $os_ver;
return 'unknown';
}
sub brom {
my $obj = shift;
my $brom = undef;
$obj->brom_oid_41752 =~ /.*_BOOT_(.*)_(\d+)/;
$brom = $1 . ' (' . $2 . ')' if defined($1) and defined($2);
return $brom if defined $brom;
}
sub model {
my $obj = shift;
my $id = $obj->id();
if ($id =~ /32761$/) {
return $obj->model_rotek . ' (' . $obj->submodel . ')';
}
elsif ($id =~ /41752$/) {
return $obj->model_41752;
my $hw = $obj->hwver() || undef;
my $model = $obj->model_oid || undef;
while (not defined $model) {
$model = $obj->model_oid_41752 || undef;
last if defined $model;
$obj->description() =~ /([\w,\W,\d,\-]+)v\d+rev\d+\s+[\d,\.]+\s+[\w,\-,\d]+$/;
$model = $1 if defined $1;
last if defined $model;
last;
}
$model .= ' HW:' . $hw if defined $hw;
return $model if defined $model;
return $obj->SUPER::model();
}
sub serial {
my $obj = shift;
my $serial = $obj->serial_oid_41752 || undef;
while (not defined $serial) {
$obj->description() =~ /[\w,\W,\d,\-]+v\d+rev\d+\s+[\d,\.]+\s+([\w,\-,\d]+)$/;
$serial = $1 if defined $1;
last;
}
return $serial if defined $serial;
return $obj->SUPER::serial();
}
sub hwver{
my $obj = shift;
my $hw = ($obj->hw_oid_41752 =~ /.*\sversion\s(.*)/)[0] || undef if defined $obj->hw_oid_41752;
while (not defined $hw) {
$obj->description() =~ /[\w,\W,\d,\-]+(v\d+rev\d+)\s+[\d,\.]+\s+[\w,\-,\d]+$/;
$hw = $1 if defined $1;
last;
}
return $hw if defined $hw;
}
1;
__END__
@@ -116,7 +167,7 @@ Returns 'rotek'
=item $obj->os()
Returns 'rotek'
Returns 'rotek-os'
=item $obj->os_ver()