private Optional<Integer> resolveNodeId(String location, InetAddress trapAddress) { // If there was no location in the trap message, assume that // it was generated in the default location if (location == null) { return cache.getFirstNodeId(MonitoringLocationDao.DEFAULT_MONITORING_LOCATION_ID, trapAddress); } return cache.getFirstNodeId(location, trapAddress); } }
private Optional<Integer> resolveNodeId(String location, InetAddress trapAddress) { // If there was no location in the trap message, assume that // it was generated in the default location if (location == null) { return cache.getFirstNodeId(MonitoringLocationDao.DEFAULT_MONITORING_LOCATION_ID, trapAddress); } return cache.getFirstNodeId(location, trapAddress); } }
private Optional<NodeDocument> getNodeInfo(String location, InetAddress ipAddress) { final Optional<Integer> nodeId = interfaceToNodeCache.getFirstNodeId(location, ipAddress); if (nodeId.isPresent()) { try (Timer.Context ctx = nodeLoadTimer.time()) { final OnmsNode onmsNode = nodeDao.get(nodeId.get()); if (onmsNode != null) { final NodeDocument nodeInfo = new NodeDocument(); nodeInfo.setForeignSource(onmsNode.getForeignSource()); nodeInfo.setForeignId(onmsNode.getForeignId()); nodeInfo.setNodeId(nodeId.get()); nodeInfo.setCategories(onmsNode.getCategories().stream().map(OnmsCategory::getName).collect(Collectors.toList())); return Optional.of(nodeInfo); } else { LOG.warn("Node with id: {} at location: {} with IP address: {} is in the interface to node cache, but wasn't found in the database."); } } } return Optional.empty(); }
private Optional<NodeDocument> getNodeInfo(String location, InetAddress ipAddress) { final Optional<Integer> nodeId = interfaceToNodeCache.getFirstNodeId(location, ipAddress); if (nodeId.isPresent()) { try (Timer.Context ctx = nodeLoadTimer.time()) { final OnmsNode onmsNode = nodeDao.get(nodeId.get()); if (onmsNode != null) { final NodeDocument nodeInfo = new NodeDocument(); nodeInfo.setForeignSource(onmsNode.getForeignSource()); nodeInfo.setForeignId(onmsNode.getForeignId()); nodeInfo.setNodeId(nodeId.get()); nodeInfo.setCategories(onmsNode.getCategories().stream().map(OnmsCategory::getName).collect(Collectors.toList())); return Optional.of(nodeInfo); } else { LOG.warn("Node with id: {} at location: {} with IP address: {} is in the interface to node cache, but wasn't found in the database."); } } } return Optional.empty(); }
LOG.debug(" Telemetry message content : {} ", msg); final InetAddress inetAddress = InetAddress.getByName(msg.getNodeIdStr()); final Optional<Integer> nodeId = interfaceToNodeCache.getFirstNodeId(messageLog.getLocation(), inetAddress); if (nodeId.isPresent()) {
final Optional<Integer> nodeId = interfaceToNodeCache.getFirstNodeId(messageLog.getLocation(), inetAddress); if (nodeId.isPresent()) {
final Optional<Integer> nodeId = interfaceToNodeCache.getFirstNodeId(messageLog.getLocation(), inetAddress);
cache.getFirstNodeId(location, hostAddress) .ifPresent(bldr::setNodeid);