Search in sources :

Example 1 with IslStatus

use of org.openkilda.model.IslStatus in project open-kilda by telstra.

the class InMemoryPathComputerBaseTest method createDiamondWithAffinity.

// A - B - D    and A-B-D is used in flow affinity group
// + C +
void createDiamondWithAffinity() {
    Switch nodeA = createSwitch("00:0A");
    Switch nodeB = createSwitch("00:0B");
    Switch nodeC = createSwitch("00:0C");
    Switch nodeD = createSwitch("00:0D");
    IslStatus status = IslStatus.ACTIVE;
    int cost = 100;
    createIsl(nodeA, nodeB, status, status, cost * 2, 1000, 1, cost * 2);
    createIsl(nodeA, nodeC, status, status, cost, 1000, 2, cost);
    createIsl(nodeB, nodeD, status, status, cost * 2, 1000, 3, cost * 2);
    createIsl(nodeC, nodeD, status, status, cost, 1000, 4, cost);
    createIsl(nodeB, nodeA, status, status, cost * 2, 1000, 1, cost * 2);
    createIsl(nodeC, nodeA, status, status, cost, 1000, 2, cost);
    createIsl(nodeD, nodeB, status, status, cost * 2, 1000, 3, cost * 2);
    createIsl(nodeD, nodeC, status, status, cost, 1000, 4, cost);
    int bandwith = 10;
    Flow flow = Flow.builder().flowId(TEST_FLOW_ID).srcSwitch(nodeA).srcPort(15).destSwitch(nodeD).destPort(16).affinityGroupId(TEST_FLOW_ID).bandwidth(bandwith).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).build();
    FlowPath forwardPath = FlowPath.builder().pathId(new PathId(UUID.randomUUID().toString())).srcSwitch(nodeA).destSwitch(nodeD).bandwidth(bandwith).cookie(new FlowSegmentCookie(1L).toBuilder().direction(FlowPathDirection.FORWARD).build()).build();
    addPathSegment(forwardPath, nodeA, nodeB, 1, 1);
    addPathSegment(forwardPath, nodeB, nodeD, 3, 3);
    flow.setForwardPath(forwardPath);
    FlowPath reversePath = FlowPath.builder().pathId(new PathId(UUID.randomUUID().toString())).srcSwitch(nodeD).destSwitch(nodeA).bandwidth(bandwith).cookie(new FlowSegmentCookie(1L).toBuilder().direction(FlowPathDirection.REVERSE).build()).build();
    addPathSegment(reversePath, nodeD, nodeB, 3, 3);
    addPathSegment(reversePath, nodeB, nodeA, 1, 1);
    flow.setReversePath(reversePath);
    flowRepository.add(flow);
}
Also used : PathId(org.openkilda.model.PathId) FlowSegmentCookie(org.openkilda.model.cookie.FlowSegmentCookie) Switch(org.openkilda.model.Switch) IslStatus(org.openkilda.model.IslStatus) FlowPath(org.openkilda.model.FlowPath) Flow(org.openkilda.model.Flow)

Example 2 with IslStatus

use of org.openkilda.model.IslStatus in project open-kilda by telstra.

the class IslFsm method swapStatusAggregator.

private boolean swapStatusAggregator() {
    IslStatus current = statusAggregator.getEffectiveStatus();
    statusAggregator = evaluateStatus();
    log.debug("ISL {} status evaluation details - {}", reference, statusAggregator.getDetails());
    return current != statusAggregator.getEffectiveStatus();
}
Also used : IslStatus(org.openkilda.model.IslStatus)

Example 3 with IslStatus

use of org.openkilda.model.IslStatus in project open-kilda by telstra.

the class IslFsm method makeRerouteAffectedReason.

private String makeRerouteAffectedReason(Endpoint endpoint) {
    final IslDownReason downReason = statusAggregator.getDownReason();
    final IslStatus effectiveStatus = statusAggregator.getEffectiveStatus();
    if (downReason == null) {
        return String.format("ISL %s status become %s", reference, effectiveStatus);
    }
    String humanReason;
    switch(downReason) {
        case PORT_DOWN:
            humanReason = String.format("ISL %s become %s due to physical link DOWN event on %s", reference, effectiveStatus, endpoint);
            break;
        case POLL_TIMEOUT:
            humanReason = String.format("ISL %s become %s because of FAIL TIMEOUT (endpoint:%s)", reference, effectiveStatus, endpoint);
            break;
        case BFD_DOWN:
            humanReason = String.format("ISL %s become %s because BFD detect link failure (endpoint:%s)", reference, effectiveStatus, endpoint);
            break;
        default:
            humanReason = String.format("ISL %s become %s (endpoint:%s, reason:%s)", reference, effectiveStatus, endpoint, downReason);
    }
    return humanReason;
}
Also used : IslStatus(org.openkilda.model.IslStatus) IslDownReason(org.openkilda.model.IslDownReason)

Example 4 with IslStatus

use of org.openkilda.model.IslStatus 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)

Example 5 with IslStatus

use of org.openkilda.model.IslStatus in project open-kilda by telstra.

the class DiscoveryPollMonitor method evaluateStatus.

@Override
public Optional<IslStatus> evaluateStatus() {
    IslStatus forward = discoveryData.getForward().getStatus();
    IslStatus reverse = discoveryData.getReverse().getStatus();
    if (forward == reverse) {
        return Optional.of(forward);
    }
    if (forward == IslStatus.INACTIVE || reverse == IslStatus.INACTIVE) {
        return Optional.of(IslStatus.INACTIVE);
    }
    return Optional.empty();
}
Also used : IslStatus(org.openkilda.model.IslStatus)

Aggregations

IslStatus (org.openkilda.model.IslStatus)8 Switch (org.openkilda.model.Switch)4 Flow (org.openkilda.model.Flow)3 FlowPath (org.openkilda.model.FlowPath)3 PathId (org.openkilda.model.PathId)3 FlowSegmentCookie (org.openkilda.model.cookie.FlowSegmentCookie)2 IslDownReason (org.openkilda.model.IslDownReason)1 IslFsmEvent (org.openkilda.wfm.topology.network.controller.isl.IslFsm.IslFsmEvent)1