Search in sources :

Example 21 with IslReference

use of org.openkilda.wfm.share.model.IslReference 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 22 with IslReference

use of org.openkilda.wfm.share.model.IslReference 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 23 with IslReference

use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.

the class NetworkIslServiceTest method prepareAndPerformDelete.

private void prepareAndPerformDelete(IslStatus initialStatus, boolean multiTable) {
    Isl islAlphaBeta = makeIsl(endpointAlpha1, endpointBeta2, multiTable).actualStatus(initialStatus).status(initialStatus).build();
    Isl islBetaAlpha = makeIsl(endpointBeta2, endpointAlpha1, multiTable).actualStatus(initialStatus).status(initialStatus).build();
    // prepare
    islStorage.save(islAlphaBeta);
    islStorage.save(islBetaAlpha);
    mockPersistenceLinkProps(endpointAlpha1, endpointBeta2, null);
    mockPersistenceLinkProps(endpointBeta2, endpointAlpha1, null);
    mockPersistenceBandwidthAllocation(endpointAlpha1, endpointBeta2, 0);
    mockPersistenceBandwidthAllocation(endpointBeta2, endpointAlpha1, 0);
    IslReference reference = new IslReference(endpointAlpha1, endpointBeta2);
    service.islSetupFromHistory(endpointAlpha1, reference, islAlphaBeta);
    reset(carrier);
    // remove
    service.remove(reference);
    if (multiTable && (initialStatus == IslStatus.INACTIVE || initialStatus == IslStatus.MOVED)) {
        service.islDefaultRuleDeleted(reference, new RemoveIslDefaultRulesResult(endpointAlpha1.getDatapath(), endpointAlpha1.getPortNumber(), endpointBeta2.getDatapath(), endpointBeta2.getPortNumber(), true));
        service.islDefaultRuleDeleted(reference, new RemoveIslDefaultRulesResult(endpointBeta2.getDatapath(), endpointBeta2.getPortNumber(), endpointAlpha1.getDatapath(), endpointAlpha1.getPortNumber(), true));
        verify(carrier).islDefaultRulesDelete(endpointAlpha1, endpointBeta2);
        verify(carrier).islDefaultRulesDelete(endpointBeta2, endpointAlpha1);
    }
}
Also used : Isl(org.openkilda.model.Isl) IslReference(org.openkilda.wfm.share.model.IslReference) RemoveIslDefaultRulesResult(org.openkilda.messaging.info.discovery.RemoveIslDefaultRulesResult)

Example 24 with IslReference

use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.

the class NetworkUniIslServiceTest method fromUptoBfdToDown.

@Test
public void fromUptoBfdToDown() {
    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();
    service.uniIslSetup(endpoint1, islA1toB1);
    IslInfoData disco1 = IslMapper.INSTANCE.map(islA1toB1);
    service.uniIslDiscovery(endpoint1, disco1);
    service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.UP);
    resetMocks();
    service.uniIslPhysicalDown(endpoint1);
    service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.UP);
    service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.DOWN);
    service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.UP);
    // System.out.println(mockingDetails(carrier).printInvocations());
    InOrder order = inOrder(carrier);
    IslReference reference = IslReference.of(islA1toB1);
    order.verify(carrier).notifyIslDown(endpoint1, reference, IslDownReason.PORT_DOWN);
    order.verify(carrier).notifyBfdStatus(endpoint1, reference, BfdStatusUpdate.UP);
    order.verify(carrier).notifyBfdStatus(endpoint1, reference, BfdStatusUpdate.DOWN);
    order.verify(carrier).notifyBfdStatus(endpoint1, reference, BfdStatusUpdate.UP);
}
Also used : Isl(org.openkilda.model.Isl) InOrder(org.mockito.InOrder) Endpoint(org.openkilda.wfm.share.model.Endpoint) Switch(org.openkilda.model.Switch) IslReference(org.openkilda.wfm.share.model.IslReference) IslInfoData(org.openkilda.messaging.info.event.IslInfoData) Test(org.junit.Test)

Example 25 with IslReference

use of org.openkilda.wfm.share.model.IslReference in project open-kilda by telstra.

the class NetworkUniIslServiceTest method verifyIslCanBeDiscovered.

private void verifyIslCanBeDiscovered(NetworkUniIslService service, Isl link) {
    Endpoint endpointA = Endpoint.of(link.getSrcSwitchId(), link.getSrcPort());
    Endpoint endpointZ = Endpoint.of(link.getDestSwitchId(), link.getDestPort());
    service.uniIslDiscovery(endpointA, IslMapper.INSTANCE.map(link));
    verify(carrier).notifyIslUp(endpointA, new IslReference(endpointA, endpointZ), new IslDataHolder(link));
    verify(carrier).exhaustedPollModeUpdateRequest(endpointA, false);
    verifyNoMoreInteractions(carrier);
    reset(carrier);
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) IslReference(org.openkilda.wfm.share.model.IslReference) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder)

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