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);
}
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();
}
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;
}
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);
}
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();
}
Aggregations