Search in sources :

Example 11 with IslReference

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

Example 12 with IslReference

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

Example 13 with IslReference

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

Example 14 with IslReference

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

Example 15 with IslReference

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;
}
Also used : Isl(org.openkilda.model.Isl) IslReference(org.openkilda.wfm.share.model.IslReference) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder) InstallIslDefaultRulesResult(org.openkilda.messaging.info.discovery.InstallIslDefaultRulesResult)

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