Skip to content

Commit f80d84a

Browse files
authored
Make changes to SLURM non-breaking. (#329)
This PR makes the changes to SLURM in #325 non-breaking by removing the aspa argument from ValidationOutputFilters::new and LocallyAddedAssertions::new and setting the aspa fields of these structs initially to None. The braces constructor can be used to create fully populated values.
1 parent f11b375 commit f80d84a

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

src/slurm.rs

+24-21
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,16 @@ pub struct ValidationOutputFilters {
172172

173173
impl ValidationOutputFilters {
174174
/// Creates a new value from the components.
175+
///
176+
/// Sets the `aspa` field to `None`.
175177
pub fn new(
176178
prefix: impl Into<Vec<PrefixFilter>>,
177179
bgpsec: impl Into<Vec<BgpsecFilter>>,
178-
aspa: Option<impl Into<Vec<AspaFilter>>>,
179180
) -> Self {
180-
let aspa = aspa.map(|a| a.into());
181181
ValidationOutputFilters {
182182
prefix: prefix.into(),
183183
bgpsec: bgpsec.into(),
184-
aspa,
184+
aspa: None,
185185
}
186186
}
187187

@@ -381,16 +381,16 @@ pub struct LocallyAddedAssertions {
381381

382382
impl LocallyAddedAssertions {
383383
/// Creates a new value from its components.
384+
///
385+
/// Sets the `aspa` field to `None`.
384386
pub fn new(
385387
prefix: impl Into<Vec<PrefixAssertion>>,
386388
bgpsec: impl Into<Vec<BgpsecAssertion>>,
387-
aspa: Option<impl Into<Vec<AspaAssertion>>>,
388389
) -> Self {
389-
let aspa = aspa.map(|a| a.into());
390390
LocallyAddedAssertions {
391391
prefix: prefix.into(),
392392
bgpsec: bgpsec.into(),
393-
aspa,
393+
aspa: None,
394394
}
395395
}
396396

@@ -1189,7 +1189,6 @@ mod test {
11891189
Some(String::from("Key for ASN matching SKI"))
11901190
),
11911191
],
1192-
None::<Vec<AspaFilter>>
11931192
),
11941193
LocallyAddedAssertions::new(
11951194
[
@@ -1220,7 +1219,6 @@ mod test {
12201219
None,
12211220
),
12221221
],
1223-
None::<Vec<AspaAssertion>>
12241222
),
12251223
)
12261224
}
@@ -1237,8 +1235,8 @@ mod test {
12371235

12381236
fn full_slurm_v2() -> SlurmFile {
12391237
SlurmFile::new(
1240-
ValidationOutputFilters::new(
1241-
[
1238+
ValidationOutputFilters {
1239+
prefix: vec![
12421240
PrefixFilter::new(
12431241
Some(Prefix::new_v4(
12441242
[192, 0, 2, 0].into(), 24
@@ -1263,7 +1261,7 @@ mod test {
12631261
))
12641262
),
12651263
],
1266-
[
1264+
bgpsec: vec![
12671265
BgpsecFilter::new(
12681266
None,
12691267
Some(64496.into()),
@@ -1280,15 +1278,15 @@ mod test {
12801278
Some(String::from("Key for ASN matching SKI"))
12811279
),
12821280
],
1283-
Some([
1281+
aspa: Some(vec![
12841282
AspaFilter::new(
12851283
Some(64496.into()),
12861284
Some(String::from("ASPAs matching Customer ASID 64496"))
12871285
)
1288-
])
1289-
),
1290-
LocallyAddedAssertions::new(
1291-
[
1286+
]),
1287+
},
1288+
LocallyAddedAssertions {
1289+
prefix: vec![
12921290
PrefixAssertion::new(
12931291
Prefix::new_v4(
12941292
[198, 51, 100, 0].into(), 24
@@ -1308,22 +1306,27 @@ mod test {
13081306
Some(String::from("My de-aggregated route"))
13091307
),
13101308
],
1311-
[
1309+
bgpsec: vec![
13121310
BgpsecAssertion::new(
13131311
64496.into(),
13141312
KeyIdentifier::from(*b"12345678901234567890"),
13151313
Bytes::from(b"blubb".as_ref()).try_into().unwrap(),
13161314
None,
13171315
),
13181316
],
1319-
Some([
1317+
aspa: Some(vec![
13201318
AspaAssertion::new(
13211319
64496.into(),
1322-
ProviderAsns::try_from_iter([64497.into(), 64498.into()]).unwrap(),
1323-
Some(String::from("Locally assert 64497 and 64498 are providers for 64496"))
1320+
ProviderAsns::try_from_iter(
1321+
[64497.into(), 64498.into()]
1322+
).unwrap(),
1323+
Some(String::from(
1324+
"Locally assert 64497 and 64498 are providers \
1325+
for 64496"
1326+
))
13241327
)
13251328
])
1326-
),
1329+
},
13271330
)
13281331
}
13291332

0 commit comments

Comments
 (0)