Search in sources :

Example 1 with IslFsmEvent

use of org.openkilda.wfm.topology.network.controller.isl.IslFsm.IslFsmEvent in project open-kilda by telstra.

the class NetworkIslService method bfdStatusUpdate.

/**
 * Handle BFD status events.
 */
public void bfdStatusUpdate(Endpoint endpoint, IslReference reference, BfdStatusUpdate status) {
    log.debug("ISL service receive BFD status update for {} (on {}) - {}", reference, endpoint, status);
    IslFsm islFsm = locateController(reference);
    IslFsmEvent event;
    switch(status) {
        case UP:
            event = IslFsmEvent.BFD_UP;
            break;
        case DOWN:
            event = IslFsmEvent.BFD_DOWN;
            break;
        case KILL:
            event = IslFsmEvent.BFD_KILL;
            break;
        case FAIL:
            event = IslFsmEvent.BFD_FAIL;
            break;
        default:
            throw new IllegalArgumentException(format("Unsupported %s value %s", status.getClass().getName(), status));
    }
    IslFsmContext context = IslFsmContext.builder(carrier, endpoint).build();
    controllerExecutor.fire(islFsm, event, context);
}
Also used : IslFsm(org.openkilda.wfm.topology.network.controller.isl.IslFsm) IslFsmContext(org.openkilda.wfm.topology.network.controller.isl.IslFsm.IslFsmContext) IslFsmEvent(org.openkilda.wfm.topology.network.controller.isl.IslFsm.IslFsmEvent)

Example 2 with IslFsmEvent

use of org.openkilda.wfm.topology.network.controller.isl.IslFsm.IslFsmEvent in project open-kilda by telstra.

the class IslFsm method fireBecomeStateEvent.

private void fireBecomeStateEvent(IslFsmContext context) {
    IslFsmEvent route;
    final IslStatus effectiveStatus = statusAggregator.getEffectiveStatus();
    switch(effectiveStatus) {
        case ACTIVE:
            route = IslFsmEvent._BECOME_UP;
            break;
        case INACTIVE:
            route = IslFsmEvent._BECOME_DOWN;
            break;
        case MOVED:
            route = IslFsmEvent._BECOME_MOVED;
            break;
        default:
            throw new IllegalArgumentException(makeInvalidMappingMessage(effectiveStatus.getClass(), IslFsmEvent.class, effectiveStatus));
    }
    fire(route, context);
}
Also used : IslFsmEvent(org.openkilda.wfm.topology.network.controller.isl.IslFsm.IslFsmEvent) IslStatus(org.openkilda.model.IslStatus)

Aggregations

IslFsmEvent (org.openkilda.wfm.topology.network.controller.isl.IslFsm.IslFsmEvent)2 IslStatus (org.openkilda.model.IslStatus)1 IslFsm (org.openkilda.wfm.topology.network.controller.isl.IslFsm)1 IslFsmContext (org.openkilda.wfm.topology.network.controller.isl.IslFsm.IslFsmContext)1