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 <bot@styleci.io>
This commit is contained in:
Tony Murray
2024-07-17 16:05:07 -05:00
committed by GitHub
parent 10669226fc
commit 1cceafb887
11 changed files with 100 additions and 212 deletions

View File

@@ -143,9 +143,9 @@ class OSDiscoveryTest extends TestCase
private function genDevice($community): Device
{
return new Device([
'hostname' => $this->getSnmpsim()->getIP(),
'hostname' => $this->getSnmpsim()->ip,
'snmpver' => 'v2c',
'port' => $this->getSnmpsim()->getPort(),
'port' => $this->getSnmpsim()->port,
'timeout' => 3,
'retries' => 0,
'snmp_max_repeaters' => 10,

View File

@@ -36,10 +36,11 @@ chdir($install_dir);
ini_set('display_errors', '1');
//error_reporting(E_ALL & ~E_WARNING);
$snmpsim = new Snmpsim('127.1.6.2', 1162, null);
$snmpsim = new Snmpsim('127.1.6.2', 1162);
if (getenv('SNMPSIM')) {
if (! getenv('GITHUB_ACTIONS')) {
$snmpsim->fork(6);
$snmpsim->setupVenv();
$snmpsim->start();
}
// make PHP hold on a reference to $snmpsim so it doesn't get destructed