From ea2928babd1d3bb8722440cf35749d3538cea0e4 Mon Sep 17 00:00:00 2001 From: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com> Date: Mon, 8 Jun 2020 06:32:15 +0200 Subject: [PATCH] VRP FDB table correctly parsed on some CE switches (#11766) * vrp FDB table corrected on CE switches * sleep 5 in snmpsim to run tests. * 6 seconds wait when snmpsim.fork is called from bootstrap * rollback in Snmpsim Class * Update bootstrap.php --- includes/discovery/fdb-table/vrp.inc.php | 5 ++++- tests/bootstrap.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/discovery/fdb-table/vrp.inc.php b/includes/discovery/fdb-table/vrp.inc.php index fcfa3224b6..f1166c404d 100644 --- a/includes/discovery/fdb-table/vrp.inc.php +++ b/includes/discovery/fdb-table/vrp.inc.php @@ -22,7 +22,10 @@ if (!empty($fdbPort_table)) { // Collect data and populate $insert foreach ($fdbPort_table as $mac => $data) { foreach ($data[$data_oid] as $vlan => $basePort) { - $ifIndex=$basePort[0]; + $ifIndex=reset($basePort); // $baseport can be ['' => '119'] or ['0' => '119'] + if (! $ifIndex) { + continue; + } $port = get_port_by_index_cache($device['device_id'], $ifIndex); $port_id = $port['port_id']; $mac_address = implode(array_map('zeropad', explode(':', $mac))); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index ca0cd6bcf7..cb3ea93ad5 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -44,7 +44,7 @@ ini_set('display_errors', 1); $snmpsim = new Snmpsim('127.1.6.2', 1162, null); if (getenv('SNMPSIM')) { - $snmpsim->fork(); + $snmpsim->fork(6); // make PHP hold on a reference to $snmpsim so it doesn't get destructed register_shutdown_function(function (Snmpsim $ss) {