Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output from zebra-dump-parser and bgpreader are different #50

Open
ACodingfreak opened this issue Jan 20, 2023 · 2 comments
Open

Output from zebra-dump-parser and bgpreader are different #50

ACodingfreak opened this issue Jan 20, 2023 · 2 comments

Comments

@ACodingfreak
Copy link

ACodingfreak commented Jan 20, 2023

Hi All,

I am downloading below MRT file from RIS and trying to parse it via zebra-dump-parser and pybgpstream
wget https://data.ris.ripe.net/rrc00/2023.01/updates.20230120.1420.gz

As you can see in below output, according to zebra-dump-parser we have one BGP update containing 3 announced prefixes. But in the case of bgpreader it is split into 3 different BGP updates instead of 1. Is this right behavior ?

Output from zebra-dump-parser

TYPE: BGP4MP/BGP4MP_MESSAGE_AS4 AFI_IP
FROM: 23.129.32.61
TO: 193.0.4.28
BGP PACKET TYPE: UPDATE
ORIGIN: IGP
AS_PATH: 49134 53356 6939 265264 52976 16397 15830 265264 52976
NEXT_HOP: 23.129.32.61
ANNOUNCED: 200.169.64.0/24
ANNOUNCED: 200.169.67.0/24
ANNOUNCED: 200.169.65.0/24

Output from bgpreader

U|A|1674224400.000000|singlefile|singlefile|||49134|23.129.32.61|200.169.64.0/24|23.129.32.61|49134 53356 6939 265264 52976 16397 15830 265264 52976|52976|||
U|A|1674224400.000000|singlefile|singlefile|||49134|23.129.32.61|200.169.67.0/24|23.129.32.61|49134 53356 6939 265264 52976 16397 15830 265264 52976|52976|||
U|A|1674224400.000000|singlefile|singlefile|||49134|23.129.32.61|200.169.65.0/24|23.129.32.61|49134 53356 6939 265264 52976 16397 15830 265264 52976|52976|||
@alistairking
Copy link
Member

Yes, this is by design.
BGPStream decomposes a single update ("record" in BGPStream terminology) into one "elem" per prefix -- this is because almost nobody cares about processing the update itself, they care about the prefixes contained in the update.
If you really care about the way the prefixes were packed together by the router, then you can iterate over records and for each record, iterate over its elems (this is what is happening under the hood when you iterate over a stream in pybgpstream).
You can read more about this here: https://bgpstream.caida.org/docs/encoding

@ACodingfreak
Copy link
Author

Thanks @alistairking

Let me try iterating through BGPRecords instead of BGPElems.

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

No branches or pull requests

2 participants