mirror of
https://github.com/NLnetLabs/routinator.git
synced 2024-05-19 06:50:04 +00:00
Fix allowed ASN format in validity JSON input. (#861)
The PR restores the ability to parse ASNs in JSON input to the validity command as either a string or a number.
This commit is contained in:
@ -498,6 +498,7 @@ struct Request {
|
||||
prefix: addr::Prefix,
|
||||
|
||||
/// The origin AS number of the route announcement.
|
||||
#[serde(deserialize_with = "Asn::deserialize_from_any")]
|
||||
asn: Asn,
|
||||
}
|
||||
|
||||
@ -516,3 +517,18 @@ const DESCRIPTION_BAD_LEN: &str = "At least one VRP Covers the Route Prefix, \
|
||||
matching this route origin ASN";
|
||||
const DESCRIPTION_NOT_FOUND: &str = "No VRP Covers the Route Prefix";
|
||||
|
||||
|
||||
//============ Tests =========================================================
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn request_list_from_json_reader() {
|
||||
let _ = RequestList::from_json_reader(
|
||||
&mut include_bytes!("../test/validate/beacons.json").as_ref()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
12
test/validate/beacons.json
Normal file
12
test/validate/beacons.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"routes": [{
|
||||
"asn": "AS12654",
|
||||
"prefix": "93.175.147.0/24"
|
||||
},
|
||||
{
|
||||
"asn": 12654,
|
||||
"prefix": "2001:7fb:fd02::/48"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user