diff --git a/.travis.yml b/.travis.yml index cf643da0..ebad4188 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ before_install: - mkdir ~/netdisco-mibs - cd ~/netdisco-mibs 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 before_script: - 'cd ${TRAVIS_BUILD_DIR}' diff --git a/Changes b/Changes index 602a0bf2..3d76535c 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ Version 3.65 () [ENHANCEMENTS] + * #310 bring layer3::oneaccess up to date for oneos6. (inphobia) * Add two more HP 2930F models (JeroenvIS) * #296 expand CiscoAgg to also include LACP based aggregated links and staticly aggregated links. (inphobia) @@ -10,6 +11,7 @@ Version 3.65 () * #295 make CiscoAgg return ifindex like expected instead of bp_index (inphobia) + * more documentation fixes + whitespace cleanup in all files. Version 3.64 (2018-12-30) diff --git a/lib/SNMP/Info/Layer3/OneAccess.pm b/lib/SNMP/Info/Layer3/OneAccess.pm index ac683d74..2145a722 100644 --- a/lib/SNMP/Info/Layer3/OneAccess.pm +++ b/lib/SNMP/Info/Layer3/OneAccess.pm @@ -44,11 +44,16 @@ use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; $VERSION = '3.64'; %MIBS = ( - %SNMP::Info::Layer3::MIBS + %SNMP::Info::Layer3::MIBS, + 'ONEACCESS-GLOBAL-REG' => 'oacOne10', + 'ONEACCESS-SYS-MIB' => 'oacSysSecureCrashlogCount', ); %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 = ( @@ -59,13 +64,26 @@ $VERSION = '3.64'; %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 { - return "OneAccess"; + return "oneaccess"; } 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 { @@ -73,15 +91,23 @@ sub os { } sub os_ver { - my $OneAccess = shift; - my $descr = $OneAccess->description(); - my $os_ver = undef; + my $oneos = shift; + my $descr = $oneos->description(); - if ( $descr =~ /V(\d.+)$/ ) { - $os_ver = $1; + # there is no easy way to get the os version, and the syntax also + # 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 $os_ver; + return; } sub i_ignore { @@ -105,7 +131,7 @@ __END__ =head1 NAME -SNMP::Info::Layer3::OneAccess - SNMP Interface to OneAccess Layer 3 routers. +SNMP::Info::Layer3::OneAccess - SNMP Interface to OneAccess routers. =head1 AUTHORS @@ -114,7 +140,7 @@ Rob Woodward =head1 SYNOPSIS # Let SNMP::Info determine the correct subclass for you. - my $OneAccess = new SNMP::Info( + my $oneos = new SNMP::Info( AutoSpecify => 1, Debug => 1, DestHost => 'myrouter', @@ -123,12 +149,12 @@ Rob Woodward ) 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"; =head1 DESCRIPTION -Subclass for OneAccess Quidway switches +Subclass for OneAccess routers. =head2 Inherited Classes @@ -142,7 +168,15 @@ Subclass for OneAccess Quidway switches =over -=item Inherited Classes' MIBs +=item F + +=item F + +=back + +=head2 Inherited Classes' MIBs + +=over See L for its own MIB requirements. @@ -150,25 +184,36 @@ See L for its own MIB requirements. =head1 GLOBALS -These are methods that return scalar value from SNMP +These are methods that return scalar value from SNMP. =over -=item $OneAccess->vendor() +=item $oneos->oa_model() -Returns 'OneAccess'. +Returns the hardware model from C. -=item $OneAccess->os() - -Returns 'oneos'. - -=item $OneAccess->os_ver() +=item $oneos->os_ver() Returns the software version extracted from C. -=item $OneAccess->model() +=back -Returns the hardware model one300. +=head2 Overrides + +=over + +=item $oneos->model() + +Returns C with a fallback to C from +L. + +=item $oneos->os() + +Returns 'oneos'. + +=item $oneos->vendor() + +Returns 'oneaccess'. =back @@ -185,7 +230,7 @@ to a hash. =over -=item $OneAccess->i_ignore() +=item $oneos->i_ignore() Returns reference to hash. Increments value of IID if port is to be ignored. diff --git a/xt/lib/Test/SNMP/Info/Layer3/OneAccess.pm b/xt/lib/Test/SNMP/Info/Layer3/OneAccess.pm index 8b6f95ad..a2a9e5f3 100644 --- a/xt/lib/Test/SNMP/Info/Layer3/OneAccess.pm +++ b/xt/lib/Test/SNMP/Info/Layer3/OneAccess.pm @@ -50,6 +50,7 @@ sub setup : Tests(setup) { '_layers' => 79, '_description' => 'ONEOS5-VOIP_H323-V4.3R4E18', '_id' => '.1.3.6.1.4.1.13191.1.1.30', + '_oa_model' => 'ONE420', 'store' => {}, }; $test->{info}->cache($cache_data); @@ -62,11 +63,14 @@ sub os : Tests(2) { is($test->{info}->os(), 'oneos', q(OS returns 'oneos')); } -sub os_ver : Tests(3) { +sub os_ver : Tests(4) { my $test = shift; 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(); is($test->{info}->os_ver(), undef, @@ -77,14 +81,14 @@ sub vendor : Tests(2) { my $test = shift; 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) { my $test = shift; 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;