Relax validation of MIB access checks until we have broader test coverage that this is a non-breaking change
Mark corresponding test TODO in Info test class
This commit is contained in:
4
Changes
4
Changes
@@ -17,8 +17,8 @@ Version 3.54
|
|||||||
* Don't use MIB leafs that are not-accessible according to MIB
|
* Don't use MIB leafs that are not-accessible according to MIB
|
||||||
* Fix logic for determining if MIB leaf supports set operations
|
* Fix logic for determining if MIB leaf supports set operations
|
||||||
NOTE: Fixing this logic now results in methods starting with set_ on MIB
|
NOTE: Fixing this logic now results in methods starting with set_ on MIB
|
||||||
leafs without Write or Create access and ANY method on a MIB leaf that is
|
leafs without Write or Create access failing validation in
|
||||||
not-accessible failing validation in _validate_autoload_method()
|
_validate_autoload_method()
|
||||||
|
|
||||||
Version 3.53 (2018-03-22)
|
Version 3.53 (2018-03-22)
|
||||||
|
|
||||||
|
|||||||
@@ -4626,15 +4626,13 @@ sub _validate_autoload_method {
|
|||||||
# If we were given a fully qualified OID because we don't have the MIB
|
# If we were given a fully qualified OID because we don't have the MIB
|
||||||
# file, it will translate above but we won't be able to check access so
|
# file, it will translate above but we won't be able to check access so
|
||||||
# skip the check and return
|
# skip the check and return
|
||||||
if ($access) {
|
if ($access && $method =~ /^set/ && $access !~ /Write|Create/) {
|
||||||
unless ( ( $method =~ /^set/ && $access =~ /Write|Create/ )
|
|
||||||
|| ($method !~ /^set/ && $access =~ /Read|Create/) )
|
|
||||||
{
|
|
||||||
print
|
print
|
||||||
"SNMP::Info::_validate_autoload_method($attr : $oid) Not accessable for requested operation.\n"
|
"SNMP::Info::_validate_autoload_method($attr : $oid) Not accessable for requested operation.\n"
|
||||||
if $self->debug();
|
if $self->debug();
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# If the parent of the leaf has indexes it is contained within a table
|
# If the parent of the leaf has indexes it is contained within a table
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ sub loopdetect : Tests(4) {
|
|||||||
|
|
||||||
sub device_type : Tests(+6) {
|
sub device_type : Tests(+6) {
|
||||||
my $test = shift;
|
my $test = shift;
|
||||||
|
$test->SUPER::device_type();
|
||||||
|
|
||||||
# No sysServices and unknown sysDescr results in SNMP::Info
|
# No sysServices and unknown sysDescr results in SNMP::Info
|
||||||
my $cache_data
|
my $cache_data
|
||||||
@@ -252,7 +253,7 @@ sub device_type : Tests(+6) {
|
|||||||
};
|
};
|
||||||
$test->{info}->cache($cache_data);
|
$test->{info}->cache($cache_data);
|
||||||
is($test->{info}->device_type,
|
is($test->{info}->device_type,
|
||||||
'SNMP::Info::Layer7::APC', 'Layer 1 device type by sysObjectID');
|
'SNMP::Info::Layer7::APC', 'Layer 7 device type by sysObjectID');
|
||||||
$test->{info}->clear_cache();
|
$test->{info}->clear_cache();
|
||||||
|
|
||||||
# We will test each specific subclass, so no need to check that logic here
|
# We will test each specific subclass, so no need to check that logic here
|
||||||
@@ -1597,10 +1598,15 @@ sub private_validate_autoload_method : Tests(8) {
|
|||||||
q(Func 'ifPromiscuousMode_raw' validates)
|
q(Func 'ifPromiscuousMode_raw' validates)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
TODO: {
|
||||||
|
local $TODO
|
||||||
|
= "Check MIB access for non set methods in _validate_autoload_method"
|
||||||
|
if 1;
|
||||||
|
|
||||||
# Test that not-accessible leaf returns undef IF-MIB::ifStackHigherLayer
|
# Test that not-accessible leaf returns undef IF-MIB::ifStackHigherLayer
|
||||||
is($test->{info}->_validate_autoload_method('ifStackHigherLayer'),
|
is($test->{info}->_validate_autoload_method('ifStackHigherLayer'),
|
||||||
undef, q(MIB leaf 'ifStackHigherLayer' not-accessible, returns undef));
|
undef, q(MIB leaf 'ifStackHigherLayer' not-accessible, returns undef));
|
||||||
|
}
|
||||||
|
|
||||||
# Test that read-only leaf won't validate set_
|
# Test that read-only leaf won't validate set_
|
||||||
is($test->{info}->_validate_autoload_method('set_i_lastchange'),
|
is($test->{info}->_validate_autoload_method('set_i_lastchange'),
|
||||||
|
|||||||
Reference in New Issue
Block a user