-
Notifications
You must be signed in to change notification settings - Fork 8
refactor: use bgpkit-commons for as2org and rpki modules #86
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
Conversation
Breaking Changes: - Removed 'rpki read-roa' and 'rpki read-aspa' commands (relied on outdated rpki crate) New Features: - New 'rpki roas' command: list ROAs with filters (origin, prefix, date, source) - New 'rpki aspas' command: list ASPAs with filters (customer, provider, date, source) - Support for historical RPKI data from RIPE NCC and RPKIviews - JSON output support for all RPKI commands (--json flag) Improvements: - as2org data loading now uses bgpkit-commons asinfo module - SQLite caching preserved for fast repeated whois queries - ASPA table output groups providers by customer ASN - Column width wrapping for better table readability Dependencies: - Added bgpkit-commons v0.10 (asinfo, rpki, countries features) - Removed rpki crate dependency
|
Addresses issue #85 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR successfully refactors the RPKI and as2org modules to use the bgpkit-commons v0.10 library, consolidating data sources and removing outdated dependencies. The refactoring introduces new commands for querying historical RPKI data while maintaining backward compatibility for existing functionality.
Key Changes
- RPKI module refactored: Removed
rpki read-roaandrpki read-aspacommands that relied on the outdatedrpkicrate, replacing them with newrpki roasandrpki aspascommands that leveragebgpkit-commonsfor both current and historical RPKI data - as2org data loading modernized: Replaced custom CAIDA file parsing with
bgpkit-commonsasinfo module while preserving SQLite caching for performance - JSON output support: Added
--jsonflag support across all RPKI commands for programmatic access to validation results, ROAs, ASPAs, and summaries
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
Cargo.toml |
Updated dependencies: added bgpkit-commons v0.10 with features, removed rpki crate, bumped bgpkit-broker to v0.10.1 |
Cargo.lock |
Dependency resolution updates reflecting the new bgpkit-commons and removal of rpki crate transitive dependencies |
src/datasets/rpki/commons.rs |
New module implementing RPKI data integration using bgpkit-commons with support for current (Cloudflare) and historical (RIPE NCC, RPKIviews) data sources |
src/datasets/rpki/validator.rs |
Added Serialize derives to enable JSON output for validation results and ROA table items |
src/datasets/rpki/mod.rs |
Updated module exports to use new commons module instead of deleted aspa and roa modules |
src/datasets/rpki/aspa.rs |
Deleted file - functionality replaced by bgpkit-commons integration |
src/datasets/rpki/roa.rs |
Deleted file - functionality replaced by bgpkit-commons integration |
src/datasets/as2org.rs |
Refactored to load data from bgpkit-commons instead of parsing CAIDA files, with synthetic org entries for ASes without as2org data |
src/bin/monocle.rs |
Removed old read-roa and read-aspa commands, added new roas and aspas commands with historical data support and JSON output for all RPKI commands |
README.md |
Updated RPKI documentation to reflect new commands, data sources, and JSON output capabilities |
CHANGELOG.md |
Added unreleased section documenting breaking changes, new features, improvements, and dependency updates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #[test] | ||
| fn test_creating_db() { | ||
| let as2org = As2org::new(&Some("./test.sqlite3".to_string())).unwrap(); | ||
| // approximately one minute insert time | ||
| let _res = as2org.parse_insert_as2org(Some("tests/test-as2org.jsonl.gz")); | ||
|
|
||
| as2org.clear_db().unwrap(); | ||
| } |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test test_creating_db no longer properly tests the parse_insert_as2org functionality since the test data file tests/test-as2org.jsonl.gz is no longer used after the refactor to use bgpkit-commons. The old implementation parsed this file, but the new implementation loads data directly from bgpkit-commons, ignoring the _url parameter.
Consider either:
- Removing the now-unused test data file
tests/test-as2org.jsonl.gz - Adding integration tests that verify the bgpkit-commons data loading works correctly
- Updating test documentation to clarify that this test only verifies DB creation/clearing, not data loading
Summary
This PR refactors the
as2organdrpkimodules to usebgpkit-commonsv0.10'sasinfoandrpkimodules, replacing custom implementations and removing outdated dependencies.Breaking Changes
rpki read-roacommand - Previously parsed individual ROA files using therpkicraterpki read-aspacommand - Previously parsed individual ASPA files using therpkicrateNew Features
rpki roascommandList ROAs from RPKI data (current or historical):
rpki aspascommandList ASPAs from RPKI data (current or historical):
JSON output for all RPKI commands
All RPKI commands now support
--jsonflag:rpki check- Returns validation result and covering ROAsrpki list- Returns ROAs as JSON arrayrpki summary- Returns summary as JSON arrayrpki roas- Returns ROAs as JSON arrayrpki aspas- Returns ASPAs with providers as numeric arrayImprovements
bgpkit-commonsasinfo module instead of custom CAIDA file parsingwhois --updatereloads data from bgpkit-commonsDependencies
bgpkit-commonsv0.10 with features:asinfo,rpki,countriesrpkicrate (was v0.16.1)Files Changed
Cargo.toml- Updated dependenciessrc/datasets/as2org.rs- Refactored to use bgpkit-commons for data loadingsrc/datasets/rpki/commons.rs- NEW - bgpkit-commons RPKI integrationsrc/datasets/rpki/mod.rs- Updated exportssrc/datasets/rpki/validator.rs- Added Serialize derives for JSON outputsrc/datasets/rpki/aspa.rs- DELETEDsrc/datasets/rpki/roa.rs- DELETEDsrc/bin/monocle.rs- Updated CLI commandsCHANGELOG.md- Added unreleased sectionREADME.md- Updated RPKI documentation