use of org.openkilda.model.SwitchId in project open-kilda by telstra.
the class NetworkWatcherServiceTest method discoveryBeforeConfirmation.
@Test
public void discoveryBeforeConfirmation() {
final int awaitTime = 10;
PathNode source = new PathNode(new SwitchId(1), 1, 0);
PathNode destination = new PathNode(new SwitchId(2), 1, 0);
NetworkWatcherService w = makeService(awaitTime);
w.addWatch(Endpoint.of(source.getSwitchId(), source.getPortNo()), 1);
verify(carrier, times(1)).sendDiscovery(any(DiscoverIslCommandData.class));
IslInfoData islAlphaBeta = IslInfoData.builder().source(source).destination(destination).packetId(0L).build();
w.discovery(islAlphaBeta);
w.confirmation(new Endpoint(source), 0);
w.tick(awaitTime + 1);
verify(carrier).oneWayDiscoveryReceived(eq(new Endpoint(source)), eq(0L), eq(islAlphaBeta), anyLong());
verify(carrier, never()).discoveryFailed(eq(new Endpoint(source)), anyLong(), anyLong());
assertThat(w.getConfirmedPackets().size(), is(0));
}
use of org.openkilda.model.SwitchId in project open-kilda by telstra.
the class WatcherHandler method sendDiscovery.
@Override
public void sendDiscovery(DiscoverIslCommandData discoveryRequest) {
SwitchId switchId = discoveryRequest.getSwitchId();
emit(STREAM_SPEAKER_ID, getCurrentTuple(), makeSpeakerTuple(switchId.toString(), discoveryRequest));
}
use of org.openkilda.model.SwitchId in project open-kilda by telstra.
the class LinkServiceImpl method updateLinkUnderMaintenance.
@Override
public CompletableFuture<List<LinkDto>> updateLinkUnderMaintenance(LinkUnderMaintenanceDto link) {
final String correlationId = RequestCorrelationId.getId();
logger.debug("Update under maintenance link request processing");
UpdateLinkUnderMaintenanceRequest data = null;
try {
data = new UpdateLinkUnderMaintenanceRequest(new NetworkEndpoint(new SwitchId(link.getSrcSwitch()), link.getSrcPort()), new NetworkEndpoint(new SwitchId(link.getDstSwitch()), link.getDstPort()), link.isUnderMaintenance(), link.isEvacuate());
} catch (IllegalArgumentException e) {
logger.error("Can not parse arguments: {}", e.getMessage());
throw new MessageException(correlationId, System.currentTimeMillis(), ErrorType.DATA_INVALID, e.getMessage(), "Can not parse arguments when create 'update ISL Under maintenance' request");
}
CommandMessage message = new CommandMessage(data, System.currentTimeMillis(), correlationId, Destination.WFM);
return messagingChannel.sendAndGetChunked(nbworkerTopic, message).thenApply(response -> response.stream().map(IslInfoData.class::cast).map(linkMapper::mapResponse).collect(Collectors.toList()));
}
use of org.openkilda.model.SwitchId 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.model.SwitchId 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