Search in sources :

Example 16 with IslDataHolder

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

the class NetworkIslServiceTest method considerLinkPropsDataOnRediscovery.

@Test
public void considerLinkPropsDataOnRediscovery() {
    setupIslStorageStub();
    final Isl islAlphaBeta = makeIsl(endpointAlpha1, endpointBeta2, false).defaultMaxBandwidth(300L).availableBandwidth(300L).build();
    final Isl islBetaAlpha = makeIsl(endpointBeta2, endpointAlpha1, false).defaultMaxBandwidth(300L).availableBandwidth(300L).build();
    // initial discovery
    mockPersistenceLinkProps(endpointAlpha1, endpointBeta2, null);
    mockPersistenceLinkProps(endpointBeta2, endpointAlpha1, null);
    IslReference reference = new IslReference(endpointAlpha1, endpointBeta2);
    service.islUp(endpointAlpha1, reference, new IslDataHolder(300L, 300L, 300L));
    service.islUp(endpointBeta2, reference, new IslDataHolder(300L, 300L, 300L));
    verifyIslBandwidthUpdate(300L, 300L);
    // fail
    service.islDown(endpointAlpha1, reference, IslDownReason.POLL_TIMEOUT);
    service.islDown(endpointBeta2, reference, IslDownReason.POLL_TIMEOUT);
    reset(linkPropsRepository);
    // rediscovery
    mockPersistenceLinkProps(endpointAlpha1, endpointBeta2, makeLinkProps(endpointAlpha1, endpointBeta2).maxBandwidth(50L).build());
    mockPersistenceLinkProps(endpointBeta2, endpointAlpha1, null);
    service.islUp(endpointAlpha1, reference, new IslDataHolder(300L, 300L, 300L));
    service.islUp(endpointBeta2, reference, new IslDataHolder(300L, 300L, 300L));
    verifyIslBandwidthUpdate(50L, 300L);
}
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 17 with IslDataHolder

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

the class NetworkIslServiceTest method bfdUpOverriderPollDown.

@Test
public void bfdUpOverriderPollDown() {
    setupIslStorageStub();
    IslReference reference = prepareBfdEnabledIsl();
    reset(dashboardLogger);
    service.islDown(reference.getSource(), reference, IslDownReason.POLL_TIMEOUT);
    verifyNoMoreInteractions(dashboardLogger);
    service.islUp(reference.getSource(), reference, new IslDataHolder(100, 100, 100));
    verifyNoMoreInteractions(dashboardLogger);
    service.bfdStatusUpdate(reference.getSource(), reference, BfdStatusUpdate.DOWN);
    service.bfdStatusUpdate(reference.getDest(), reference, BfdStatusUpdate.DOWN);
    // from poll point of view ISL is UP but BFD must force status to DOWN
    verify(dashboardLogger).onIslDown(eq(reference), any());
}
Also used : IslReference(org.openkilda.wfm.share.model.IslReference) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder) Test(org.junit.Test)

Example 18 with IslDataHolder

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

the class NetworkUniIslServiceTest method replugIntoSelfLoop.

@Test
public void replugIntoSelfLoop() {
    NetworkUniIslService service = new NetworkUniIslService(carrier);
    Endpoint endpointA = Endpoint.of(alphaDatapath, 1);
    Endpoint endpointZ = Endpoint.of(betaDatapath, 2);
    verifyNoMoreInteractions(carrier);
    service.uniIslSetup(endpointA, null);
    Isl genericIsl = makeIslBuilder(endpointA, endpointZ).build();
    IslInfoData genericData = IslMapper.INSTANCE.map(genericIsl);
    service.uniIslDiscovery(endpointA, genericData);
    verify(carrier).notifyIslUp(eq(endpointA), eq(IslReference.of(genericIsl)), eq(new IslDataHolder(genericData)));
    // replug into self-loop
    Isl selfLoopIsl = makeIslBuilder(endpointA, Endpoint.of(endpointA.getDatapath(), endpointA.getPortNumber() + 1)).build();
    IslInfoData selfLoopData = IslMapper.INSTANCE.map((selfLoopIsl));
    service.uniIslDiscovery(endpointA, selfLoopData);
    verify(carrier, times(1)).notifyIslMove(eq(endpointA), eq(IslReference.of(genericIsl)));
    verify(carrier, times(0)).notifyIslUp(eq(endpointA), eq(IslReference.of(selfLoopIsl)), eq(new IslDataHolder(selfLoopData)));
    service.uniIslDiscovery(endpointA, selfLoopData);
    // no new move events and no discovery notifications for self-looped ISL
    verify(carrier, times(1)).notifyIslMove(eq(endpointA), eq(IslReference.of(genericIsl)));
    verify(carrier, times(0)).notifyIslUp(eq(endpointA), eq(IslReference.of(selfLoopIsl)), eq(new IslDataHolder(selfLoopData)));
}
Also used : Isl(org.openkilda.model.Isl) Endpoint(org.openkilda.wfm.share.model.Endpoint) IslInfoData(org.openkilda.messaging.info.event.IslInfoData) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder) Test(org.junit.Test)

Example 19 with IslDataHolder

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

the class NetworkUniIslServiceTest method selfLoopWhenUp.

@Test
public void selfLoopWhenUp() {
    NetworkUniIslService service = new NetworkUniIslService(carrier);
    final Endpoint endpointAlpha1 = Endpoint.of(alphaDatapath, 1);
    final Endpoint endpointAlpha2 = Endpoint.of(alphaDatapath, 2);
    final Endpoint endpointBeta3 = Endpoint.of(betaDatapath, 3);
    // setup
    service.uniIslSetup(endpointAlpha1, null);
    verifyNoMoreInteractions(carrier);
    // initial (normal) discovery
    Isl normalIsl = makeIslBuilder(endpointAlpha1, endpointBeta3).build();
    service.uniIslDiscovery(endpointAlpha1, IslMapper.INSTANCE.map(normalIsl));
    verify(carrier).notifyIslUp(endpointAlpha1, new IslReference(endpointAlpha1, endpointBeta3), new IslDataHolder(normalIsl));
    verify(carrier).exhaustedPollModeUpdateRequest(endpointAlpha1, false);
    verifyNoMoreInteractions(carrier);
    reset(carrier);
    // self loop must trigger ISL move
    Isl selfLoopIsl = makeIslBuilder(endpointAlpha1, endpointAlpha2).build();
    service.uniIslDiscovery(endpointAlpha1, IslMapper.INSTANCE.map(selfLoopIsl));
    verify(carrier).notifyIslMove(endpointAlpha1, new IslReference(endpointAlpha1, endpointBeta3));
    verifyNoMoreInteractions(carrier);
    reset(carrier);
    // ensure following discovery will be processed
    verifyIslCanBeDiscovered(service, normalIsl);
}
Also used : Isl(org.openkilda.model.Isl) Endpoint(org.openkilda.wfm.share.model.Endpoint) IslReference(org.openkilda.wfm.share.model.IslReference) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder) Test(org.junit.Test)

Example 20 with IslDataHolder

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

the class NetworkUniIslServiceTest method selfLoopWhenDownAndRemoteIsSet.

@Test
public void selfLoopWhenDownAndRemoteIsSet() {
    NetworkUniIslService service = new NetworkUniIslService(carrier);
    final Endpoint endpointAlpha1 = Endpoint.of(alphaDatapath, 1);
    final Endpoint endpointAlpha2 = Endpoint.of(alphaDatapath, 2);
    final Endpoint endpointBeta3 = Endpoint.of(betaDatapath, 3);
    // setup
    service.uniIslSetup(endpointAlpha1, null);
    verifyNoMoreInteractions(carrier);
    // initial (normal) discovery
    Isl normalIsl = makeIslBuilder(endpointAlpha1, endpointBeta3).build();
    service.uniIslDiscovery(endpointAlpha1, IslMapper.INSTANCE.map(normalIsl));
    final IslReference reference = new IslReference(endpointAlpha1, endpointBeta3);
    verify(carrier).notifyIslUp(endpointAlpha1, reference, new IslDataHolder(normalIsl));
    verify(carrier).exhaustedPollModeUpdateRequest(endpointAlpha1, false);
    verifyNoMoreInteractions(carrier);
    reset(carrier);
    // fail
    service.uniIslFail(endpointAlpha1);
    verify(carrier).notifyIslDown(endpointAlpha1, reference, IslDownReason.POLL_TIMEOUT);
    reset(carrier);
    // discovery (self-loop)
    Isl selfLoopIsl = makeIslBuilder(endpointAlpha1, endpointAlpha2).build();
    service.uniIslDiscovery(endpointAlpha1, IslMapper.INSTANCE.map(selfLoopIsl));
    verify(carrier).notifyIslMove(endpointAlpha1, reference);
    verifyNoMoreInteractions(carrier);
    reset(carrier);
    // ensure following discovery will be processed
    verifyIslCanBeDiscovered(service, normalIsl);
}
Also used : Isl(org.openkilda.model.Isl) Endpoint(org.openkilda.wfm.share.model.Endpoint) IslReference(org.openkilda.wfm.share.model.IslReference) 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