Search in sources :

Example 6 with IslReference

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);
}
Also used : Isl(org.openkilda.model.Isl) IslReference(org.openkilda.wfm.share.model.IslReference) Instant(java.time.Instant)

Example 7 with IslReference

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);
}
Also used : IslReference(org.openkilda.wfm.share.model.IslReference) Test(org.junit.Test)

Example 8 with IslReference

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);
}
Also used : IslReference(org.openkilda.wfm.share.model.IslReference) RoundTripStatus(org.openkilda.wfm.topology.network.model.RoundTripStatus) Test(org.junit.Test)

Example 9 with IslReference

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());
}
Also used : IslReference(org.openkilda.wfm.share.model.IslReference) SwitchId(org.openkilda.model.SwitchId) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder) Test(org.junit.Test)

Example 10 with IslReference

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);
}
Also used : IslReference(org.openkilda.wfm.share.model.IslReference) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder) Test(org.junit.Test)

Aggregations

IslReference (org.openkilda.wfm.share.model.IslReference)50 Test (org.junit.Test)30 IslDataHolder (org.openkilda.wfm.topology.network.model.IslDataHolder)16 Isl (org.openkilda.model.Isl)13 RoundTripStatus (org.openkilda.wfm.topology.network.model.RoundTripStatus)10 Endpoint (org.openkilda.wfm.share.model.Endpoint)8 Instant (java.time.Instant)4 Values (org.apache.storm.tuple.Values)4 RemoveIslDefaultRulesResult (org.openkilda.messaging.info.discovery.RemoveIslDefaultRulesResult)4 Ignore (org.junit.Ignore)3 Switch (org.openkilda.model.Switch)3 Duration (java.time.Duration)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 AllArgsConstructor (lombok.AllArgsConstructor)2 EqualsAndHashCode (lombok.EqualsAndHashCode)2