@Test public void testDataRecords() throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bos); out.writeShort(10); out.writeShort(16 + 42 + 20); out.writeInt(289584773); out.writeInt(1); out.writeInt(20); out.writeShort(2); out.writeShort(42); out.writeShort(256); out.writeShort(3); out.writeShort(4); out.writeShort(1); out.writeShort(7); out.writeShort(2); out.writeShort(10); out.writeShort(4); out.writeShort(257); out.writeShort(3); out.writeShort(12); out.writeShort(4); out.writeShort(456 | 0x8000); out.writeShort(8); out.writeInt(123); out.writeShort(82); out.writeShort(5); out.writeByte(0); out.writeByte(0); out.writeShort(256); out.writeShort(20); out.writeByte(6); out.writeShort(23); out.writeInt(2857383); out.writeByte(17); out.writeShort(2551); out.writeInt(5137183); out.writeByte(0); out.writeByte(0); out.close(); List<TSDRLogRecord> records = parseRecords(bos.toByteArray()); assertEquals(2, records.size()); Map<String, String> attrs = toMap(records.get(0).getRecordAttributes()); assertEquals(Long.valueOf(289584773L * 1000), records.get(0).getTimeStamp()); assertEquals(NetflowIPFIXPacketParser.DATA_RECORD_TEXT, records.get(0).getRecordFullText()); assertEquals("10", attrs.remove("version")); assertEquals("1", attrs.remove("Sequence_Number")); assertEquals("20", attrs.remove("Observation_Domain_ID")); assertEquals("TCP", attrs.remove("protocolIdentifier")); assertEquals("23", attrs.remove("sourceTransportPort")); assertEquals("2857383", attrs.remove("ingressInterface")); assertEmpty(attrs); attrs = toMap(records.get(1).getRecordAttributes()); assertEquals(Long.valueOf(289584773L * 1000), records.get(1).getTimeStamp()); assertEquals(NetflowIPFIXPacketParser.DATA_RECORD_TEXT, records.get(1).getRecordFullText()); assertEquals("10", attrs.remove("version")); assertEquals("1", attrs.remove("Sequence_Number")); assertEquals("20", attrs.remove("Observation_Domain_ID")); assertEquals("UDP", attrs.remove("protocolIdentifier")); assertEquals("2551", attrs.remove("sourceTransportPort")); assertEquals("5137183", attrs.remove("ingressInterface")); assertEmpty(attrs); bos = new ByteArrayOutputStream(); out = new DataOutputStream(bos); out.writeShort(10); out.writeShort(16 + 21); out.writeInt(289584800); out.writeInt(2); out.writeInt(20); out.writeShort(257); out.writeShort(21); out.writeInt(0xa0000020); out.writeLong(1234567890L); out.writeBytes("FE1/0"); out.close(); records = parseRecords(bos.toByteArray()); assertEquals(1, records.size()); attrs = toMap(records.get(0).getRecordAttributes()); assertEquals(Long.valueOf(289584800L * 1000), records.get(0).getTimeStamp()); assertEquals(NetflowIPFIXPacketParser.DATA_RECORD_TEXT, records.get(0).getRecordFullText()); assertEquals("10", attrs.remove("version")); assertEquals("2", attrs.remove("Sequence_Number")); assertEquals("20", attrs.remove("Observation_Domain_ID")); assertEquals("160.0.0.32", attrs.remove("destinationIPv4Address")); assertEquals("1234567890", attrs.remove("123.456")); assertEquals("FE1/0", attrs.remove("interfaceName")); assertEmpty(attrs); }
@Override public void parseRecords() { while (position() < totalPacketLength && !endOfData()) { if (!parseNextRecords()) { break; } } missingTemplateCache.checkTemplates(); }
NetflowIPFIXPacketParser extends AbstractNetflowPacketParser { @Override public void parseRecords() { while (position() < totalPacketLength && !endOfData()) { if (!parseNextRecords()) { break; } } missingTemplateCache.checkTemplates(); } }
NetflowIPFIXPacketParser extends AbstractNetflowPacketParser { @Override public void parseRecords() { while (position() < totalPacketLength && !endOfData()) { if (!parseNextRecords()) { break; } } missingTemplateCache.checkTemplates(); } NetflowIPFIXPacketParser(byte[] data, int initialPosition, String sourceIP,
            FlowTemplateCache flowTemplateCache, OptionsTemplateCache optionsTemplateCache,
            MissingTemplateCache missingTemplateCache, InformationElementMappings informationElementMappings,
            TSDRLogRecordBuilder recordBuilder, Consumer<TSDRLogRecordBuilder> callback); private  NetflowIPFIXPacketParser(NetflowIPFIXPacketParser other, int fromPosition, int bytesToCopy); }
NetflowIPFIXPacketParser extends AbstractNetflowPacketParser { @Override public void parseRecords() { while (position() < totalPacketLength && !endOfData()) { if (!parseNextRecords()) { break; } } missingTemplateCache.checkTemplates(); } NetflowIPFIXPacketParser(byte[] data, int initialPosition, String sourceIP,
            FlowTemplateCache flowTemplateCache, OptionsTemplateCache optionsTemplateCache,
            MissingTemplateCache missingTemplateCache, InformationElementMappings informationElementMappings,
            TSDRLogRecordBuilder recordBuilder, Consumer<TSDRLogRecordBuilder> callback); private  NetflowIPFIXPacketParser(NetflowIPFIXPacketParser other, int fromPosition, int bytesToCopy); @Override void parseRecords(); }
NetflowIPFIXPacketParser extends AbstractNetflowPacketParser { @Override public void parseRecords() { while (position() < totalPacketLength && !endOfData()) { if (!parseNextRecords()) { break; } } missingTemplateCache.checkTemplates(); } NetflowIPFIXPacketParser(byte[] data, int initialPosition, String sourceIP,
            FlowTemplateCache flowTemplateCache, OptionsTemplateCache optionsTemplateCache,
            MissingTemplateCache missingTemplateCache, InformationElementMappings informationElementMappings,
            TSDRLogRecordBuilder recordBuilder, Consumer<TSDRLogRecordBuilder> callback); private  NetflowIPFIXPacketParser(NetflowIPFIXPacketParser other, int fromPosition, int bytesToCopy); @Override void parseRecords();  }