use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method considerLinkPropsDataOnHistory.
@Test
public void considerLinkPropsDataOnHistory() {
setupIslStorageStub();
Isl islAlphaBeta = makeIsl(endpointAlpha1, endpointBeta2, false).maxBandwidth(100L).build();
Isl islBetaAlpha = makeIsl(endpointBeta2, endpointAlpha1, false).maxBandwidth(100L).build();
islStorage.save(islAlphaBeta);
islStorage.save(islBetaAlpha);
mockPersistenceLinkProps(endpointAlpha1, endpointBeta2, makeLinkProps(endpointAlpha1, endpointBeta2).maxBandwidth(50L).build());
mockPersistenceLinkProps(endpointBeta2, endpointAlpha1, null);
mockPersistenceBandwidthAllocation(endpointAlpha1, endpointBeta2, 0L);
mockPersistenceBandwidthAllocation(endpointBeta2, endpointAlpha1, 0L);
IslReference reference = new IslReference(endpointAlpha1, endpointBeta2);
service.islSetupFromHistory(endpointAlpha1, reference, islAlphaBeta);
// need to change at least one ISL field to force DB sync
service.islUp(endpointAlpha1, reference, new IslDataHolder(200L, 200L, 200L));
verifyIslBandwidthUpdate(50L, 100L);
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method considerRecoveryAfterRoundTrip.
@Test
public void considerRecoveryAfterRoundTrip() {
setupIslStorageStub();
final IslReference reference = prepareActiveIsl();
service.roundTripStatusNotification(reference, new RoundTripStatus(reference.getSource(), IslStatus.ACTIVE));
service.islDown(reference.getSource(), reference, IslDownReason.POLL_TIMEOUT);
service.islDown(reference.getDest(), reference, IslDownReason.POLL_TIMEOUT);
// still up because of active round trip discovery
verify(dashboardLogger, times(0)).onIslDown(eq(reference), any());
// restore one-way discovery status
service.islUp(reference.getSource(), reference, new IslDataHolder(200L, 200L, 200L));
service.islUp(reference.getDest(), reference, new IslDataHolder(200L, 200L, 200L));
// remove round trip discovery
service.roundTripStatusNotification(reference, new RoundTripStatus(reference.getSource(), IslStatus.INACTIVE));
// must not fail, because of successful discovery notifications
verify(dashboardLogger, times(0)).onIslDown(eq(reference), any());
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method prepareAndPerformDelete.
private void prepareAndPerformDelete(IslStatus initialStatus, boolean multiTable) {
Isl islAlphaBeta = makeIsl(endpointAlpha1, endpointBeta2, multiTable).actualStatus(initialStatus).status(initialStatus).build();
Isl islBetaAlpha = makeIsl(endpointBeta2, endpointAlpha1, multiTable).actualStatus(initialStatus).status(initialStatus).build();
// prepare
islStorage.save(islAlphaBeta);
islStorage.save(islBetaAlpha);
mockPersistenceLinkProps(endpointAlpha1, endpointBeta2, null);
mockPersistenceLinkProps(endpointBeta2, endpointAlpha1, null);
mockPersistenceBandwidthAllocation(endpointAlpha1, endpointBeta2, 0);
mockPersistenceBandwidthAllocation(endpointBeta2, endpointAlpha1, 0);
IslReference reference = new IslReference(endpointAlpha1, endpointBeta2);
service.islSetupFromHistory(endpointAlpha1, reference, islAlphaBeta);
reset(carrier);
// remove
service.remove(reference);
if (multiTable && (initialStatus == IslStatus.INACTIVE || initialStatus == IslStatus.MOVED)) {
service.islDefaultRuleDeleted(reference, new RemoveIslDefaultRulesResult(endpointAlpha1.getDatapath(), endpointAlpha1.getPortNumber(), endpointBeta2.getDatapath(), endpointBeta2.getPortNumber(), true));
service.islDefaultRuleDeleted(reference, new RemoveIslDefaultRulesResult(endpointBeta2.getDatapath(), endpointBeta2.getPortNumber(), endpointAlpha1.getDatapath(), endpointAlpha1.getPortNumber(), true));
verify(carrier).islDefaultRulesDelete(endpointAlpha1, endpointBeta2);
verify(carrier).islDefaultRulesDelete(endpointBeta2, endpointAlpha1);
}
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkUniIslServiceTest method fromUptoBfdToDown.
@Test
public void fromUptoBfdToDown() {
NetworkUniIslService service = new NetworkUniIslService(carrier);
Endpoint endpoint1 = Endpoint.of(alphaDatapath, 1);
Switch alphaSwitch = Switch.builder().switchId(alphaDatapath).build();
Switch betaSwitch = Switch.builder().switchId(betaDatapath).build();
Isl islA1toB1 = Isl.builder().srcSwitch(alphaSwitch).srcPort(1).destSwitch(betaSwitch).destPort(1).build();
service.uniIslSetup(endpoint1, islA1toB1);
IslInfoData disco1 = IslMapper.INSTANCE.map(islA1toB1);
service.uniIslDiscovery(endpoint1, disco1);
service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.UP);
resetMocks();
service.uniIslPhysicalDown(endpoint1);
service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.UP);
service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.DOWN);
service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.UP);
// System.out.println(mockingDetails(carrier).printInvocations());
InOrder order = inOrder(carrier);
IslReference reference = IslReference.of(islA1toB1);
order.verify(carrier).notifyIslDown(endpoint1, reference, IslDownReason.PORT_DOWN);
order.verify(carrier).notifyBfdStatus(endpoint1, reference, BfdStatusUpdate.UP);
order.verify(carrier).notifyBfdStatus(endpoint1, reference, BfdStatusUpdate.DOWN);
order.verify(carrier).notifyBfdStatus(endpoint1, reference, BfdStatusUpdate.UP);
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkUniIslServiceTest method verifyIslCanBeDiscovered.
private void verifyIslCanBeDiscovered(NetworkUniIslService service, Isl link) {
Endpoint endpointA = Endpoint.of(link.getSrcSwitchId(), link.getSrcPort());
Endpoint endpointZ = Endpoint.of(link.getDestSwitchId(), link.getDestPort());
service.uniIslDiscovery(endpointA, IslMapper.INSTANCE.map(link));
verify(carrier).notifyIslUp(endpointA, new IslReference(endpointA, endpointZ), new IslDataHolder(link));
verify(carrier).exhaustedPollModeUpdateRequest(endpointA, false);
verifyNoMoreInteractions(carrier);
reset(carrier);
}
Aggregations