Search in sources :

Example 56 with Isl

use of org.openkilda.model.Isl 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 57 with Isl

use of org.openkilda.model.Isl 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 58 with Isl

use of org.openkilda.model.Isl 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)

Example 59 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class NetworkUniIslServiceTest method shouldProxyRoundTripStatus.

@Test
public void shouldProxyRoundTripStatus() {
    final NetworkUniIslService service = new NetworkUniIslService(carrier);
    final Endpoint endpointAlpha = Endpoint.of(alphaDatapath, 1);
    final Endpoint endpointBeta = Endpoint.of(betaDatapath, 1);
    service.uniIslSetup(endpointAlpha, null);
    Switch alphaSwitch = Switch.builder().switchId(endpointAlpha.getDatapath()).build();
    Switch betaSwitch = Switch.builder().switchId(endpointBeta.getDatapath()).build();
    Isl islA1toB1 = Isl.builder().srcSwitch(alphaSwitch).srcPort(endpointAlpha.getPortNumber()).destSwitch(betaSwitch).destPort(endpointBeta.getPortNumber()).build();
    IslInfoData discovery = IslMapper.INSTANCE.map(islA1toB1);
    service.uniIslDiscovery(endpointAlpha, discovery);
    verifyProxyRoundTripStatus(service, endpointAlpha, endpointBeta);
    service.uniIslPhysicalDown(endpointAlpha);
    verifyProxyRoundTripStatus(service, endpointAlpha, endpointBeta);
    service.uniIslDiscovery(endpointAlpha, discovery);
    verifyProxyRoundTripStatus(service, endpointAlpha, endpointBeta);
}
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) Test(org.junit.Test)

Example 60 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class NetworkUniIslServiceTest method selfLoopWhenDownAndRemoteIsNotSet.

@Test
public void selfLoopWhenDownAndRemoteIsNotSet() {
    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);
    // fail
    service.uniIslPhysicalDown(endpointAlpha1);
    verify(carrier).exhaustedPollModeUpdateRequest(endpointAlpha1, true);
    verifyNoMoreInteractions(carrier);
    // discovery (self-loop)
    Isl selfLoopIsl = makeIslBuilder(endpointAlpha1, endpointAlpha2).build();
    service.uniIslDiscovery(endpointAlpha1, IslMapper.INSTANCE.map(selfLoopIsl));
    verify(carrier).exhaustedPollModeUpdateRequest(endpointAlpha1, true);
    verifyNoMoreInteractions(carrier);
    // ensure following discovery will be processed
    verifyIslCanBeDiscovered(service, makeIslBuilder(endpointAlpha1, endpointBeta3).build());
}
Also used : Isl(org.openkilda.model.Isl) Endpoint(org.openkilda.wfm.share.model.Endpoint) Test(org.junit.Test)

Aggregations

Isl (org.openkilda.model.Isl)83 Test (org.junit.Test)49 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)25 Endpoint (org.openkilda.wfm.share.model.Endpoint)18 Switch (org.openkilda.model.Switch)17 IslReference (org.openkilda.wfm.share.model.IslReference)11 SwitchId (org.openkilda.model.SwitchId)10 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)9 IslDataHolder (org.openkilda.wfm.topology.network.model.IslDataHolder)8 ArrayList (java.util.ArrayList)6 PathId (org.openkilda.model.PathId)6 Flow (org.openkilda.model.Flow)5 IslRepository (org.openkilda.persistence.repositories.IslRepository)5 Collection (java.util.Collection)4 HashMap (java.util.HashMap)4 List (java.util.List)4 Map (java.util.Map)4 FlowPath (org.openkilda.model.FlowPath)4 PersistenceException (org.openkilda.persistence.exceptions.PersistenceException)4 IslFrame (org.openkilda.persistence.ferma.frames.IslFrame)4