Skip to content
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

Fix allowed ASN format in validity JSON input. #861

Merged
merged 1 commit into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand All @@ -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 changes: 12 additions & 0 deletions test/validate/beacons.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"routes": [{
"asn": "AS12654",
"prefix": "93.175.147.0/24"
},
{
"asn": 12654,
"prefix": "2001:7fb:fd02::/48"
}
]
}