use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method testBfdStatusReset.
private void testBfdStatusReset(BfdSessionStatus initialStatus) {
setupIslStorageStub();
final Instant start = clock.adjust(Duration.ofSeconds(1));
Isl alphaToBeta = makeIsl(endpointAlpha1, endpointBeta2, false).bfdSessionStatus(initialStatus).build();
islStorage.save(alphaToBeta);
islStorage.save(makeIsl(endpointBeta2, endpointAlpha1, false).bfdSessionStatus(initialStatus).build());
clock.adjust(Duration.ofSeconds(1));
IslReference reference = new IslReference(endpointAlpha1, endpointBeta2);
service.islSetupFromHistory(reference.getSource(), reference, alphaToBeta);
Optional<Isl> potential = islStorage.lookup(reference.getSource(), reference.getDest());
Assert.assertTrue(potential.isPresent());
Isl link = potential.get();
Assert.assertNull(link.getBfdSessionStatus());
potential = islStorage.lookup(reference.getDest(), reference.getSource());
Assert.assertTrue(potential.isPresent());
link = potential.get();
Assert.assertNull(link.getBfdSessionStatus());
service.bfdStatusUpdate(reference.getSource(), reference, BfdStatusUpdate.UP);
verifyBfdStatus(reference, BfdSessionStatus.UP, null);
service.bfdStatusUpdate(reference.getDest(), reference, BfdStatusUpdate.UP);
verifyBfdStatus(reference, BfdSessionStatus.UP, BfdSessionStatus.UP);
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method noResurrectOnBfdUp.
@Test
public void noResurrectOnBfdUp() {
IslReference reference = prepareResurrection();
service.bfdStatusUpdate(reference.getSource(), reference, BfdStatusUpdate.UP);
testResurrection(reference, false);
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method roundTripDiscoveryOnDestResetPortDownStatus.
@Test
public void roundTripDiscoveryOnDestResetPortDownStatus() {
IslReference reference = preparePortDownStatusReset();
service.roundTripStatusNotification(reference, new RoundTripStatus(reference.getDest(), IslStatus.ACTIVE));
verifyNoMoreInteractions(dashboardLogger);
service.roundTripStatusNotification(reference, new RoundTripStatus(reference.getDest(), IslStatus.ACTIVE));
verify(dashboardLogger).onIslUp(eq(reference), any());
verifyNoMoreInteractions(dashboardLogger);
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method repeatOnTransientDbErrors.
@Test
public void repeatOnTransientDbErrors() {
mockPersistenceIsl(endpointAlpha1, endpointBeta2, null);
mockPersistenceIsl(endpointBeta2, endpointAlpha1, null);
mockPersistenceLinkProps(endpointAlpha1, endpointBeta2, null);
mockPersistenceLinkProps(endpointBeta2, endpointAlpha1, null);
mockPersistenceBandwidthAllocation(endpointAlpha1, endpointBeta2, 0);
mockPersistenceBandwidthAllocation(endpointBeta2, endpointAlpha1, 0);
/*TODO: reimplement with new datamodel
doThrow(new PersistenceException("force createOrUpdate to fail"))
.when(islRepository)
.add(argThat(
link -> endpointAlpha1.getDatapath().equals(link.getSrcSwitchId())
&& Objects.equals(endpointAlpha1.getPortNumber(), link.getSrcPort())));*/
IslReference reference = new IslReference(endpointAlpha1, endpointBeta2);
service.islUp(endpointAlpha1, reference, new IslDataHolder(100, 1, 100));
assertEquals(new SwitchId(1), endpointAlpha1.getDatapath());
assertEquals(1, endpointAlpha1.getPortNumber());
}
use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.
the class NetworkIslServiceTest method pollDiscoveryResetsPortDownStatus.
@Test
public void pollDiscoveryResetsPortDownStatus() {
IslReference reference = preparePortDownStatusReset();
// only destination endpoint status is cleaned
verifyZeroInteractions(dashboardLogger);
service.islUp(reference.getSource(), reference, new IslDataHolder(100, 100, 100));
// only destination endpoint status is cleaned
verifyZeroInteractions(dashboardLogger);
service.islUp(reference.getDest(), reference, new IslDataHolder(100, 100, 100));
verify(dashboardLogger).onIslUp(eq(reference), any());
verifyNoMoreInteractions(dashboardLogger);
}
Aggregations