mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	Added code to rediscovery links and include device ids
This commit is contained in:
		| @@ -38,7 +38,7 @@ if ($device['os'] == "ironware") | ||||
|           $remote_port_id = dbFetchCell("SELECT port_id FROM `ports` WHERE (`ifDescr` = ? OR `ifName` = ?) AND `device_id` = ?",array($if,$if,$remote_device_id)); | ||||
|         } else { $remote_port_id = "0"; } | ||||
|  | ||||
|         discover_link($interface['port_id'], $fdp['snFdpCacheVendorId'], $remote_port_id, $fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDevicePort'], $fdp['snFdpCachePlatform'], $fdp['snFdpCacheVersion']); | ||||
|           discover_link($interface['port_id'], $fdp['snFdpCacheVendorId'], $remote_port_id, $fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDevicePort'], $fdp['snFdpCachePlatform'], $fdp['snFdpCacheVersion'],$device['device_id'], $remote_device_id); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| @@ -79,7 +79,7 @@ if ($cdp_array) | ||||
|  | ||||
|         if ($interface['port_id'] && $cdp['cdpCacheDeviceId'] && $cdp['cdpCacheDevicePort']) | ||||
|         { | ||||
|           discover_link($interface['port_id'], 'cdp', $remote_port_id, $cdp['cdpCacheDeviceId'], $cdp['cdpCacheDevicePort'], $cdp['cdpCachePlatform'], $cdp['cdpCacheVersion']); | ||||
|           discover_link($interface['port_id'], 'cdp', $remote_port_id, $cdp['cdpCacheDeviceId'], $cdp['cdpCacheDevicePort'], $cdp['cdpCachePlatform'], $cdp['cdpCacheVersion'], $device['device_id'], $remote_device_id); | ||||
|         } | ||||
|       } | ||||
|       else | ||||
| @@ -137,7 +137,7 @@ if ($lldp_array) | ||||
|  | ||||
|         if (is_numeric($interface['port_id']) && isset($lldp['lldpRemSysName']) && isset($lldp['lldpRemPortId'])) | ||||
|         { | ||||
|           discover_link($interface['port_id'], 'lldp', $remote_port_id, $lldp['lldpRemSysName'], $lldp['lldpRemPortId'], NULL, $lldp['lldpRemSysDesc']); | ||||
|           discover_link($interface['port_id'], 'lldp', $remote_port_id, $lldp['lldpRemSysName'], $lldp['lldpRemPortId'], NULL, $lldp['lldpRemSysDesc'], $device['device_id'], $remote_device_id); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   | ||||
| @@ -392,7 +392,7 @@ function discover_juniAtmVp(&$valid, $port_id, $vp_id, $vp_descr) | ||||
|   $valid[$port_id][$vp_id] = 1; | ||||
| } | ||||
|  | ||||
| function discover_link($local_port_id, $protocol, $remote_port_id, $remote_hostname, $remote_port, $remote_platform, $remote_version) | ||||
| function discover_link($local_port_id, $protocol, $remote_port_id, $remote_hostname, $remote_port, $remote_platform, $remote_version, $local_device_id, $remote_device_id) | ||||
| { | ||||
|   global $config, $debug, $link_exists; | ||||
|    | ||||
| @@ -406,8 +406,10 @@ function discover_link($local_port_id, $protocol, $remote_port_id, $remote_hostn | ||||
|   { | ||||
|     $insert_data = array( | ||||
|       'local_port_id'   => $local_port_id, | ||||
|       'local_device_id' => $local_device_id, | ||||
|       'protocol'        => $protocol, | ||||
|       'remote_hostname' => $remote_hostname, | ||||
|       'remote_device_id'=> $remote_device_id, | ||||
|       'remote_port'     => $remote_port, | ||||
|       'remote_platform' => $remote_platform, | ||||
|       'remote_version' => $remote_version | ||||
| @@ -424,7 +426,7 @@ function discover_link($local_port_id, $protocol, $remote_port_id, $remote_hostn | ||||
|   else | ||||
|   { | ||||
|     $data = dbFetchRow("SELECT * FROM `links` WHERE `remote_hostname` = ? AND `local_port_id` = ? AND `protocol` = ? AND `remote_port` = ?", array($remote_hostname, $local_port_id, $protocol, $remote_port)); | ||||
|     if ($data['remote_port_id'] == $remote_port_id && $data['remote_platform'] == $remote_platform && $remote_version == $remote_version) | ||||
|     if ($data['remote_port_id'] == $remote_port_id && $data['remote_platform'] == $remote_platform && $remote_version == $remote_version && $data['local_device_id'] > 0 && $data['remote_device_id'] > 0) | ||||
|     { | ||||
|       echo("."); | ||||
|     } | ||||
| @@ -432,7 +434,10 @@ function discover_link($local_port_id, $protocol, $remote_port_id, $remote_hostn | ||||
|     { | ||||
|       $update_data = array( | ||||
|         'remote_platform' => $remote_platform, | ||||
|         'remote_version' => $remote_version | ||||
|         'remote_version' => $remote_version, | ||||
|         'remote_version' => $remote_version, | ||||
|         'local_device_id' => $local_device_id, | ||||
|         'remote_device_id' => $remote_device_id | ||||
|       ); | ||||
|        | ||||
|       if (!empty($remote_port_id)) { | ||||
|   | ||||
							
								
								
									
										2
									
								
								sql-schema/044.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								sql-schema/044.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| ALTER TABLE  `links` ADD  `local_device_id` INT NOT NULL AFTER  `local_port_id` , ADD  `remote_device_id` INT NOT NULL AFTER  `remote_hostname` ; | ||||
| ALTER TABLE  `links` ADD INDEX (  `local_device_id` ,  `remote_device_id` ) ; | ||||
		Reference in New Issue
	
	Block a user