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 <bot@styleci.io>
This commit is contained in:
@ -5,7 +5,6 @@ use Illuminate\Support\Str;
|
||||
use LibreNMS\Exceptions\InvalidModuleException;
|
||||
use LibreNMS\Util\Debug;
|
||||
use LibreNMS\Util\ModuleTestHelper;
|
||||
use LibreNMS\Util\Snmpsim;
|
||||
|
||||
$install_dir = realpath(__DIR__ . '/..');
|
||||
chdir($install_dir);
|
||||
@ -23,18 +22,11 @@ $options = getopt(
|
||||
'variant:',
|
||||
'file:',
|
||||
'debug',
|
||||
'snmpsim',
|
||||
'full',
|
||||
'help',
|
||||
]
|
||||
);
|
||||
|
||||
if (isset($options['snmpsim'])) {
|
||||
$snmpsim = new Snmpsim();
|
||||
$snmpsim->run();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($options['v'])) {
|
||||
$variant = $options['v'];
|
||||
} elseif (isset($options['variant'])) {
|
||||
|
@ -20,7 +20,6 @@ $options = getopt(
|
||||
'no-save',
|
||||
'file:',
|
||||
'debug',
|
||||
'snmpsim',
|
||||
'help',
|
||||
]
|
||||
);
|
||||
@ -32,12 +31,6 @@ Debug::setVerbose(
|
||||
Debug::set(isset($options['d']) || isset($options['debug']))
|
||||
);
|
||||
|
||||
if (isset($options['snmpsim'])) {
|
||||
$snmpsim = new Snmpsim();
|
||||
$snmpsim->run();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($options['h'])
|
||||
|| isset($options['help'])
|
||||
|| ! (isset($options['o']) || isset($options['os']) || isset($options['m']) || isset($options['modules']))
|
||||
@ -120,9 +113,10 @@ if (isset($options['f'])) {
|
||||
|
||||
// Now use the saved data to update the saved database data
|
||||
$snmpsim = new Snmpsim();
|
||||
$snmpsim->fork();
|
||||
$snmpsim_ip = $snmpsim->getIp();
|
||||
$snmpsim_port = $snmpsim->getPort();
|
||||
$snmpsim->setupVenv();
|
||||
$snmpsim->start();
|
||||
echo "Waiting for snmpsim to initialize...\n";
|
||||
$snmpsim->waitForStartup();
|
||||
|
||||
if (! $snmpsim->isRunning()) {
|
||||
echo "Failed to start snmpsim, make sure it is installed, working, and there are no bad snmprec files.\n";
|
||||
@ -130,8 +124,6 @@ if (! $snmpsim->isRunning()) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo "Pausing 10 seconds to allow snmpsim to initialize...\n";
|
||||
sleep(10);
|
||||
echo "\n";
|
||||
|
||||
try {
|
||||
|
Reference in New Issue
Block a user