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

MRT message encoder for BGP updates #118

Merged
merged 28 commits into from
Oct 29, 2023
Merged

MRT message encoder for BGP updates #118

merged 28 commits into from
Oct 29, 2023

Conversation

digizeph
Copy link
Member

@digizeph digizeph commented Aug 12, 2023

Overview

This pull request adds MRT encoding for TableDumpMessage and Bgp4Mp types of messages.

We test it by parsing messages from remote site, encode to MRT bytes, and then parse the encoded bytes again for comparison. See the following test snippet for details:

    #[test]
    fn test_encode_large() {
        let url = "http://archive.routeviews.org/route-views.amsix/bgpdata/2023.05/UPDATES/updates.20230505.0330.bz2";
        let parser = BgpkitParser::new(url).unwrap();
        for record in parser.into_record_iter() {
            let bytes = record.encode();
            let parsed_record = parse_mrt_record(&mut Cursor::new(bytes)).unwrap();
            assert_eq!(record, parsed_record);
        }
    }
  • encoding for TableDumpMessage
  • encoding for Bgp4Mp
  • BMP to MRT
  • integration tests
  • code examples and documentation

The implementation for TableDumpMessageV2 will require more work and will be implemented in the near future.

Example usages

MRT encoding can be very useful when users want to archive BGP messages into MRT instead of reading from MRT files. This enables applications to implement features like:

  • BGP message archival
  • BMP stream to MRT files
  • Store filtered BGP messages into MRT files for storage (e.g. use in bgpkit-monocle)
  • Split/copy/distribute input MRT file into output MRT files

# Conflicts:
#	bgpkit-parser/src/parser/bgp/attributes/attr_07_18_aggregator.rs
#	bgpkit-parser/src/parser/bgp/attributes/mod.rs
#	bgpkit-parser/src/parser/filter.rs
# Conflicts:
#	bgpkit-parser/src/lib.rs
#	bgpkit-parser/src/parser/bgp/attributes/mod.rs
#	bgpkit-parser/src/parser/bgp/messages.rs
#	bgpkit-parser/src/parser/mod.rs
# Conflicts:
#	Cargo.toml
#	src/models/mrt/mod.rs
#	src/models/network/asn.rs
#	src/parser/bgp/attributes/attr_02_17_as_path.rs
#	src/parser/bgp/attributes/attr_09_originator.rs
#	src/parser/bgp/attributes/attr_16_25_extended_communities.rs
#	src/parser/bgp/attributes/mod.rs
#	src/parser/bgp/messages.rs
#	src/parser/mod.rs
#	src/parser/mrt/messages/bgp4mp.rs
#	src/parser/mrt/messages/table_dump_message.rs
#	src/parser/mrt/mrt_record.rs
@digizeph digizeph marked this pull request as ready for review October 27, 2023 22:58
@digizeph digizeph merged commit cdc00ef into main Oct 29, 2023
1 check passed
@digizeph digizeph deleted the encoder branch October 29, 2023 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant