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:
Tony Murray
2024-07-17 16:05:07 -05:00
committed by GitHub
co-authored by StyleCI Bot
parent 10669226fc
commit 1cceafb887
11 changed files with 100 additions and 212 deletions
+4 -4
View File
@@ -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);
}