Search in sources :

Example 6 with IslDataHolder

use of org.openkilda.wfm.topology.network.model.IslDataHolder 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)

Example 7 with IslDataHolder

use of org.openkilda.wfm.topology.network.model.IslDataHolder in project open-kilda by telstra.

the class NetworkIslServiceTest method considerLinkPropsDataOnCreate.

@Test
public void considerLinkPropsDataOnCreate() {
    setupIslStorageStub();
    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.islUp(endpointAlpha1, reference, new IslDataHolder(200L, 200L, 200L));
    service.islUp(endpointBeta2, reference, new IslDataHolder(200L, 200L, 200L));
    verifyIslBandwidthUpdate(50L, 200L);
}
Also used : IslReference(org.openkilda.wfm.share.model.IslReference) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder) Test(org.junit.Test)

Example 8 with IslDataHolder

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

Example 9 with IslDataHolder

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

Example 10 with IslDataHolder

use of org.openkilda.wfm.topology.network.model.IslDataHolder in project open-kilda by telstra.

the class NetworkUniIslServiceTest method fromUnknownToUpAndDiscoveryWithMove.

@Test
public void fromUnknownToUpAndDiscoveryWithMove() {
    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();
    Isl islA1toB3 = Isl.builder().srcSwitch(alphaSwitch).srcPort(1).destSwitch(betaSwitch).destPort(3).build();
    service.uniIslSetup(endpoint1, null);
    resetMocks();
    IslInfoData disco1 = IslMapper.INSTANCE.map(islA1toB1);
    IslInfoData disco2 = IslMapper.INSTANCE.map(islA1toB3);
    service.uniIslDiscovery(endpoint1, disco1);
    service.uniIslDiscovery(endpoint1, disco2);
    // System.out.println(mockingDetails(carrier).printInvocations());
    verify(carrier).notifyIslUp(endpoint1, IslReference.of(islA1toB1), new IslDataHolder(islA1toB1));
    verify(carrier).notifyIslMove(endpoint1, IslReference.of(islA1toB1));
    verify(carrier).notifyIslUp(endpoint1, IslReference.of(islA1toB3), new IslDataHolder(islA1toB3));
}
Also used : Isl(org.openkilda.model.Isl) Endpoint(org.openkilda.wfm.share.model.Endpoint) Switch(org.openkilda.model.Switch) IslInfoData(org.openkilda.messaging.info.event.IslInfoData) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder) Test(org.junit.Test)

Aggregations

IslDataHolder (org.openkilda.wfm.topology.network.model.IslDataHolder)20 Test (org.junit.Test)15 IslReference (org.openkilda.wfm.share.model.IslReference)15 Isl (org.openkilda.model.Isl)9 Endpoint (org.openkilda.wfm.share.model.Endpoint)7 Switch (org.openkilda.model.Switch)3 Ignore (org.junit.Ignore)2 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)2 Duration (java.time.Duration)1 Instant (java.time.Instant)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 AllArgsConstructor (lombok.AllArgsConstructor)1 EqualsAndHashCode (lombok.EqualsAndHashCode)1 Getter (lombok.Getter)1 Failsafe (net.jodah.failsafe.Failsafe)1