Search in sources :

Example 1 with FlowMeterModifyFsm

use of org.openkilda.wfm.topology.nbworker.fsm.FlowMeterModifyFsm in project open-kilda by telstra.

the class FlowMeterModifyHubService method handleRequest.

/**
 * Handle flow meter modify request.
 */
public void handleRequest(String key, MeterModifyRequest request, FlowHubCarrier carrier) {
    FlowMeterModifyFsm fsm = builder.newStateMachine(FlowMeterModifyState.INITIALIZED, carrier, key, request, persistenceManager);
    process(fsm);
}
Also used : FlowMeterModifyFsm(org.openkilda.wfm.topology.nbworker.fsm.FlowMeterModifyFsm)

Example 2 with FlowMeterModifyFsm

use of org.openkilda.wfm.topology.nbworker.fsm.FlowMeterModifyFsm in project open-kilda by telstra.

the class FlowMeterModifyHubService method handleTaskTimeout.

/**
 * Handle timeout event.
 */
public void handleTaskTimeout(String key) {
    FlowMeterModifyFsm fsm = fsms.get(key);
    ErrorData errorData = new ErrorData(ErrorType.OPERATION_TIMED_OUT, "Flow meter modify failed by timeout", "Error in FlowMeterModifyHubService");
    ErrorMessage errorMessage = new ErrorMessage(errorData, System.currentTimeMillis(), key);
    fsm.fire(FlowMeterModifyEvent.ERROR, errorMessage);
    process(fsm);
}
Also used : FlowMeterModifyFsm(org.openkilda.wfm.topology.nbworker.fsm.FlowMeterModifyFsm) ErrorMessage(org.openkilda.messaging.error.ErrorMessage) ErrorData(org.openkilda.messaging.error.ErrorData)

Example 3 with FlowMeterModifyFsm

use of org.openkilda.wfm.topology.nbworker.fsm.FlowMeterModifyFsm in project open-kilda by telstra.

the class FlowMeterModifyHubService method handleAsyncResponse.

/**
 * Handle response from speaker worker.
 */
public void handleAsyncResponse(String key, Message message) {
    FlowMeterModifyFsm fsm = fsms.get(key);
    if (message instanceof InfoMessage) {
        InfoData data = ((InfoMessage) message).getData();
        if (data instanceof SwitchMeterEntries) {
            fsm.fire(FlowMeterModifyEvent.RESPONSE_RECEIVED, data);
        } else {
            log.warn("Key: {}; Unhandled message {}", key, message);
        }
    } else if (message instanceof ErrorMessage) {
        fsm.fire(FlowMeterModifyEvent.ERROR, message);
    }
    process(fsm);
}
Also used : FlowMeterModifyFsm(org.openkilda.wfm.topology.nbworker.fsm.FlowMeterModifyFsm) InfoMessage(org.openkilda.messaging.info.InfoMessage) InfoData(org.openkilda.messaging.info.InfoData) SwitchMeterEntries(org.openkilda.messaging.info.meter.SwitchMeterEntries) ErrorMessage(org.openkilda.messaging.error.ErrorMessage)

Aggregations

FlowMeterModifyFsm (org.openkilda.wfm.topology.nbworker.fsm.FlowMeterModifyFsm)3 ErrorMessage (org.openkilda.messaging.error.ErrorMessage)2 ErrorData (org.openkilda.messaging.error.ErrorData)1 InfoData (org.openkilda.messaging.info.InfoData)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 SwitchMeterEntries (org.openkilda.messaging.info.meter.SwitchMeterEntries)1