bgpkit / pybgpkit

Python bindings for BGPKIT software
MIT License
15 stars 1 forks source link

Output from zebra-dump-parser and bgpkit are different #5

Open ACodingfreak opened 1 year ago

ACodingfreak commented 1 year ago

Hi All,

I am downloading below MRT file from RIS and trying to parse it via zebra-dump-parser and bgpkit 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 PYBGPKIT it is split into 3 different BGP updates instead of 1. Is there a way we can show it as one BGP update under pybgpkit ?

Output from PYBGPKIT

{'timestamp': 1674224400.0, 'elem_type': 'A', 'peer_ip': '23.129.32.61', 'peer_asn': 49134, 'prefix': '200.169.64.0/24', 'next_hop': '23.129.32.61', 'as_path': '49134 53356 6939 265264 52976 16397 15830 265264 52976', 'origin_asns': [52976], 'origin': 'IGP', 'local_pref': 0, 'med': 0, 'communities': None, 'atomic': 'NAG', 'aggr_asn': None, 'aggr_ip': None}
{'timestamp': 1674224400.0, 'elem_type': 'A', 'peer_ip': '23.129.32.61', 'peer_asn': 49134, 'prefix': '200.169.67.0/24', 'next_hop': '23.129.32.61', 'as_path': '49134 53356 6939 265264 52976 16397 15830 265264 52976', 'origin_asns': [52976], 'origin': 'IGP', 'local_pref': 0, 'med': 0, 'communities': None, 'atomic': 'NAG', 'aggr_asn': None, 'aggr_ip': None}
{'timestamp': 1674224400.0, 'elem_type': 'A', 'peer_ip': '23.129.32.61', 'peer_asn': 49134, 'prefix': '200.169.65.0/24', 'next_hop': '23.129.32.61', 'as_path': '49134 53356 6939 265264 52976 16397 15830 265264 52976', 'origin_asns': [52976], 'origin': 'IGP', 'local_pref': 0, 'med': 0, 'communities': None, 'atomic': 'NAG', 'aggr_asn': None, 'aggr_ip': None}

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
digizeph commented 1 year ago

This is not currently implemented as we are not targeting to match the output from zebra-dump-parser. We will consider supporting record/update-level output in the future releases.

ACodingfreak commented 1 year ago

Hi @digizeph ,

Thanks for the reply.

I am not interested in MRT format as shown byzeba-dump-parser but need to process raw BGPUPDATES sent by the router. Creating 3 entries as shown in example will create a duplicates in my scenario.

Looks like bgpreader has the similar design. But iterating through BGPRecords instead of BGPelems might solve my issue (which I need to still check). Does BGPKit have a similar design ?