This repository was archived by the owner on Mar 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
java/org/graylog/plugins/netflow/codecs Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -308,4 +308,28 @@ public void pcap_pmacctd_NetFlowV9() throws Exception {
308308 }
309309 assertThat (allMessages ).hasSize (6 );
310310 }
311+
312+ @ Test
313+ public void pcap_nprobe_NetFlowV5 () throws Exception {
314+ final List <Message > allMessages = new ArrayList <>();
315+ try (InputStream inputStream = Resources .getResource ("netflow-data/nprobe-netflow5.pcap" ).openStream ()) {
316+ final Pcap pcap = Pcap .openStream (inputStream );
317+ pcap .loop (packet -> {
318+ if (packet .hasProtocol (Protocol .UDP )) {
319+ final UDPPacket udp = (UDPPacket ) packet .getPacket (Protocol .UDP );
320+ final InetSocketAddress source = new InetSocketAddress (udp .getSourceIP (), udp .getSourcePort ());
321+ final Collection <Message > messages = codec .decodeMessages (new RawMessage (udp .getPayload ().getArray (), source ));
322+ assertThat (messages )
323+ .isNotNull ()
324+ .isNotEmpty ();
325+ allMessages .addAll (messages );
326+ }
327+ return true ;
328+ }
329+ );
330+ }
331+ assertThat (allMessages )
332+ .hasSize (120 )
333+ .allSatisfy (message -> assertThat (message .getField ("nf_version" )).isEqualTo (5 ));
334+ }
311335}
File renamed without changes.
You can’t perform that action at this time.
0 commit comments