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)));
}
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);
});
}
}
Aggregations