update oneaccess (#310)

* update oneaccess, regretfully it seems oneos version6 is a step back when it comes to snmp support.
changes:
 * start using oneaccess mibs, not much useable data there yet however
 * return the device model
 * show os version for version 6 too. not many elegeant ways to handle all the version syntaxes used,
     so just dump what resembles a version string & be done with it
 * updated documentation

tested on:
 one420 - os V5.2R1C12
 one521 - os 6.1.rc1patch06
 one521 - os 6.1.3

some comments in the code as what works & what doesn't.

* typo

* bump required netdisco-mibs version to 4.014 (not released yet) but needed for oneaccess mibs. might as well fail at the start of the build instead of the end

* 2 tests fixed for oneaccess, 1 more to go

* last test fixed

* a few more changes

but mostly need to have a file change so i can trigger a travis build :)
This commit is contained in:
nick n
2019-02-24 15:57:21 +01:00
committed by Oliver Gorwits
parent 3b604723bd
commit 4ba91f9df8
4 changed files with 82 additions and 31 deletions

View File

@@ -12,7 +12,7 @@ before_install:
- mkdir ~/netdisco-mibs - mkdir ~/netdisco-mibs
- cd ~/netdisco-mibs - cd ~/netdisco-mibs
install: install:
- curl -sL https://github.com/netdisco/netdisco-mibs/releases/download/4.010/netdisco-mibs.tar.gz | tar --strip-components=1 -zxf - - curl -sL https://github.com/netdisco/netdisco-mibs/releases/download/4.014/netdisco-mibs.tar.gz | tar --strip-components=1 -zxf -
- cpanm --quiet --notest PkgConfig Test::CChecker Alien::zlib::Static Alien::OpenSSL::Static Alien::SNMP::MAXTC - cpanm --quiet --notest PkgConfig Test::CChecker Alien::zlib::Static Alien::OpenSSL::Static Alien::SNMP::MAXTC
before_script: before_script:
- 'cd ${TRAVIS_BUILD_DIR}' - 'cd ${TRAVIS_BUILD_DIR}'

View File

@@ -2,6 +2,7 @@ Version 3.65 ()
[ENHANCEMENTS] [ENHANCEMENTS]
* #310 bring layer3::oneaccess up to date for oneos6. (inphobia)
* Add two more HP 2930F models (JeroenvIS) * Add two more HP 2930F models (JeroenvIS)
* #296 expand CiscoAgg to also include LACP based aggregated links * #296 expand CiscoAgg to also include LACP based aggregated links
and staticly aggregated links. (inphobia) and staticly aggregated links. (inphobia)
@@ -10,6 +11,7 @@ Version 3.65 ()
* #295 make CiscoAgg return ifindex like expected instead of * #295 make CiscoAgg return ifindex like expected instead of
bp_index (inphobia) bp_index (inphobia)
* more documentation fixes + whitespace cleanup in all files.
Version 3.64 (2018-12-30) Version 3.64 (2018-12-30)

View File

@@ -44,11 +44,16 @@ use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
$VERSION = '3.64'; $VERSION = '3.64';
%MIBS = ( %MIBS = (
%SNMP::Info::Layer3::MIBS %SNMP::Info::Layer3::MIBS,
'ONEACCESS-GLOBAL-REG' => 'oacOne10',
'ONEACCESS-SYS-MIB' => 'oacSysSecureCrashlogCount',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
# model can be based on oacOneOsDevices, but the mib isn't up to date,
# so use the first product name instead
'oa_model' => 'oacExpIMSysHwcProductName.0',
); );
%FUNCS = ( %FUNCS = (
@@ -59,13 +64,26 @@ $VERSION = '3.64';
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE,
); );
# notes:
# duplex: oneos v5 has dot3StatsDuplexStatus but it always seems to
# return 0 so useless. oneos v6 no longer has any info.
# macsuck: bridge-mib and oneaccess mibs didn't return useable data
# arpnip: oneos v5 returns usable data from ip-mib & rfc1213 which is
# usable, both version support ip-forward-mib but this does not by
# itself provide enough data to be usable. v6 even fails for the
# snmp::info->ipforwarding() test.
sub vendor { sub vendor {
return "OneAccess"; return "oneaccess";
} }
sub model { sub model {
return 'One300'; my $oneos = shift;
# prefer oneaccess mib, but can fall back to entity mib
return $oneos->oa_model()
|| $oneos->e_model();
} }
sub os { sub os {
@@ -73,15 +91,23 @@ sub os {
} }
sub os_ver { sub os_ver {
my $OneAccess = shift; my $oneos = shift;
my $descr = $OneAccess->description(); my $descr = $oneos->description();
my $os_ver = undef;
if ( $descr =~ /V(\d.+)$/ ) { # there is no easy way to get the os version, and the syntax also
$os_ver = $1; # changed between major versions. for now we'll use everything after
# the last dash as version string
# SNMPv2-MIB::sysDescr.0 = STRING: OneOS-pCPE-ARM_pi1-6.1.rc1patch06
# SNMPv2-MIB::sysDescr.0 = STRING: OneOS-pCPE-ARM_pi1-6.1.3
# SNMPv2-MIB::sysDescr.0 = STRING: ONEOS16-ADVIP_11N-V5.2R1C12
# and this one comes from the snmp::info test modules: ONEOS5-VOIP_H323-V4.3R4E18
if (defined $descr) {
if ( $descr =~ /^.*-(.*$)/ ) {
return $1;
}
} }
return;
return $os_ver;
} }
sub i_ignore { sub i_ignore {
@@ -105,7 +131,7 @@ __END__
=head1 NAME =head1 NAME
SNMP::Info::Layer3::OneAccess - SNMP Interface to OneAccess Layer 3 routers. SNMP::Info::Layer3::OneAccess - SNMP Interface to OneAccess routers.
=head1 AUTHORS =head1 AUTHORS
@@ -114,7 +140,7 @@ Rob Woodward
=head1 SYNOPSIS =head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you. # Let SNMP::Info determine the correct subclass for you.
my $OneAccess = new SNMP::Info( my $oneos = new SNMP::Info(
AutoSpecify => 1, AutoSpecify => 1,
Debug => 1, Debug => 1,
DestHost => 'myrouter', DestHost => 'myrouter',
@@ -123,12 +149,12 @@ Rob Woodward
) )
or die "Can't connect to DestHost.\n"; or die "Can't connect to DestHost.\n";
my $class = $OneAccess->class(); my $class = $oneos->class();
print "SNMP::Info determined this device to fall under subclass : $class\n"; print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION =head1 DESCRIPTION
Subclass for OneAccess Quidway switches Subclass for OneAccess routers.
=head2 Inherited Classes =head2 Inherited Classes
@@ -142,7 +168,15 @@ Subclass for OneAccess Quidway switches
=over =over
=item Inherited Classes' MIBs =item F<ONEACCESS-GLOBAL-REG>
=item F<ONEACCESS-SYS-MIB>
=back
=head2 Inherited Classes' MIBs
=over
See L<SNMP::Info::Layer3> for its own MIB requirements. See L<SNMP::Info::Layer3> for its own MIB requirements.
@@ -150,25 +184,36 @@ See L<SNMP::Info::Layer3> for its own MIB requirements.
=head1 GLOBALS =head1 GLOBALS
These are methods that return scalar value from SNMP These are methods that return scalar value from SNMP.
=over =over
=item $OneAccess->vendor() =item $oneos->oa_model()
Returns 'OneAccess'. Returns the hardware model from C<oacExpIMSysHwcProductName.0>.
=item $OneAccess->os() =item $oneos->os_ver()
Returns 'oneos'.
=item $OneAccess->os_ver()
Returns the software version extracted from C<sysDescr>. Returns the software version extracted from C<sysDescr>.
=item $OneAccess->model() =back
Returns the hardware model one300. =head2 Overrides
=over
=item $oneos->model()
Returns C<oa_model()> with a fallback to C<e_model()> from
L<SNMP::Info::Entity>.
=item $oneos->os()
Returns 'oneos'.
=item $oneos->vendor()
Returns 'oneaccess'.
=back =back
@@ -185,7 +230,7 @@ to a hash.
=over =over
=item $OneAccess->i_ignore() =item $oneos->i_ignore()
Returns reference to hash. Increments value of IID if port is to be ignored. Returns reference to hash. Increments value of IID if port is to be ignored.

View File

@@ -50,6 +50,7 @@ sub setup : Tests(setup) {
'_layers' => 79, '_layers' => 79,
'_description' => 'ONEOS5-VOIP_H323-V4.3R4E18', '_description' => 'ONEOS5-VOIP_H323-V4.3R4E18',
'_id' => '.1.3.6.1.4.1.13191.1.1.30', '_id' => '.1.3.6.1.4.1.13191.1.1.30',
'_oa_model' => 'ONE420',
'store' => {}, 'store' => {},
}; };
$test->{info}->cache($cache_data); $test->{info}->cache($cache_data);
@@ -62,11 +63,14 @@ sub os : Tests(2) {
is($test->{info}->os(), 'oneos', q(OS returns 'oneos')); is($test->{info}->os(), 'oneos', q(OS returns 'oneos'));
} }
sub os_ver : Tests(3) { sub os_ver : Tests(4) {
my $test = shift; my $test = shift;
can_ok($test->{info}, 'os_ver'); can_ok($test->{info}, 'os_ver');
is($test->{info}->os_ver(), '4.3R4E18', q(OS version has expected value)); is($test->{info}->os_ver(), 'V4.3R4E18', q(OS version 4 has expected value));
$test->{info}{_description} = 'OneOS-pCPE-ARM_pi1-6.1.3';
is($test->{info}->os_ver(), '6.1.3', q(OS version 6 has expected value));
$test->{info}->clear_cache(); $test->{info}->clear_cache();
is($test->{info}->os_ver(), undef, is($test->{info}->os_ver(), undef,
@@ -77,14 +81,14 @@ sub vendor : Tests(2) {
my $test = shift; my $test = shift;
can_ok($test->{info}, 'vendor'); can_ok($test->{info}, 'vendor');
is($test->{info}->vendor(), 'OneAccess', q(Vendor returns 'OneAccess')); is($test->{info}->vendor(), 'oneaccess', q(Vendor returns 'oneaccess'));
} }
sub model : Tests(2) { sub model : Tests(2) {
my $test = shift; my $test = shift;
can_ok($test->{info}, 'model'); can_ok($test->{info}, 'model');
is($test->{info}->model(), 'One300', q(Model has expected value)); is($test->{info}->model(), 'ONE420', q(Model has expected value));
} }
1; 1;