use of org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest in project open-kilda by telstra.
the class YFlowCreateServiceTest method handleSpeakerCommandsAndTimeoutInstall.
private void handleSpeakerCommandsAndTimeoutInstall(YFlowCreateService yFlowCreateService, String yFlowFsmKey) {
handleSpeakerRequests(request -> {
SpeakerResponse commandResponse;
if (request instanceof FlowSegmentRequest) {
FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
} else {
BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
if (speakerCommandsRequest instanceof InstallSpeakerCommandsRequest) {
handleTimeout(yFlowCreateService, yFlowFsmKey);
}
commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
}
yFlowCreateService.handleAsyncResponse(yFlowFsmKey, commandResponse);
});
}
use of org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest in project open-kilda by telstra.
the class YFlowUpdateServiceTest method processUpdateRequestAndSpeakerCommands.
private void processUpdateRequestAndSpeakerCommands(YFlowRequest yFlowRequest) throws DuplicateKeyException {
YFlowUpdateService service = makeYFlowUpdateService(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.request.rulemanager.BaseSpeakerCommandsRequest in project open-kilda by telstra.
the class YFlowUpdateServiceTest method processUpdateRequestAndSpeakerCommands.
private void processUpdateRequestAndSpeakerCommands(YFlowRequest request, FlowStatus expectedStatus, FlowStatus expectedFirstSubFlowStatus, FlowStatus expectedSecondSubFlowStatus) throws DuplicateKeyException {
FlowUpdateService flowUpdateService = makeFlowUpdateService(0);
YFlowUpdateService service = makeYFlowUpdateService(flowUpdateService, 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.request.rulemanager.BaseSpeakerCommandsRequest in project open-kilda by telstra.
the class RecordHandler method handleRuleManagerCommand.
private boolean handleRuleManagerCommand() {
try {
BaseSpeakerCommandsRequest request = MAPPER.readValue(record.value(), BaseSpeakerCommandsRequest.class);
handleRuleManagerCommand(request);
return true;
} catch (JsonMappingException e) {
logger.trace("Received deprecated command message");
} catch (IOException e) {
logger.error("Error while parsing record {}", record.value(), e);
}
return false;
}
Aggregations