@Test public void testOptions() throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bos); out.writeShort(10); out.writeShort(16 + 24 + 26 + 12); out.writeInt(1); out.writeInt(1); out.writeInt(11); out.writeShort(3); out.writeShort(24); out.writeShort(258); out.writeShort(3); out.writeShort(1); out.writeShort(141); out.writeShort(4); out.writeShort(41); out.writeShort(2); out.writeShort(42); out.writeShort(2); out.writeByte(0); out.writeByte(0); out.writeShort(3); out.writeShort(26); out.writeShort(259); out.writeShort(3); out.writeShort(2); out.writeShort(141); out.writeShort(4); out.writeShort(456 | 0x8000); out.writeShort(2); out.writeInt(123); out.writeShort(41); out.writeShort(2); out.writeShort(259); out.writeShort(12); out.writeInt(5); out.writeShort(7); out.writeShort(3567); List<TSDRLogRecord> records = parseRecords(bos.toByteArray()); assertEquals(1, records.size()); Map<String, String> attrs = toMap(records.get(0).getRecordAttributes()); assertEquals(Long.valueOf(1 * 1000), records.get(0).getTimeStamp()); assertEquals("10", attrs.remove("version")); assertEquals("1", attrs.remove("Sequence_Number")); assertEquals("11", attrs.remove("Observation_Domain_ID")); assertEquals("3567", attrs.remove("exportedMessageTotalCount")); assertEquals("Options record for lineCardId 5, 123.456 7", records.get(0).getRecordFullText()); assertEmpty(attrs); bos = new ByteArrayOutputStream(); out = new DataOutputStream(bos); out.writeShort(10); out.writeShort(16 + 20); out.writeInt(2); out.writeInt(2); out.writeInt(11); out.writeShort(258); out.writeShort(20); out.writeInt(1); out.writeShort(345); out.writeShort(10201); out.writeInt(2); out.writeShort(690); out.writeShort(20402); records = parseRecords(bos.toByteArray()); assertEquals(2, records.size()); attrs = toMap(records.get(0).getRecordAttributes()); assertEquals(Long.valueOf(2 * 1000), records.get(0).getTimeStamp()); assertEquals("10", attrs.remove("version")); assertEquals("2", attrs.remove("Sequence_Number")); assertEquals("11", attrs.remove("Observation_Domain_ID")); assertEquals("345", attrs.remove("exportedMessageTotalCount")); assertEquals("10201", attrs.remove("exportedFlowRecordTotalCount")); assertEquals("Options record for lineCardId 1", records.get(0).getRecordFullText()); assertEmpty(attrs); attrs = toMap(records.get(1).getRecordAttributes()); assertEquals(Long.valueOf(2 * 1000), records.get(1).getTimeStamp()); assertEquals("10", attrs.remove("version")); assertEquals("2", attrs.remove("Sequence_Number")); assertEquals("11", attrs.remove("Observation_Domain_ID")); assertEquals("690", attrs.remove("exportedMessageTotalCount")); assertEquals("20402", attrs.remove("exportedFlowRecordTotalCount")); assertEquals("Options record for lineCardId 2", records.get(1).getRecordFullText()); 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();  }