Search in sources :

Example 1 with AddRoaPrefixAssertion

use of net.ripe.rpki.validator3.api.roaprefixassertions.AddRoaPrefixAssertion in project rpki-validator-3 by RIPE-NCC.

the class RoaPrefixAssertionsController method add.

@PostMapping(consumes = { Api.API_MIME_TYPE, "application/json" })
public ResponseEntity<ApiResponse<RoaPrefixAssertionResource>> add(@RequestBody @Valid ApiCommand<AddRoaPrefixAssertion> command) {
    final long id = roaPrefixAssertionsService.execute(command.getData());
    final RoaPrefixAssertion ignoreFilter = roaPrefixAssertions.get(id);
    final Link selfRel = linkTo(methodOn(RoaPrefixAssertionsController.class).get(id)).withSelfRel();
    return ResponseEntity.created(URI.create(selfRel.getHref())).body(ApiResponse.data(toResource(ignoreFilter)));
}
Also used : RoaPrefixAssertion(net.ripe.rpki.validator3.domain.RoaPrefixAssertion) Link(org.springframework.hateoas.Link) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 2 with AddRoaPrefixAssertion

use of net.ripe.rpki.validator3.api.roaprefixassertions.AddRoaPrefixAssertion in project rpki-validator-3 by RIPE-NCC.

the class SlurmService method process.

@Transactional(Transactional.TxType.REQUIRED)
public void process(final Slurm slurm) {
    if (slurm.getLocallyAddedAssertions() != null && slurm.getLocallyAddedAssertions().getPrefixAssertions() != null) {
        roaPrefixAssertionsService.clear();
        slurm.getLocallyAddedAssertions().getPrefixAssertions().forEach(prefixAsertion -> {
            final AddRoaPrefixAssertion add = AddRoaPrefixAssertion.builder().asn(prefixAsertion.getAsn() == null ? null : prefixAsertion.getAsn().toString()).prefix(prefixAsertion.getPrefix()).maximumLength(prefixAsertion.getMaxPrefixLength()).comment(prefixAsertion.getComment()).build();
            roaPrefixAssertionsService.execute(add);
        });
    }
    if (slurm.getValidationOutputFilters() != null && slurm.getValidationOutputFilters().getPrefixFilters() != null) {
        ignoreFilterService.clear();
        slurm.getValidationOutputFilters().getPrefixFilters().forEach(prefixFilter -> {
            final AddIgnoreFilter addIgnoreFilter = AddIgnoreFilter.builder().asn(prefixFilter.getAsn() == null ? null : prefixFilter.getAsn().toString()).prefix(prefixFilter.getPrefix()).comment(prefixFilter.getComment()).build();
            ignoreFilterService.execute(addIgnoreFilter);
        });
    }
    if (slurm.getLocallyAddedAssertions() != null && slurm.getLocallyAddedAssertions().getBgpsecAssertions() != null) {
        bgpSecAssertionsService.clear();
        slurm.getLocallyAddedAssertions().getBgpsecAssertions().forEach(bgpSecAssertion -> {
            AddBgpSecAssertion add = AddBgpSecAssertion.builder().asn(bgpSecAssertion.getAsn() == null ? null : bgpSecAssertion.getAsn().toString()).publicKey(bgpSecAssertion.getPublicKey()).ski(bgpSecAssertion.getSki()).comment(bgpSecAssertion.getComment()).build();
            bgpSecAssertionsService.execute(add);
        });
    }
    if (slurm.getValidationOutputFilters() != null && slurm.getValidationOutputFilters().getBgpsecFilters() != null) {
        bgpSecFilterService.clear();
        slurm.getValidationOutputFilters().getBgpsecFilters().forEach(bgpSecFilter -> {
            AddBgpSecFilter add = AddBgpSecFilter.builder().asn(bgpSecFilter.getAsn() == null ? null : bgpSecFilter.getAsn().toString()).routerSki(bgpSecFilter.getRouterSKI()).comment(bgpSecFilter.getComment()).build();
            bgpSecFilterService.execute(add);
        });
    }
}
Also used : AddBgpSecFilter(net.ripe.rpki.validator3.api.bgpsec.AddBgpSecFilter) AddRoaPrefixAssertion(net.ripe.rpki.validator3.api.roaprefixassertions.AddRoaPrefixAssertion) AddIgnoreFilter(net.ripe.rpki.validator3.api.ignorefilters.AddIgnoreFilter) AddBgpSecAssertion(net.ripe.rpki.validator3.api.bgpsec.AddBgpSecAssertion) Transactional(javax.transaction.Transactional)

Aggregations

Transactional (javax.transaction.Transactional)1 AddBgpSecAssertion (net.ripe.rpki.validator3.api.bgpsec.AddBgpSecAssertion)1 AddBgpSecFilter (net.ripe.rpki.validator3.api.bgpsec.AddBgpSecFilter)1 AddIgnoreFilter (net.ripe.rpki.validator3.api.ignorefilters.AddIgnoreFilter)1 AddRoaPrefixAssertion (net.ripe.rpki.validator3.api.roaprefixassertions.AddRoaPrefixAssertion)1 RoaPrefixAssertion (net.ripe.rpki.validator3.domain.RoaPrefixAssertion)1 Link (org.springframework.hateoas.Link)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1