Search in sources :

Example 1 with SlurmBgpSecFilter

use of net.ripe.rpki.validator3.api.slurm.dtos.SlurmBgpSecFilter in project rpki-validator-3 by RIPE-NCC.

the class SlurmService method get.

public Slurm get() {
    final Slurm slurm = new Slurm();
    final SlurmLocallyAddedAssertions slurmLocallyAddedAssertions = new SlurmLocallyAddedAssertions();
    slurmLocallyAddedAssertions.setPrefixAssertions(roaPrefixAssertionsService.all().map(a -> {
        final SlurmPrefixAssertion prefixAssertion = new SlurmPrefixAssertion();
        prefixAssertion.setAsn(a.getAsn());
        prefixAssertion.setPrefix(a.getPrefix());
        prefixAssertion.setMaxPrefixLength(a.getMaximumLength());
        prefixAssertion.setComment(a.getComment());
        return prefixAssertion;
    }).collect(Collectors.toList()));
    slurmLocallyAddedAssertions.setBgpsecAssertions(bgpSecAssertionsService.all().map(a -> {
        final SlurmBgpSecAssertion bgpSecAssertion = new SlurmBgpSecAssertion();
        bgpSecAssertion.setAsn(a.getAsn());
        bgpSecAssertion.setSki(a.getSki());
        bgpSecAssertion.setPublicKey(a.getPublicKey());
        bgpSecAssertion.setComment(a.getComment());
        return bgpSecAssertion;
    }).collect(Collectors.toList()));
    slurm.setLocallyAddedAssertions(slurmLocallyAddedAssertions);
    final SlurmOutputFilters filters = new SlurmOutputFilters();
    filters.setPrefixFilters(ignoreFilterService.all().map(f -> {
        final SlurmPrefixFilter prefixFilter = new SlurmPrefixFilter();
        prefixFilter.setAsn(f.getAsn());
        prefixFilter.setPrefix(f.getPrefix());
        prefixFilter.setComment(f.getComment());
        return prefixFilter;
    }).collect(Collectors.toList()));
    filters.setBgpsecFilters(bgpSecFilterService.all().map(f -> {
        final SlurmBgpSecFilter bgpSecFilter = new SlurmBgpSecFilter();
        bgpSecFilter.setAsn(f.getAsn());
        bgpSecFilter.setRouterSKI(f.getRouterSki());
        bgpSecFilter.setComment(f.getComment());
        return bgpSecFilter;
    }).collect(Collectors.toList()));
    slurm.setValidationOutputFilters(filters);
    return slurm;
}
Also used : SlurmPrefixAssertion(net.ripe.rpki.validator3.api.slurm.dtos.SlurmPrefixAssertion) Slurm(net.ripe.rpki.validator3.api.slurm.dtos.Slurm) SlurmBgpSecFilter(net.ripe.rpki.validator3.api.slurm.dtos.SlurmBgpSecFilter) SlurmLocallyAddedAssertions(net.ripe.rpki.validator3.api.slurm.dtos.SlurmLocallyAddedAssertions) SlurmOutputFilters(net.ripe.rpki.validator3.api.slurm.dtos.SlurmOutputFilters) SlurmPrefixFilter(net.ripe.rpki.validator3.api.slurm.dtos.SlurmPrefixFilter) SlurmBgpSecAssertion(net.ripe.rpki.validator3.api.slurm.dtos.SlurmBgpSecAssertion)

Example 2 with SlurmBgpSecFilter

use of net.ripe.rpki.validator3.api.slurm.dtos.SlurmBgpSecFilter in project rpki-validator-3 by RIPE-NCC.

the class SlurmParserTest method parse.

@Test
public void parse() throws IOException {
    final Slurm slurm = SlurmParser.parse(read("slurm/slurm1.json"));
    final List<SlurmPrefixFilter> prefixFilters = slurm.getValidationOutputFilters().getPrefixFilters();
    assertEquals(null, prefixFilters.get(0).getAsn());
    assertEquals(new Long(64496), prefixFilters.get(1).getAsn());
    assertEquals(new Long(64497), prefixFilters.get(2).getAsn());
    assertEquals("198.51.100.0/24", prefixFilters.get(2).getPrefix());
    assertEquals("All VRPs encompassed by prefix, matching ASN", prefixFilters.get(2).getComment());
    final List<SlurmBgpSecFilter> bgpsecFilters = slurm.getValidationOutputFilters().getBgpsecFilters();
    assertEquals(new Long(64496), bgpsecFilters.get(0).getAsn());
    assertEquals(null, bgpsecFilters.get(1).getAsn());
    assertEquals("Zm9v", bgpsecFilters.get(1).getRouterSKI());
    assertEquals(new Long(64497), bgpsecFilters.get(2).getAsn());
    assertEquals("YmFy", bgpsecFilters.get(2).getRouterSKI());
    assertEquals("Key for ASN 64497 matching Router SKI", bgpsecFilters.get(2).getComment());
    final List<SlurmPrefixAssertion> prefixAssertions = slurm.getLocallyAddedAssertions().getPrefixAssertions();
    assertEquals(new Long(64496), prefixAssertions.get(0).getAsn());
    assertEquals("198.51.100.0/24", prefixAssertions.get(0).getPrefix());
    assertEquals("My other important route", prefixAssertions.get(0).getComment());
    assertEquals(null, prefixAssertions.get(0).getMaxPrefixLength());
    assertEquals(new Long(64496), prefixAssertions.get(1).getAsn());
    assertEquals("2001:DB8::/32", prefixAssertions.get(1).getPrefix());
    assertEquals(new Integer(48), prefixAssertions.get(1).getMaxPrefixLength());
    assertEquals("My other important de-aggregated routes", prefixAssertions.get(1).getComment());
    final List<SlurmBgpSecAssertion> bgpsecAssertions = slurm.getLocallyAddedAssertions().getBgpsecAssertions();
    assertEquals(new Long(64496), bgpsecAssertions.get(0).getAsn());
    assertEquals("<some base64 SKI>", bgpsecAssertions.get(0).getSki());
    assertEquals("<some base64 public key>", bgpsecAssertions.get(0).getPublicKey());
    assertEquals("My known key for my important ASN", bgpsecAssertions.get(0).getComment());
}
Also used : SlurmPrefixAssertion(net.ripe.rpki.validator3.api.slurm.dtos.SlurmPrefixAssertion) Slurm(net.ripe.rpki.validator3.api.slurm.dtos.Slurm) SlurmBgpSecFilter(net.ripe.rpki.validator3.api.slurm.dtos.SlurmBgpSecFilter) SlurmPrefixFilter(net.ripe.rpki.validator3.api.slurm.dtos.SlurmPrefixFilter) SlurmBgpSecAssertion(net.ripe.rpki.validator3.api.slurm.dtos.SlurmBgpSecAssertion) Test(org.junit.Test)

Aggregations

Slurm (net.ripe.rpki.validator3.api.slurm.dtos.Slurm)2 SlurmBgpSecAssertion (net.ripe.rpki.validator3.api.slurm.dtos.SlurmBgpSecAssertion)2 SlurmBgpSecFilter (net.ripe.rpki.validator3.api.slurm.dtos.SlurmBgpSecFilter)2 SlurmPrefixAssertion (net.ripe.rpki.validator3.api.slurm.dtos.SlurmPrefixAssertion)2 SlurmPrefixFilter (net.ripe.rpki.validator3.api.slurm.dtos.SlurmPrefixFilter)2 SlurmLocallyAddedAssertions (net.ripe.rpki.validator3.api.slurm.dtos.SlurmLocallyAddedAssertions)1 SlurmOutputFilters (net.ripe.rpki.validator3.api.slurm.dtos.SlurmOutputFilters)1 Test (org.junit.Test)1