1
0
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:
Martin Hoffmann
2023-05-19 09:21:48 +02:00
committed by GitHub
parent 953671cd46
commit 7321b6adb7
2 changed files with 28 additions and 0 deletions

View File

@ -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()
);
}
}

View File

@ -0,0 +1,12 @@
{
"routes": [{
"asn": "AS12654",
"prefix": "93.175.147.0/24"
},
{
"asn": 12654,
"prefix": "2001:7fb:fd02::/48"
}
]
}