Mark OID not increasing as invalid (#13548)

* Mark OID not increasing as invalid

* Provisional test data

* verified return code is 1
This commit is contained in:
Tony Murray
2021-11-24 11:22:15 -06:00
committed by GitHub
parent 42fdbea126
commit 61eae8fb6a
2 changed files with 6 additions and 1 deletions

View File

@@ -68,7 +68,7 @@ class SnmpResponse
{
$this->errorMessage = '';
// not checking exitCode because I think it may lead to false negatives
$invalid = preg_match('/(Timeout: No Response from .*|Unknown user name|Authentication failure)/', $this->stderr, $errors)
$invalid = preg_match('/(Timeout: No Response from .*|Unknown user name|Authentication failure|Error: OID not increasing: .*)/', $this->stderr, $errors)
|| empty($this->raw)
|| preg_match('/(No Such Instance|No Such Object|No more variables left).*/', $this->raw, $errors);

View File

@@ -222,5 +222,10 @@ HOST-RESOURCES-MIB::hrStorageUsed.36 = 127044934
$response = new SnmpResponse('', "snmpget: Authentication failure (incorrect password, community or key) (Sub-id not found: (top) -> sysDescr)\n", 1);
$this->assertFalse($response->isValid());
$this->assertEquals('Authentication failure', $response->getErrorMessage());
// OID not increasing
$response = new SnmpResponse(".1.3.6.1.2.1.2.2.1.1.1 = INTEGER: 1\n", "Error: OID not increasing: .1.3.6.1.2.100.2.2.1.1\n >= .1.3.6.1.2.1.2.2.1.1.1\n", 1);
$this->assertFalse($response->isValid());
$this->assertEquals('Error: OID not increasing: .1.3.6.1.2.100.2.2.1.1', $response->getErrorMessage());
}
}