Search in sources :

Example 6 with NetworkEndpoint

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());
}
Also used : NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) SwitchId(org.openkilda.model.SwitchId) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) ApiOperation(io.swagger.annotations.ApiOperation) PatchMapping(org.springframework.web.bind.annotation.PatchMapping)

Example 7 with NetworkEndpoint

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);
}
Also used : NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) GetMapping(org.springframework.web.bind.annotation.GetMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) ApiOperation(io.swagger.annotations.ApiOperation)

Example 8 with NetworkEndpoint

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);
}
Also used : NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) ApiOperation(io.swagger.annotations.ApiOperation)

Example 9 with NetworkEndpoint

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());
}
Also used : NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) LinkPropsDto(org.openkilda.messaging.model.LinkPropsDto)

Example 10 with NetworkEndpoint

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());
}
Also used : NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) LinkPropsDto(org.openkilda.messaging.model.LinkPropsDto) SwitchId(org.openkilda.model.SwitchId)

Aggregations

NetworkEndpoint (org.openkilda.messaging.model.NetworkEndpoint)32 SwitchId (org.openkilda.model.SwitchId)16 Test (org.junit.Test)14 Ping (org.openkilda.messaging.model.Ping)7 CommandMessage (org.openkilda.messaging.command.CommandMessage)5 InfoMessage (org.openkilda.messaging.info.InfoMessage)5 LinkPropsDto (org.openkilda.messaging.model.LinkPropsDto)5 LinkPropsResponse (org.openkilda.messaging.nbtopology.response.LinkPropsResponse)5 FlowTransitEncapsulation (org.openkilda.model.FlowTransitEncapsulation)5 ApiOperation (io.swagger.annotations.ApiOperation)4 HashMap (java.util.HashMap)4 MessageException (org.openkilda.messaging.error.MessageException)4 LinkPropsPut (org.openkilda.messaging.nbtopology.request.LinkPropsPut)4 LinkPropsDto (org.openkilda.northbound.dto.v1.links.LinkPropsDto)4 Ethernet (net.floodlightcontroller.packet.Ethernet)3 IPacket (net.floodlightcontroller.packet.IPacket)3 InputService (org.openkilda.floodlight.service.of.InputService)3 DatapathId (org.projectfloodlight.openflow.types.DatapathId)3 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)3 Date (java.util.Date)2