Skip to content

feat(parse): support route-views sh ip bgp snapshots#146

Merged
digizeph merged 1 commit into
mainfrom
feat/routeviews-text-dump
Jul 22, 2026
Merged

feat(parse): support route-views sh ip bgp snapshots#146
digizeph merged 1 commit into
mainfrom
feat/routeviews-text-dump

Conversation

@digizeph

Copy link
Copy Markdown
Member

Summary

Adds support for route-views sh ip bgp snapshots (e.g. oix-full-snapshot-2026-07-01-0000.bz2) to monocle parse. Closes #145.

Route-views dumps use the same fixed-width column layout as PCH Cisco dumps but omit the BGP table version / local AS preamble and use a different filename timestamp format.

Changes

  • Detection: detect_text_dump also matches dumps opening with Status codes: (route-views dumps have no BGP table line, and Next Hop sits beyond the 128-byte sniff window).
  • Missing preamble tolerated: when router ID / local AS are absent, peer_ip / peer_asn default to the unspecified sentinels 0.0.0.0 and AS0 instead of erroring out. The fixed-width column parsing itself is unchanged — it already derives positions from the column header, so the 3-space-indent route-views layout parses as-is.
  • Timestamp inference: infer_timestamp_from_path now recognizes YYYY-MM-DD-HHMM (route-views snapshot filenames) and uses the embedded time of day. PCH-style YYYY.MM.DD (noon UTC) behavior is unchanged.

Testing

  • New unit tests: route-views detection, full route-views-style dump parse (sentinel peer values, MED/path/origin extraction), route-views + PCH timestamp inference, no-date fallback.
  • Real-data check on oix-full-snapshot-2026-07-01-0000 (first 200k lines): 78,976/78,976 route lines parsed, timestamp inferred as 1782864000 (2026-07-01 00:00 UTC) from the filename.
  • MRT export round-trip works; MrtRibEncoder collapses multiple paths per (peer, prefix) into one RIB entry, so a multi-peer-flattened oix dump exports as 5,336 unique prefixes — expected for a single-peer TABLE_DUMP_V2 encoding.
  • cargo fmt --check, cargo clippy --all-features -- -D warnings, and cargo test --all-features (318 tests) all pass.

@digizeph
digizeph merged commit 4b5163b into main Jul 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support route-views sh ip bgp dump

1 participant