Search in sources :

Example 1 with IslEndpointBfdStatus

use of org.openkilda.wfm.topology.network.model.IslEndpointBfdStatus in project open-kilda by telstra.

the class DiscoveryBfdMonitor method actualUpdate.

@Override
public void actualUpdate(IslFsmEvent event, IslFsmContext context) {
    final Endpoint endpoint = context.getEndpoint();
    IslEndpointBfdStatus update = null;
    switch(event) {
        case BFD_UP:
            update = new IslEndpointBfdStatus(true, BfdSessionStatus.UP);
            break;
        case BFD_DOWN:
            update = new IslEndpointBfdStatus(true, BfdSessionStatus.DOWN);
            break;
        case BFD_KILL:
            update = new IslEndpointBfdStatus(false, null);
            break;
        case BFD_FAIL:
            update = new IslEndpointBfdStatus(false, BfdSessionStatus.FAIL);
            break;
        default:
    }
    if (update != null) {
        discoveryData.put(endpoint, update);
    }
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) IslEndpointBfdStatus(org.openkilda.wfm.topology.network.model.IslEndpointBfdStatus)

Example 2 with IslEndpointBfdStatus

use of org.openkilda.wfm.topology.network.model.IslEndpointBfdStatus in project open-kilda by telstra.

the class DiscoveryBfdMonitor method evaluateStatus.

@Override
public Optional<IslStatus> evaluateStatus() {
    boolean isEnabled = true;
    boolean isUp = false;
    for (Iterator<IslEndpointBfdStatus> it = discoveryData.stream().iterator(); it.hasNext(); ) {
        IslEndpointBfdStatus entry = it.next();
        // only if both endpoint are BFD capable we can use BFD statuses
        isEnabled &= entry.isEnabled();
        isUp |= entry.getStatus() == BfdSessionStatus.UP;
    }
    if (isEnabled) {
        return Optional.of(isUp ? IslStatus.ACTIVE : IslStatus.INACTIVE);
    }
    return Optional.empty();
}
Also used : IslEndpointBfdStatus(org.openkilda.wfm.topology.network.model.IslEndpointBfdStatus)

Aggregations

IslEndpointBfdStatus (org.openkilda.wfm.topology.network.model.IslEndpointBfdStatus)2 Endpoint (org.openkilda.wfm.share.model.Endpoint)1