Search in sources :

Example 56 with Endpoint

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

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

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

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

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

the class NetworkUniIslServiceTest method newIslFromUnknownToDownNoRemote.

@Test
public void newIslFromUnknownToDownNoRemote() {
    NetworkUniIslService service = new NetworkUniIslService(carrier);
    Endpoint endpoint1 = Endpoint.of(alphaDatapath, 1);
    Endpoint endpoint2 = Endpoint.of(alphaDatapath, 2);
    service.uniIslSetup(endpoint1, null);
    service.uniIslSetup(endpoint2, null);
    service.uniIslFail(endpoint1);
    service.uniIslPhysicalDown(endpoint2);
    System.out.println(mockingDetails(carrier).printInvocations());
    verify(carrier, never()).notifyIslDown(any(Endpoint.class), any(IslReference.class), isA(IslDownReason.class));
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) IslReference(org.openkilda.wfm.share.model.IslReference) IslDownReason(org.openkilda.model.IslDownReason) Test(org.junit.Test)

Aggregations

Endpoint (org.openkilda.wfm.share.model.Endpoint)72 Test (org.junit.Test)33 Isl (org.openkilda.model.Isl)17 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)13 SwitchId (org.openkilda.model.SwitchId)10 Switch (org.openkilda.model.Switch)8 IslReference (org.openkilda.wfm.share.model.IslReference)8 PathNode (org.openkilda.messaging.info.event.PathNode)7 Instant (java.time.Instant)6 IslDataHolder (org.openkilda.wfm.topology.network.model.IslDataHolder)6 HashSet (java.util.HashSet)4 Set (java.util.Set)4 DiscoverIslCommandData (org.openkilda.messaging.command.discovery.DiscoverIslCommandData)4 IslNotFoundException (org.openkilda.wfm.error.IslNotFoundException)4 Values (org.apache.storm.tuple.Values)3 IslRoundTripLatency (org.openkilda.messaging.info.event.IslRoundTripLatency)3 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)3 CommandContext (org.openkilda.wfm.CommandContext)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 HashMap (java.util.HashMap)2