Validate NetFlow v5, Dual-Stack IPFIX, sFlow & Nanosecond PTPv2
Testing flow ingestion pipelines (ElastiFlow, Akvorado, pmacct, GoFlow2) and precision timing monitors is notoriously painful: IPFIX collectors drop Data Sets until a periodic Template Set arrives, and classic .pcap files round sub-microsecond IEEE 1588v2 PTP hardware timestamps to microseconds.
The Catch
Capturing live IPFIX (UDP 4739) from a production spine switch often gives you orphan Data Sets that Wireshark (cflow) and CI tests cannot decode because Template Set 2 was sent 10 minutes earlier. FrameAssembly packs both Template Set 2 and Data Set 256 inside every ipfix packet—switching automatically between IPv4 and 128-bit IPv6 Information Elements.
For broadcast media (SMPTE ST 2110), 5G fronthaul, and trading fabrics, FrameAssembly also pairs Event (UDP 319) and General (UDP 320) IEEE 1588v2 ptp frames with ns/us post-packet wait intervals—preserving exact 1ns (IfTsResol = 9) resolution when exported as .pcapng.
Spine Telemetry Ingest (NetFlow v5 + IPv4/IPv6 IPFIX + sFlow v5) & Two-Step PTPv2 Sync
Ten packets exercise your entire observability and timing stack: (1) Cisco netflow v5 (UDP 2055) reporting a 12 MB HTTPS transfer; (2) self-templated ipfix (UDP 4739) exporting both a VRF-10 IPv4 flow and a VRF-20 IPv6 gRPC flow; (3) XDR-aligned sflow v5 packet samples (UDP 6343) across two seq numbers; and (4) a complete 5-packet two-step IEEE 1588v2 ptp exchange (announce -> sync -> followup -> delayreq -> delayresp) spaced at 120us–500ns intervals.
Adapt It for Your Network
- Point spine_exporter and telemetry_col at your flow collector IPs, and adjust
dstportif your NetFlow listener uses UDP 9995. - Set
domain 127(SMPTE ST 2059-2),24/44(ITU-T G.8275 telecom), or0(default IEEE 1588) on theptplines. - Export as
.pcapng(frameassembly telemetry_ptp_suite.frasm telemetry_ptp_suite.pcapng) to preservewait 500ns/120usnanosecond timestamps.
.frasm -> .pcapng
Preview frames inline or open in Playground ->Emits 10 frames: NetFlow v5, dual-stack self-templated IPFIX, sFlow v5, and a 5-packet sub-microsecond two-step PTPv2 loop (.pcapng ready).
host spine_exporter { ip 172.20.0.1 mac 00:1c:73:d0:00:01 }
host telemetry_col { ip 172.20.50.10 mac 00:50:56:d0:50:10 }
flow flow_collectors_ingest(exp, col) {
// 1. Cisco NetFlow v5 (UDP 2055) + Dual-Stack Self-Templated IPFIX (UDP 4739)
exp -> col netflow srcip 10.20.5.14 dstip 203.0.113.80 srcport 54120 dstport 443 proto 6 packets 8500 octets 12240000 wait 2ms
exp -> col ipfix domainid 10 srcip 10.100.4.15 dstip 198.51.100.44 srcport 50112 dstport 443 proto 6 packets 420 octets 512000 wait 2ms
exp -> col ipfix domainid 20 srcip 2001:db8:20::15 dstip 2001:db8:99::5051 srcport 54200 dstport 50051 proto 6 packets 95 octets 84000 wait 2ms
// 2. Switch sFlow v5 XDR packet sampling on UDP 6343
exp -> col sflow agentip 172.20.0.1 subagentid 1 seq 101 uptime 450000 samples 1 wait 1ms
exp -> col sflow agentip 172.20.0.1 subagentid 1 seq 102 uptime 451000 samples 1 wait 2ms
}
flow ptpv2_twostep_nanosecond_sync(gm, slave) {
// 3. IEEE 1588v2 Two-Step PTP (UDP 320 General + UDP 319 Event) with us/ns precision
gm -> slave dscp 46 ptp announce domain 127 seqid 500 clockid "ec4670fffe010203" wait 250us
gm -> slave dscp 46 ptp sync domain 127 seqid 501 clockid "ec4670fffe010203" wait 500ns
gm -> slave dscp 46 ptp followup domain 127 seqid 501 clockid "ec4670fffe010203" wait 180us
slave -> gm dscp 46 ptp delayreq domain 127 seqid 88 clockid "005056fffed05010" wait 120us
gm -> slave dscp 46 ptp delayresp domain 127 seqid 88 clockid "ec4670fffe010203" wait 1ms
}
compile {
flow_collectors_ingest(spine_exporter, telemetry_col)
ptpv2_twostep_nanosecond_sync(spine_exporter, telemetry_col)
}# 1. Compile to nanosecond-precision .pcapng (preserves wait 500ns / 120us timestamps!)
frameassembly telemetry_ptp_suite.frasm telemetry_ptp_suite.pcapng
# 2. Verify NetFlow/IPFIX (cflow), sFlow v5, and PTPv2 fields in tshark
tshark -r telemetry_ptp_suite.pcapng -Y "cflow || sflow || ptp"
# 3. Replay toward ElastiFlow, Akvorado, GoFlow2, pmacct, or PTP boundary-clock monitors
sudo tcpreplay -i eth0 telemetry_ptp_suite.pcapngKeep telemetry_ptp_suite.frasm in Git and build .pcap in under 1ms
Single rootless binary + VS Code extension with live squiggles, quick-fixes, and side-by-side packet ladders ready for Wireshark.
Related Examples
All 81 Protocols ->Test Encrypted SNMPv3 Traps Before an Actual Outage
vlan · snmp3
Poke OT / SCADA Firewalls Without Opening a Substation Breaker
tcp · modbus · dnp3 · bacnet
Diagnose One-Way VoIP Audio, SIP ALGs & WAN DSCP Stripping
vlan · stun · sip · rtp