Merge pull request #3561 from geordish/issue-2715

Enable discovery of CDP neighbour by IP address
This commit is contained in:
Neil Lathwood
2016-05-26 21:32:28 +01:00

View File

@@ -55,7 +55,21 @@ if ($config['autodiscovery']['xdp'] === true) {
$remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?', array($cdp['cdpCacheDeviceId'], $cdp['cdpCacheDeviceId']));
if (!$remote_device_id) {
$remote_device_id = discover_new_device($cdp['cdpCacheDeviceId'], $device, 'CDP', $interface);
if($config['discovery_by_ip'] !== true) {
$remote_device_id = discover_new_device($cdp['cdpCacheDeviceId'], $device, 'CDP', $interface);
}
else {
$ip_arr = explode(" ", $cdp['cdpCacheAddress']);
$a = hexdec($ip_arr[0]);
$b = hexdec($ip_arr[1]);
$c = hexdec($ip_arr[2]);
$d = hexdec($ip_arr[3]);
$cdp_ip = "$a.$b.$c.$d";
$remote_device_id = discover_new_device($cdp_ip, $device, 'CDP', $interface);
}
}
if ($remote_device_id) {