@Override public NodeDiscoveryResult discover(ConnectionDetails connectionDetails) { String ipAddressString = connectionDetails.getParams().get("ipAddress"); String dnsCanonicalDomainName = doReverseDnsLookup(ipAddressString); String dnsShortName = StringUtils.substringBefore(dnsCanonicalDomainName, "."); NodeDiscoveryResult result = new NodeDiscoveryResult(); if (dnsCanonicalDomainName != null && !dnsCanonicalDomainName.isEmpty() && !dnsCanonicalDomainName.equals(ipAddressString)) { result.setDiscoveredData("FQDN", dnsCanonicalDomainName); result.setDiscoveredData("PQDN", dnsShortName); result.setNodeId(dnsShortName); return result; } else { return null; } }
@Override public NodeDiscoveryResult call() { logger.debug("Discovery worker: " + Thread.currentThread().getName() + " started. connectionDetails = " + connectionDetails); String connectionType = connectionDetails.getConnectionType(); NodeDiscoverer nodeDiscoverer = discoverers.get(connectionType); NodeDiscoveryResult nodeDiscoveryResult = null; try { if (nodeDiscoverer == null) { logger.debug("No node discoverer can be found for connectionType: " + connectionDetails); logger.debug("Trying with the discoverer with connectionType any"); nodeDiscoverer = discoverers.get("any"); nodeDiscoveryResult = nodeDiscoverer.discover((ConnectionDetails) connectionDetails.clone()); } else { nodeDiscoveryResult = nodeDiscoverer.discover((ConnectionDetails) connectionDetails.clone()); } }catch (Exception e){ logger.error(e.getMessage(),e); } if (nodeDiscoveryResult == null) { nodeDiscoveryResult = new NodeDiscoveryResult(null, null,null); } nodeDiscoveryResult.setParentId(parentId); nodeDiscoveryResult.setDiscoveryConnectionDetails(connectionDetails); return nodeDiscoveryResult; }
@Override public NodeDiscoveryResult discover(ConnectionDetails connectionDetails) { Set<String> nodeAliases = new HashSet<>(); NodeDiscoveryResult nodeDiscoveryResult = new NodeDiscoveryResult(); Set<ConnectionDetails> neighbourConnectionDetails = new HashSet<>(); Set<ConnectionDetails> ownConnectionDetails = new HashSet<>();
NodeDiscoveryResult result = new NodeDiscoveryResult();
String deviceName = connectionDetails.getParam("deviceName"); NodeDiscoveryResult result = new NodeDiscoveryResult(); result = new NodeDiscoveryResult(deviceName, null,null); }else if (dnsCanonicalName!=null){ result = new NodeDiscoveryResult(dnsShortName, null,null); }else { result = new NodeDiscoveryResult(ipAddressStr, null,null); result = new NodeDiscoveryResult(deviceName, neighboursConnDetails,null); result.setDiscoveredData("deviceData", discoveredDeviceData); result.setDiscoveredData("rawData", rawData.getData());
@Override public NodeDiscoveryResult discover(ConnectionDetails connectionDetails) { String protocolType = connectionDetails.getParam("protocolType"); String subnetIpAddress = connectionDetails.getParam("ipAddress"); String subnetPrefixMask = connectionDetails.getParam("subnetPrefixMask"); String subnetPrefix=subnetIpAddress+"/"+subnetPrefixMask; NodeDiscoveryResult nodeDiscoveryResult = new NodeDiscoveryResult(subnetPrefix,null,null); nodeDiscoveryResult.setDiscoveredData("subnetDetails", connectionDetails.getParams()); int discoverySubnetPrefixSize = Integer.parseInt(subnetPrefixMask); if (generateIPconnectionsForSubnetMembers && discoverySubnetPrefixSize<=subnetMaxMaskSize); nodeDiscoveryResult.setNeighboursConnectionDetails(getSubnetIpNeighborConnections(subnetPrefix)); try { InetAddress inetAddress = InetAddress.getByName(subnetIpAddress); if (inetAddress instanceof Inet4Address) { IPv4BogonIdentitifier iPv4BogonIdentitifier = new IPv4BogonIdentitifier(subnetIpAddress); if (iPv4BogonIdentitifier.identifyBogon()) { nodeDiscoveryResult.setDiscoveredData("bogon", "YES"); } } if (privateSubnetIdentifier(subnetIpAddress)) { nodeDiscoveryResult.setDiscoveredData("private", "YES"); } } catch (UnknownHostException e) { logger.error(e); } return nodeDiscoveryResult; }
NodeDiscoveryResult result = new NodeDiscoveryResult();