@Test public void testOptions() throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bos); out.writeShort(9); out.writeShort(3); out.writeInt(372829489); out.writeInt(582747597); out.writeInt(34); out.writeInt(12); out.writeShort(1); out.writeShort(24); out.writeShort(258); out.writeShort(4); out.writeShort(8); out.writeShort(3); out.writeShort(2); out.writeShort(41); out.writeShort(2); out.writeShort(42); out.writeShort(2); out.writeByte(0); out.writeByte(0); out.writeShort(1); out.writeShort(26); out.writeShort(259); out.writeShort(8); out.writeShort(8); out.writeShort(1); out.writeShort(4); out.writeShort(2); out.writeShort(2); out.writeShort(41); out.writeShort(4); out.writeShort(42); out.writeShort(2); out.writeShort(259); out.writeShort(16); out.writeInt(5); out.writeShort(7); out.writeInt(123); 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(582747597L * 1000), records.get(0).getTimeStamp()); assertEquals("9", attrs.remove("version")); assertEquals("372829489", attrs.remove("sys_uptime")); assertEquals("34", attrs.remove("package_sequence")); assertEquals("12", attrs.remove("source_id")); assertEquals("123", attrs.remove("TOTAL_PKTS_EXP")); assertEquals("3567", attrs.remove("TOTAL_FLOWS_EXP")); assertEquals("Options record for System 5, Interface 7", records.get(0).getRecordFullText()); assertEmpty(attrs); bos = new ByteArrayOutputStream(); out = new DataOutputStream(bos); out.writeShort(9); out.writeShort(1); out.writeInt(372829490); out.writeInt(582747598); out.writeInt(35); out.writeInt(12); out.writeShort(258); out.writeShort(16); out.writeShort(1); out.writeShort(345); out.writeShort(10201); out.writeShort(2); out.writeShort(690); out.writeShort(20402); records = parseRecords(bos.toByteArray()); assertEquals(2, records.size()); attrs = toMap(records.get(0).getRecordAttributes()); assertEquals(Long.valueOf(582747598L * 1000), records.get(0).getTimeStamp()); assertEquals("9", attrs.remove("version")); assertEquals("372829490", attrs.remove("sys_uptime")); assertEquals("35", attrs.remove("package_sequence")); assertEquals("12", attrs.remove("source_id")); assertEquals("345", attrs.remove("TOTAL_PKTS_EXP")); assertEquals("10201", attrs.remove("TOTAL_FLOWS_EXP")); assertEquals("Options record for Line Card 1", records.get(0).getRecordFullText()); assertEmpty(attrs); attrs = toMap(records.get(1).getRecordAttributes()); assertEquals("9", attrs.remove("version")); assertEquals("372829490", attrs.remove("sys_uptime")); assertEquals("35", attrs.remove("package_sequence")); assertEquals("12", attrs.remove("source_id")); assertEquals("690", attrs.remove("TOTAL_PKTS_EXP")); assertEquals("20402", attrs.remove("TOTAL_FLOWS_EXP")); assertEquals("Options record for Line Card 2", records.get(1).getRecordFullText()); assertEmpty(attrs); }
@Override public void parseRecords() { while (recordCounter < totalRecordCount && !endOfData()) { final OptionalInt possibleCount = parseNextRecords(); if (!possibleCount.isPresent()) { return; } recordCounter += possibleCount.getAsInt(); } missingTemplateCache.checkTemplates(); }
NetflowV9PacketParser extends AbstractNetflowPacketParser { @Override public void parseRecords() { while (recordCounter < totalRecordCount && !endOfData()) { final OptionalInt possibleCount = parseNextRecords(); if (!possibleCount.isPresent()) { return; } recordCounter += possibleCount.getAsInt(); } missingTemplateCache.checkTemplates(); } }
NetflowV9PacketParser extends AbstractNetflowPacketParser { @Override public void parseRecords() { while (recordCounter < totalRecordCount && !endOfData()) { final OptionalInt possibleCount = parseNextRecords(); if (!possibleCount.isPresent()) { return; } recordCounter += possibleCount.getAsInt(); } missingTemplateCache.checkTemplates(); } NetflowV9PacketParser(byte[] data, int initialPosition, String sourceIP, FlowsetTemplateCache flowsetTemplateCache,
            OptionsTemplateCache optionsTemplateCache, MissingTemplateCache missingTemplateCache,
            TSDRLogRecordBuilder recordBuilder, Consumer<TSDRLogRecordBuilder> callback); private  NetflowV9PacketParser(NetflowV9PacketParser other, int fromPosition, int bytesToCopy); }
NetflowV9PacketParser extends AbstractNetflowPacketParser { @Override public void parseRecords() { while (recordCounter < totalRecordCount && !endOfData()) { final OptionalInt possibleCount = parseNextRecords(); if (!possibleCount.isPresent()) { return; } recordCounter += possibleCount.getAsInt(); } missingTemplateCache.checkTemplates(); } NetflowV9PacketParser(byte[] data, int initialPosition, String sourceIP, FlowsetTemplateCache flowsetTemplateCache,
            OptionsTemplateCache optionsTemplateCache, MissingTemplateCache missingTemplateCache,
            TSDRLogRecordBuilder recordBuilder, Consumer<TSDRLogRecordBuilder> callback); private  NetflowV9PacketParser(NetflowV9PacketParser other, int fromPosition, int bytesToCopy); @Override void parseRecords(); }
NetflowV9PacketParser extends AbstractNetflowPacketParser { @Override public void parseRecords() { while (recordCounter < totalRecordCount && !endOfData()) { final OptionalInt possibleCount = parseNextRecords(); if (!possibleCount.isPresent()) { return; } recordCounter += possibleCount.getAsInt(); } missingTemplateCache.checkTemplates(); } NetflowV9PacketParser(byte[] data, int initialPosition, String sourceIP, FlowsetTemplateCache flowsetTemplateCache,
            OptionsTemplateCache optionsTemplateCache, MissingTemplateCache missingTemplateCache,
            TSDRLogRecordBuilder recordBuilder, Consumer<TSDRLogRecordBuilder> callback); private  NetflowV9PacketParser(NetflowV9PacketParser other, int fromPosition, int bytesToCopy); @Override void parseRecords();  }