$dcp) { if ($dcp['dcpLinkviewLocalStatus'] !== 'up') { continue; } $port = get_port_by_index_cache($device, $ifIndex); $remote_hostname = $dcp['dcpLinkviewRemoteHostname']; // Try find a remote device and check if already cached $remote_device_id = get_autodiscovery_device_id($device, $remote_hostname); if (is_null($remote_device_id) && // NULL - never cached in other rounds check_autodiscovery($remote_hostname)) { // Check all previous autodiscovery rounds // Neighbour never checked, try autodiscovery $remote_device_id = autodiscovery_device($remote_hostname, NULL, 'DCP', '', $device, $port); } $remote_port_id = NULL; if ($remote_device_id) { $if = $dcp['dcpLinkviewRemoteName']; $query = 'SELECT `port_id` FROM `ports` WHERE (`ifName` = ? OR `ifDescr` = ? OR `port_label_short` = ?) AND `device_id` = ? AND `deleted` = ?'; $remote_port_id = dbFetchCell($query, [$if, $if, $if, $remote_device_id, 0]); } $neighbour = [ 'remote_device_id' => $remote_device_id, 'remote_port_id' => $remote_port_id, 'remote_hostname' => $remote_hostname, 'remote_port' => $dcp['dcpLinkviewRemoteName'], 'remote_platform' => '', 'remote_version' => '', ]; discover_neighbour($port, 'dcp', $neighbour); } // EOF