Improve SnmpResponse value() (#14605)

* Improve SnmpResponse value
Can now return a specific oid or the first non-empty oid in a list.
Cache values() call on object to avoid repeated parsing
Improved types

* fix style

* extract getOidParts to fix errors from different parts of the code parsing differently

* new object to deal with cache

* More tests

* whitespace

* style
This commit is contained in:
Tony Murray
2022-11-30 19:50:46 -06:00
committed by GitHub
parent 2a8b8b864b
commit e8c3b2c924
4 changed files with 150 additions and 61 deletions

View File

@@ -236,7 +236,7 @@ class Core implements Module
->options($value['options'] ?? null)
->mibDir($value['mib_dir'] ?? $mibdir)
->walk(isset($value['mib']) ? "{$value['mib']}::{$value['oid']}" : $value['oid'])
->raw();
->raw;
if (Compare::values($walk_value, $value['value'], $value['op'] ?? 'contains') == $check) {
return false;
}