Expand description
Cisco sh ip bgp text dump parser.
Parses the fixed-width column format produced by Cisco IOS routers, as
published by PCH (daily routing table snapshots) and route-views
(oix-full-snapshot-*.bz2). Field boundaries are extracted from the table
header so that numeric attributes do not become indistinguishable from
numeric AS-path segments.
§Format
BGP table version is N, local router ID is X.X.X.X, vrf id 0
Default local pref 100, local AS NNNN
...
Network Next Hop Metric LocPrf Weight Path
*> 1.0.0.0/24 103.77.108.118 0 0 13335 i
*= 103.77.108.11 0 0 13335 iRoute-views sh ip bgp snapshots (e.g. oix-full-snapshot-*.bz2) use the
same fixed-width layout but omit the BGP table version / local AS
preamble. When the preamble is absent, peer_ip and peer_asn default to
the unspecified sentinel values 0.0.0.0 and AS0.
§Example
use bgpkit_parser::parser::text_dump::{infer_timestamp_from_path, parse_text_dump_with_timestamp};
let url = "https://downloads.pch.net/files/Routing_Data/IPv4_daily_snapshots/2026/07/route-collector.bom2.pch.net/route-collector.bom2.pch.net-ipv4_bgp_routes.2026.07.01.gz";
let reader = oneio::get_reader(url).unwrap();
let mut reader = std::io::BufReader::new(reader);
let timestamp = infer_timestamp_from_path(url).unwrap_or(0.0);
let elems = parse_text_dump_with_timestamp(&mut reader, timestamp).unwrap();
println!("parsed {} elements", elems.len());Structs§
- Text
Dump Elem Iterator - A streaming iterator that yields
BgpElems from a Ciscosh ip bgptext dump, one route line at a time. - Text
Dump Header - Header metadata extracted from the preamble of a Cisco
sh ip bgpdump.
Functions§
- detect_
text_ dump - Detect whether a reader contains a Cisco
sh ip bgptext dump. - infer_
timestamp_ from_ path - Try to extract a Unix timestamp from a file path or URL.
- parse_
header - Parse the preamble to extract router metadata and fixed-width column offsets.
- parse_
text_ dump - Parse a complete Cisco
sh ip bgptext dump intoBgpElems with timestamp0.0. - parse_
text_ dump_ with_ timestamp - Parse a complete Cisco
sh ip bgptext dump intoBgpElems.