use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.
the class YFlowRerouteServiceTest method processRerouteRequestAndSpeakerCommands.
private void processRerouteRequestAndSpeakerCommands(YFlowRerouteRequest request) throws DuplicateKeyException {
FlowRerouteService flowRerouteService = makeFlowRerouteService(0);
YFlowRerouteService service = makeYFlowRerouteService(flowRerouteService, 0);
service.handleRequest(request.getYFlowId(), new CommandContext(), request);
verifyYFlowStatus(request.getYFlowId(), FlowStatus.IN_PROGRESS);
handleSpeakerRequests(speakerRequest -> {
SpeakerResponse commandResponse;
if (speakerRequest instanceof FlowSegmentRequest) {
FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) speakerRequest;
commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
} else {
BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) speakerRequest;
commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
}
handleAsyncResponse(service, request.getYFlowId(), commandResponse);
});
}
use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.
the class YFlowRerouteServiceTest method processCreateRequestAndSpeakerCommands.
private void processCreateRequestAndSpeakerCommands(YFlowRequest yFlowRequest) throws DuplicateKeyException {
YFlowCreateService service = makeYFlowCreateService(0);
service.handleRequest(yFlowRequest.getYFlowId(), new CommandContext(), yFlowRequest);
verifyYFlowStatus(yFlowRequest.getYFlowId(), FlowStatus.IN_PROGRESS);
handleSpeakerRequests(speakerRequest -> {
SpeakerResponse commandResponse;
if (speakerRequest instanceof FlowSegmentRequest) {
FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) speakerRequest;
commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
} else {
BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) speakerRequest;
commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
}
handleAsyncResponse(service, yFlowRequest.getYFlowId(), commandResponse);
});
}
use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.
the class YFlowRerouteServiceTest method processRerouteRequestAndSpeakerCommands.
private void processRerouteRequestAndSpeakerCommands(YFlowRerouteRequest request, FlowStatus expectedStatus, FlowStatus expectedFirstSubFlowStatus, FlowStatus expectedSecondSubFlowStatus) throws DuplicateKeyException {
FlowRerouteService flowRerouteService = makeFlowRerouteService(0);
YFlowRerouteService service = makeYFlowRerouteService(flowRerouteService, 0);
service.handleRequest(request.getYFlowId(), new CommandContext(), request);
verifyYFlowStatus(request.getYFlowId(), expectedStatus, expectedFirstSubFlowStatus, expectedSecondSubFlowStatus);
handleSpeakerRequests(speakerRequest -> {
SpeakerResponse commandResponse;
if (speakerRequest instanceof FlowSegmentRequest) {
FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) speakerRequest;
commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
} else {
BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) speakerRequest;
commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
}
handleAsyncResponse(service, request.getYFlowId(), commandResponse);
});
}
use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.
the class YFlowRerouteServiceTest method handleSpeakerCommandsAndFailInstall.
private void handleSpeakerCommandsAndFailInstall(YFlowRerouteService yFlowRerouteService, String yFlowFsmKey, String commandFlowIdToFail) {
handleSpeakerRequests(request -> {
SpeakerResponse commandResponse;
if (request instanceof FlowSegmentRequest) {
FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
commandResponse = flowSegmentRequest.isInstallRequest() && flowSegmentRequest.getMetadata().getFlowId().equals(commandFlowIdToFail) ? buildErrorSpeakerResponse(flowSegmentRequest) : buildSuccessfulSpeakerResponse(flowSegmentRequest);
} else {
BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
commandResponse = request instanceof InstallSpeakerCommandsRequest ? buildErrorYFlowSpeakerResponse(speakerCommandsRequest) : buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
}
handleAsyncResponse(yFlowRerouteService, yFlowFsmKey, commandResponse);
});
}
use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.
the class YFlowDeleteServiceTest method handleSpeakerCommandsAndFailRemove.
private void handleSpeakerCommandsAndFailRemove(YFlowDeleteService yFlowDeleteService, String yFlowFsmKey, String commandFlowIdToFail) {
handleSpeakerRequests(request -> {
SpeakerResponse commandResponse;
if (request instanceof FlowSegmentRequest) {
FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
commandResponse = flowSegmentRequest.isRemoveRequest() && flowSegmentRequest.getMetadata().getFlowId().equals(commandFlowIdToFail) ? buildErrorSpeakerResponse(flowSegmentRequest) : buildSuccessfulSpeakerResponse(flowSegmentRequest);
} else {
BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
commandResponse = request instanceof DeleteSpeakerCommandsRequest ? buildErrorYFlowSpeakerResponse(speakerCommandsRequest) : buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
}
handleAsyncResponse(yFlowDeleteService, yFlowFsmKey, commandResponse);
});
}
Aggregations