@Test public void testHandleLldpDataSameTimeOnCreate() { LldpInfoData data = createLldpInfoDataData(); packetService.handleLldpData(data); Collection<SwitchConnectedDevice> devices = switchConnectedDeviceRepository.findAll(); assertEquals(1, devices.size()); assertEquals(devices.iterator().next().getTimeFirstSeen(), devices.iterator().next().getTimeLastSeen()); }
public void handleLldpData(LldpInfoData data) { transactionManager.doInTransaction(() -> { FlowRelatedData flowRelatedData = findFlowRelatedData(data); if (flowRelatedData == null) { return; } SwitchConnectedDevice device = getOrCreateLldpDevice(data, flowRelatedData.originalVlan); if (device == null) { return; } device.setTtl(data.getTtl()); device.setPortDescription(data.getPortDescription()); device.setSystemName(data.getSystemName()); device.setSystemDescription(data.getSystemDescription()); device.setSystemCapabilities(data.getSystemCapabilities()); device.setManagementAddress(data.getManagementAddress()); device.setTimeLastSeen(Instant.ofEpochMilli(data.getTimestamp())); device.setFlowId(flowRelatedData.flowId); device.setSource(flowRelatedData.source); }); }
PacketService { public void handleLldpData(LldpInfoData data) { transactionManager.doInTransaction(() -> { FlowRelatedData flowRelatedData = findFlowRelatedData(data); if (flowRelatedData == null) { return; } SwitchConnectedDevice device = getOrCreateLldpDevice(data, flowRelatedData.originalVlan); if (device == null) { return; } device.setTtl(data.getTtl()); device.setPortDescription(data.getPortDescription()); device.setSystemName(data.getSystemName()); device.setSystemDescription(data.getSystemDescription()); device.setSystemCapabilities(data.getSystemCapabilities()); device.setManagementAddress(data.getManagementAddress()); device.setTimeLastSeen(Instant.ofEpochMilli(data.getTimestamp())); device.setFlowId(flowRelatedData.flowId); device.setSource(flowRelatedData.source); }); } }
PacketService { public void handleLldpData(LldpInfoData data) { transactionManager.doInTransaction(() -> { FlowRelatedData flowRelatedData = findFlowRelatedData(data); if (flowRelatedData == null) { return; } SwitchConnectedDevice device = getOrCreateLldpDevice(data, flowRelatedData.originalVlan); if (device == null) { return; } device.setTtl(data.getTtl()); device.setPortDescription(data.getPortDescription()); device.setSystemName(data.getSystemName()); device.setSystemDescription(data.getSystemDescription()); device.setSystemCapabilities(data.getSystemCapabilities()); device.setManagementAddress(data.getManagementAddress()); device.setTimeLastSeen(Instant.ofEpochMilli(data.getTimestamp())); device.setFlowId(flowRelatedData.flowId); device.setSource(flowRelatedData.source); }); } PacketService(PersistenceManager persistenceManager); }
PacketService { public void handleLldpData(LldpInfoData data) { transactionManager.doInTransaction(() -> { FlowRelatedData flowRelatedData = findFlowRelatedData(data); if (flowRelatedData == null) { return; } SwitchConnectedDevice device = getOrCreateLldpDevice(data, flowRelatedData.originalVlan); if (device == null) { return; } device.setTtl(data.getTtl()); device.setPortDescription(data.getPortDescription()); device.setSystemName(data.getSystemName()); device.setSystemDescription(data.getSystemDescription()); device.setSystemCapabilities(data.getSystemCapabilities()); device.setManagementAddress(data.getManagementAddress()); device.setTimeLastSeen(Instant.ofEpochMilli(data.getTimestamp())); device.setFlowId(flowRelatedData.flowId); device.setSource(flowRelatedData.source); }); } PacketService(PersistenceManager persistenceManager); void handleLldpData(LldpInfoData data); void handleArpData(ArpInfoData data); }
PacketService { public void handleLldpData(LldpInfoData data) { transactionManager.doInTransaction(() -> { FlowRelatedData flowRelatedData = findFlowRelatedData(data); if (flowRelatedData == null) { return; } SwitchConnectedDevice device = getOrCreateLldpDevice(data, flowRelatedData.originalVlan); if (device == null) { return; } device.setTtl(data.getTtl()); device.setPortDescription(data.getPortDescription()); device.setSystemName(data.getSystemName()); device.setSystemDescription(data.getSystemDescription()); device.setSystemCapabilities(data.getSystemCapabilities()); device.setManagementAddress(data.getManagementAddress()); device.setTimeLastSeen(Instant.ofEpochMilli(data.getTimestamp())); device.setFlowId(flowRelatedData.flowId); device.setSource(flowRelatedData.source); }); } PacketService(PersistenceManager persistenceManager); void handleLldpData(LldpInfoData data); void handleArpData(ArpInfoData data); static final int FULL_PORT_VLAN; }