20260701 add validation-update-03 VRS mode
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use super::*;
|
||||
use crate::data_model::rc::ResourceCertificate;
|
||||
use crate::data_model::rc::{AsIdOrRange, AsIdentifierChoice, AsResourceSet, ResourceCertificate};
|
||||
use crate::data_model::roa::RoaAfi;
|
||||
use crate::fetch::rsync::LocalDirRsyncFetcher;
|
||||
use crate::fetch::rsync::{RsyncFetchError, RsyncFetcher};
|
||||
@@ -29,6 +29,48 @@ fn ipv4_addr(octets: [u8; 4]) -> [u8; 16] {
|
||||
addr
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn publication_point_cache_policy_fingerprint_includes_resource_validation_mode() {
|
||||
let mut strict_policy = Policy::default();
|
||||
strict_policy.resource_validation_mode = ResourceValidationMode::Rfc6487;
|
||||
let mut vrs_policy = Policy::default();
|
||||
vrs_policy.resource_validation_mode = ResourceValidationMode::ValidationUpdate03;
|
||||
|
||||
assert_ne!(
|
||||
publication_point_cache_policy_fingerprint(&strict_policy),
|
||||
publication_point_cache_policy_fingerprint(&vrs_policy)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn router_asns_for_resource_mode_filters_vrs_and_rejects_strict_overclaim() {
|
||||
let issuer_as = AsResourceSet {
|
||||
asnum: Some(AsIdentifierChoice::AsIdsOrRanges(vec![
|
||||
AsIdOrRange::Range {
|
||||
min: 64500,
|
||||
max: 64510,
|
||||
},
|
||||
])),
|
||||
rdi: None,
|
||||
};
|
||||
|
||||
let strict = router_asns_for_resource_mode(
|
||||
&[64505, 64520],
|
||||
Some(&issuer_as),
|
||||
ResourceValidationMode::Rfc6487,
|
||||
)
|
||||
.unwrap_err();
|
||||
assert!(strict.contains("not a subset"), "{strict}");
|
||||
|
||||
let vrs = router_asns_for_resource_mode(
|
||||
&[64505, 64520],
|
||||
Some(&issuer_as),
|
||||
ResourceValidationMode::ValidationUpdate03,
|
||||
)
|
||||
.expect("vrs filters router asns");
|
||||
assert_eq!(vrs, vec![64505]);
|
||||
}
|
||||
|
||||
struct NeverHttpFetcher;
|
||||
impl Fetcher for NeverHttpFetcher {
|
||||
fn fetch(&self, _uri: &str) -> Result<Vec<u8>, String> {
|
||||
|
||||
Reference in New Issue
Block a user