use of org.openkilda.messaging.command.yflow.YFlowResponse in project open-kilda by telstra.
the class YFlowReadServiceTest method shouldDumpYFlows.
@Test
public void shouldDumpYFlows() throws FlowNotFoundException {
// given
String yFlowId = "test_y_flow_1";
createYFlowViaTransit(yFlowId);
// when
List<YFlowResponse> yFlows = yFlowReadService.getAllYFlows();
// then
assertEquals(1, yFlows.size());
YFlowDto yFlow = yFlows.get(0).getYFlow();
assertNotNull(yFlow);
assertEquals(yFlowId, yFlow.getYFlowId());
assertEquals(2, yFlow.getSubFlows().size());
}
use of org.openkilda.messaging.command.yflow.YFlowResponse in project open-kilda by telstra.
the class YFlowReadServiceTest method shouldFetchYFlow.
@Test
public void shouldFetchYFlow() throws FlowNotFoundException {
// given
String yFlowId = "test_y_flow_1";
createYFlowViaTransit(yFlowId);
// when
YFlowResponse yFlowResponse = yFlowReadService.getYFlow(yFlowId);
// then
YFlowDto yFlow = yFlowResponse.getYFlow();
assertNotNull(yFlow);
assertEquals(2, yFlow.getSubFlows().size());
}
use of org.openkilda.messaging.command.yflow.YFlowResponse in project open-kilda by telstra.
the class YFlowServiceImpl method getYFlow.
@Override
public CompletableFuture<YFlow> getYFlow(String yFlowId) {
log.debug("Processing getting of y-flow: {}", yFlowId);
YFlowReadRequest readRequest = new YFlowReadRequest(yFlowId);
CommandMessage request = new CommandMessage(readRequest, System.currentTimeMillis(), RequestCorrelationId.getId());
return messagingChannel.sendAndGet(flowHsTopic, request).thenApply(YFlowResponse.class::cast).thenApply(YFlowResponse::getYFlow).thenApply(flowMapper::toYFlow);
}
use of org.openkilda.messaging.command.yflow.YFlowResponse in project open-kilda by telstra.
the class YFlowServiceImpl method patchYFlow.
@Override
public CompletableFuture<YFlow> patchYFlow(String yFlowId, YFlowPatchPayload patchPayload) {
log.debug("Processing y-flow patch: {}", yFlowId);
String correlationId = RequestCorrelationId.getId();
YFlowPartialUpdateRequest yFlowPartialUpdateRequest;
try {
yFlowPartialUpdateRequest = flowMapper.toYFlowPatchRequest(yFlowId, patchPayload);
} catch (IllegalArgumentException e) {
throw new MessageException(correlationId, System.currentTimeMillis(), ErrorType.DATA_INVALID, e.getMessage(), "Can not parse arguments of the flow patch request");
}
CommandMessage request = new CommandMessage(yFlowPartialUpdateRequest, System.currentTimeMillis(), correlationId);
return messagingChannel.sendAndGet(flowHsTopic, request).thenApply(YFlowResponse.class::cast).thenApply(YFlowResponse::getYFlow).thenApply(flowMapper::toYFlow);
}
use of org.openkilda.messaging.command.yflow.YFlowResponse in project open-kilda by telstra.
the class YFlowServiceImpl method deleteYFlow.
@Override
public CompletableFuture<YFlow> deleteYFlow(String yFlowId) {
log.debug("Processing y-flow delete: {}", yFlowId);
CommandMessage command = new CommandMessage(new YFlowDeleteRequest(yFlowId), System.currentTimeMillis(), RequestCorrelationId.getId());
return messagingChannel.sendAndGet(flowHsTopic, command).thenApply(YFlowResponse.class::cast).thenApply(YFlowResponse::getYFlow).thenApply(flowMapper::toYFlow);
}
Aggregations