use of org.openkilda.messaging.nbtopology.request.LinkPropsDrop in project open-kilda by telstra.
the class LinkServiceTest method dropLinkProps.
@Test
public void dropLinkProps() {
final String correlationId = getClass().getCanonicalName();
LinkPropsDto input = new LinkPropsDto("ff:fe:00:00:00:00:00:01", 8, "ff:fe:00:00:00:00:00:05", null, null);
LinkPropsDrop request = new LinkPropsDrop(new LinkPropsMask(new NetworkEndpointMask(new SwitchId(input.getSrcSwitch()), input.getSrcPort()), new NetworkEndpointMask(new SwitchId(input.getDstSwitch()), input.getDstPort())));
org.openkilda.messaging.model.LinkPropsDto linkProps = new org.openkilda.messaging.model.LinkPropsDto(new NetworkEndpoint(new SwitchId(input.getSrcSwitch()), input.getSrcPort()), new NetworkEndpoint(new SwitchId("ff:fe:00:00:00:00:00:02"), 9), new HashMap<>());
LinkPropsResponse payload = new LinkPropsResponse(request, linkProps, null);
String requestIdBatch = idFactory.produceChained(String.valueOf(requestIdIndex++), correlationId);
messageExchanger.mockChunkedResponse(requestIdBatch, Collections.singletonList(payload));
RequestCorrelationId.create(correlationId);
BatchResults result = linkService.delLinkProps(Collections.singletonList(input)).join();
assertThat(result.getFailures(), is(0));
assertThat(result.getSuccesses(), is(1));
assertTrue(result.getMessages().isEmpty());
}
use of org.openkilda.messaging.nbtopology.request.LinkPropsDrop in project open-kilda by telstra.
the class LinkServiceImpl method delLinkProps.
@Override
public CompletableFuture<BatchResults> delLinkProps(List<LinkPropsDto> linkPropsList) {
List<CompletableFuture<List<InfoData>>> pendingRequest = new ArrayList<>(linkPropsList.size());
for (LinkPropsDto requestItem : linkPropsList) {
LinkPropsDrop request = new LinkPropsDrop(linkPropsMapper.toLinkPropsMask(requestItem));
String requestId = idFactory.produceChained(RequestCorrelationId.getId());
CommandMessage message = new CommandMessage(request, System.currentTimeMillis(), requestId);
pendingRequest.add(messagingChannel.sendAndGetChunked(nbworkerTopic, message));
}
return collectChunkedResponses(pendingRequest, LinkPropsResponse.class).thenApply(responses -> getLinkPropsResult(responses, new ArrayList<>()));
}
Aggregations