use of org.openkilda.messaging.model.NetworkEndpoint in project open-kilda by telstra.
the class LinkController method updateLinkEnableBfd.
/**
* Update "enable bfd" flag in the link.
*
* @return updated link.
*/
@ApiOperation(value = "Update \"enable bfd\" flag for the link.", response = LinkDto.class, responseContainer = "List")
@PatchMapping(path = "/links/enable-bfd", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseStatus(HttpStatus.OK)
public CompletableFuture<List<LinkDto>> updateLinkEnableBfd(@RequestBody LinkEnableBfdDto link) {
NetworkEndpoint source = makeSourceEndpoint(new SwitchId(link.getSrcSwitch()), link.getSrcPort());
NetworkEndpoint destination = makeDestinationEndpoint(new SwitchId(link.getDstSwitch()), link.getDstPort());
return linkService.writeBfdProperties(source, destination, link.isEnableBfd());
}
use of org.openkilda.messaging.model.NetworkEndpoint in project open-kilda by telstra.
the class LinkControllerV2 method bfdPropertiesRead.
/**
* Read BFD properties for specific ISL.
*/
@ApiOperation(value = "Read BFD properties", response = BfdPropertiesPayload.class)
@GetMapping(value = "/{src-switch}_{src-port}/{dst-switch}_{dst-port}/bfd")
@ResponseStatus(HttpStatus.OK)
public CompletableFuture<BfdPropertiesPayload> bfdPropertiesRead(@PathVariable("src-switch") SwitchId srcSwitchId, @PathVariable("src-port") int srcPortNumber, @PathVariable("dst-switch") SwitchId dstSwitchId, @PathVariable("dst-port") int dstPortNumber) {
NetworkEndpoint source = makeSourceEndpoint(srcSwitchId, srcPortNumber);
NetworkEndpoint dest = makeDestinationEndpoint(dstSwitchId, dstPortNumber);
return linkService.readBfdProperties(source, dest);
}
use of org.openkilda.messaging.model.NetworkEndpoint in project open-kilda by telstra.
the class LinkControllerV2 method bfdPropertiesDelete.
/**
* Disable BFD for specific ISL.
*/
@ApiOperation(value = "Delete/disable BFD")
@DeleteMapping(value = "/{src-switch}_{src-port}/{dst-switch}_{dst-port}/bfd")
@ResponseStatus(HttpStatus.NO_CONTENT)
public CompletableFuture<BfdPropertiesPayload> bfdPropertiesDelete(@PathVariable("src-switch") SwitchId srcSwitchId, @PathVariable("src-port") int srcPortNumber, @PathVariable("dst-switch") SwitchId dstSwitchId, @PathVariable("dst-port") int dstPortNumber) {
NetworkEndpoint source = makeSourceEndpoint(srcSwitchId, srcPortNumber);
NetworkEndpoint dest = makeDestinationEndpoint(dstSwitchId, dstPortNumber);
return linkService.deleteBfdProperties(source, dest);
}
use of org.openkilda.messaging.model.NetworkEndpoint in project open-kilda by telstra.
the class LinkPropsMapper method toDto.
/**
* Converts link properties to {@link org.openkilda.northbound.dto.v1.links.LinkPropsDto}.
*/
default org.openkilda.northbound.dto.v1.links.LinkPropsDto toDto(LinkPropsData data) {
requireNonNull(data.getLinkProps(), "Link props should be presented");
NetworkEndpoint source = data.getLinkProps().getSource();
NetworkEndpoint destination = data.getLinkProps().getDest();
return new org.openkilda.northbound.dto.v1.links.LinkPropsDto(source.getDatapath().toString(), source.getPortNumber(), destination.getDatapath().toString(), destination.getPortNumber(), data.getLinkProps().getProps());
}
use of org.openkilda.messaging.model.NetworkEndpoint in project open-kilda by telstra.
the class LinkPropsMapper method toLinkProps.
/**
* Converts {@link org.openkilda.northbound.dto.v1.links.LinkPropsDto} into {@link LinkPropsDto}.
*/
default LinkPropsDto toLinkProps(org.openkilda.northbound.dto.v1.links.LinkPropsDto input) {
NetworkEndpoint source = new NetworkEndpoint(new SwitchId(input.getSrcSwitch()), input.getSrcPort());
NetworkEndpoint dest = new NetworkEndpoint(new SwitchId(input.getDstSwitch()), input.getDstPort());
return new LinkPropsDto(source, dest, input.getProps());
}
Aggregations