use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method preparePortDownStatusReset.
private IslReference preparePortDownStatusReset() {
setupIslStorageStub();
IslReference reference = prepareActiveIsl();
service.islDown(reference.getSource(), reference, IslDownReason.PORT_DOWN);
verify(dashboardLogger).onIslDown(eq(reference), any());
reset(dashboardLogger);
return reference;
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method setIslUnstableTimeOnPortDown.
@Test
public void setIslUnstableTimeOnPortDown() {
setupIslStorageStub();
IslReference reference = prepareActiveIsl();
Instant updateTime = clock.adjust(Duration.ofSeconds(1));
// isl fail by PORT DOWN
service.islDown(endpointAlpha1, reference, IslDownReason.PORT_DOWN);
// ensure we have marked ISL as unstable
Isl forward = lookupIsl(reference.getSource(), reference.getDest());
Assert.assertEquals(updateTime, forward.getTimeUnstable());
Isl reverse = lookupIsl(reference.getDest(), reference.getSource());
Assert.assertEquals(updateTime, reverse.getTimeUnstable());
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method considerBfdEventOnlyWhenBfdEnabledForBothEndpoints.
@Test
public void considerBfdEventOnlyWhenBfdEnabledForBothEndpoints() {
setupIslStorageStub();
Isl islAlphaBeta = makeIsl(endpointAlpha1, endpointBeta2, false).bfdInterval(genericBfdProperties.getInterval()).bfdMultiplier(genericBfdProperties.getMultiplier()).build();
Isl islBetaAlpha = makeIsl(endpointBeta2, endpointAlpha1, false).bfdInterval(genericBfdProperties.getInterval()).bfdMultiplier(genericBfdProperties.getMultiplier()).build();
islStorage.save(islAlphaBeta);
islStorage.save(islBetaAlpha);
IslReference reference = new IslReference(endpointAlpha1, endpointBeta2);
// system start
service.islSetupFromHistory(endpointAlpha1, reference, islAlphaBeta);
// BFD setup requests
verify(carrier).bfdPropertiesApplyRequest(eq(reference.getSource()), eq(reference), eq(genericBfdProperties));
verify(carrier).bfdPropertiesApplyRequest(eq(reference.getDest()), eq(reference), eq(genericBfdProperties));
reset(dashboardLogger);
// one BFD session is removed
service.bfdStatusUpdate(endpointAlpha1, reference, BfdStatusUpdate.DOWN);
// one BFD session is reinstalled
service.bfdStatusUpdate(endpointAlpha1, reference, BfdStatusUpdate.UP);
service.bfdStatusUpdate(endpointAlpha1, reference, BfdStatusUpdate.DOWN);
// second BFD session is reinstalled
service.bfdStatusUpdate(endpointBeta2, reference, BfdStatusUpdate.UP);
verify(carrier).auxiliaryPollModeUpdateRequest(eq(reference.getSource()), eq(true));
verify(carrier).auxiliaryPollModeUpdateRequest(eq(reference.getDest()), eq(true));
service.bfdStatusUpdate(endpointAlpha1, reference, BfdStatusUpdate.UP);
verify(dashboardLogger, never()).onIslDown(eq(reference), any());
// only now BFD events must be able to control ISL state
service.bfdStatusUpdate(endpointAlpha1, reference, BfdStatusUpdate.DOWN);
// opposite session still UP
verify(dashboardLogger, never()).onIslDown(eq(reference), any());
service.bfdStatusUpdate(endpointBeta2, reference, BfdStatusUpdate.DOWN);
// both BFD session are down
verify(dashboardLogger).onIslDown(eq(reference), any());
reset(dashboardLogger);
service.bfdStatusUpdate(endpointAlpha1, reference, BfdStatusUpdate.UP);
// one BFD session enough to raise ISL UP
verify(dashboardLogger).onIslUp(eq(reference), any());
verifyNoMoreInteractions(dashboardLogger);
reset(dashboardLogger);
service.bfdStatusUpdate(endpointAlpha1, reference, BfdStatusUpdate.DOWN);
// both BFD session are down (again)
verify(dashboardLogger).onIslDown(eq(reference), any());
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method initialUp.
@Test
@Ignore("incomplete")
public void initialUp() {
persistenceManager = InMemoryGraphPersistenceManager.newInstance();
persistenceManager.install();
emulateEmptyPersistentDb();
SwitchRepository switchRepository = persistenceManager.getRepositoryFactory().createSwitchRepository();
Switch swA = Switch.builder().switchId(endpointAlpha1.getDatapath()).description("alpha").build();
switchRepository.add(swA);
switchPropertiesRepository.add(SwitchProperties.builder().multiTable(false).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).switchObj(swA).build());
Switch swB = Switch.builder().switchId(endpointBeta2.getDatapath()).description("alpha").build();
switchRepository.add(swB);
switchPropertiesRepository.add(SwitchProperties.builder().multiTable(false).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).switchObj(swB).build());
IslReference ref = new IslReference(endpointAlpha1, endpointBeta2);
IslDataHolder islData = new IslDataHolder(1000, 1000, 1000);
service = new NetworkIslService(carrier, persistenceManager, options);
service.islUp(ref.getSource(), ref, islData);
System.out.println(mockingDetails(carrier).printInvocations());
System.out.println(mockingDetails(islRepository).printInvocations());
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method prepareActiveIsl.
private IslReference prepareActiveIsl(boolean isMultitable) {
// prepare data
final Isl islAlphaBeta = makeIsl(endpointAlpha1, endpointBeta2, isMultitable).build();
final Isl islBetaAlpha = makeIsl(endpointBeta2, endpointAlpha1, isMultitable).build();
// setup alpha -> beta half
IslReference reference = new IslReference(endpointAlpha1, endpointBeta2);
service.islUp(endpointAlpha1, reference, new IslDataHolder(islAlphaBeta));
verifyNoMoreInteractions(dashboardLogger);
// setup beta -> alpha half
service.islUp(endpointBeta2, reference, new IslDataHolder(islBetaAlpha));
if (isMultitable) {
service.islDefaultRuleInstalled(reference, new InstallIslDefaultRulesResult(endpointAlpha1.getDatapath(), endpointAlpha1.getPortNumber(), endpointBeta2.getDatapath(), endpointBeta2.getPortNumber(), true));
service.islDefaultRuleInstalled(reference, new InstallIslDefaultRulesResult(endpointBeta2.getDatapath(), endpointBeta2.getPortNumber(), endpointAlpha1.getDatapath(), endpointAlpha1.getPortNumber(), true));
}
verify(dashboardLogger).onIslUp(eq(reference), any());
reset(dashboardLogger);
reset(carrier);
return reference;
}
Aggregations