mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Improve Snmpsim usage to ease testing (#15471)
* Snmpsim use python venv Patch to enable listening while minimizing output Update lnms dev:simulate, tests, and ./scripts/save-test-data.php removed old option to start snmpsim from older scripts, use lnms dev:simulate * Apply fixes from StyleCI * various fixes * Remove patch official package is updated --------- Co-authored-by: StyleCI Bot <[email protected]>
This commit is contained in:
co-authored by
StyleCI Bot
parent
10669226fc
commit
1cceafb887
@@ -560,17 +560,17 @@ class ModuleTestHelper
|
||||
}
|
||||
|
||||
// Remove existing device in case it didn't get removed previously
|
||||
if (($existing_device = device_by_name($snmpsim->getIp())) && isset($existing_device['device_id'])) {
|
||||
if (($existing_device = device_by_name($snmpsim->ip)) && isset($existing_device['device_id'])) {
|
||||
delete_device($existing_device['device_id']);
|
||||
}
|
||||
|
||||
// Add the test device
|
||||
try {
|
||||
$new_device = new Device([
|
||||
'hostname' => $snmpsim->getIp(),
|
||||
'hostname' => $snmpsim->ip,
|
||||
'version' => 'v2c',
|
||||
'community' => $this->file_name,
|
||||
'port' => $snmpsim->getPort(),
|
||||
'port' => $snmpsim->port,
|
||||
'disabled' => 1, // disable to block normal pollers
|
||||
]);
|
||||
(new ValidateDeviceAndCreate($new_device, true))->execute();
|
||||
@@ -647,7 +647,7 @@ class ModuleTestHelper
|
||||
$data = array_merge_recursive($data, $this->dumpDb($device_id, $polled_modules, 'poller'));
|
||||
|
||||
// Remove the test device, we don't need the debug from this
|
||||
if ($device['hostname'] == $snmpsim->getIp()) {
|
||||
if ($device['hostname'] == $snmpsim->ip) {
|
||||
Debug::set(false);
|
||||
delete_device($device_id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user