Skip to content

Conversation

@digizeph
Copy link
Member

@digizeph digizeph commented Aug 4, 2025

Summary

  • Implement RFC 6397 (MRT BGP routing information export format with geo-location extensions)
  • Add GEO_PEER_TABLE subtype (7) support for TABLE_DUMP_V2 format
  • Support both parsing and encoding of geo-location data

Implementation Details

Data Structures

  • GeoPeer: Contains peer information with latitude/longitude coordinates
  • GeoPeerTable: Complete geo-location table with collector coordinates and peer list
  • Uses WGS84 coordinate system with IEEE 754 32-bit floats
  • Supports NaN values for privacy-protected coordinates

Features

  • Full parsing support for GEO_PEER_TABLE messages
  • Complete encoding support for round-trip compatibility
  • IPv4 and IPv6 peer address support
  • 16-bit and 32-bit AS number support
  • Manual Eq implementations to handle float fields

Testing

  • Unit tests for data structures
  • Parser tests with various peer configurations
  • Round-trip encoding/decoding verification
  • Edge case handling (NaN coordinates, empty tables)

Test Plan

  • Run cargo test - all tests pass
  • Run cargo clippy --all-features -- -D warnings - no warnings
  • Run cargo fmt - code formatted
  • Verify RFC 6397 compliance
  • Test with real-world MRT files containing geo-location data (if available)

- Add GEO_PEER_TABLE subtype parsing and encoding
- Implement GeoPeer and GeoPeerTable data structures
- Support WGS84 coordinates with NaN for privacy protection
- Add tests for parsing and round-trip encoding
- Update documentation to mark RFC 6397 as supported
@codecov
Copy link

codecov bot commented Aug 4, 2025

Codecov Report

❌ Patch coverage is 99.41520% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@4400a57). Learn more about missing BASE report.
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/models/mrt/table_dump_v2.rs 98.78% 1 Missing ⚠️
src/parser/mrt/messages/table_dump_v2/mod.rs 95.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #232   +/-   ##
=======================================
  Coverage        ?   89.79%           
=======================================
  Files           ?       75           
  Lines           ?    10099           
  Branches        ?        0           
=======================================
  Hits            ?     9068           
  Misses          ?     1031           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Move encode() implementation from models to parser module
- Consistent with PeerIndexTable and RibAfiEntries pattern
- Remove feature gate as bytes is always available in parser
- Move encoding test to parser module
- Fixes build with --no-default-features
- Add MrtMessage::encode() test for GeoPeerTable encoding path
- Add GeoPeerTable parsing test for TABLE_DUMP_V2 dispatcher
- Fix unsupported type test to use correct RibGeneric subtypes
- Add Peer::new() variation tests for all IPv4/IPv6 and 16/32-bit AS combinations
- Update changelog to reflect simplified GeoPeer structure and test count
- Improves test coverage for previously untested code paths
@digizeph digizeph merged commit 787f4bf into main Aug 5, 2025
5 checks passed
@digizeph digizeph deleted the mrt-geo branch August 5, 2025 00:06
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.

2 participants