Search in sources :

Example 26 with Endpoint

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

Example 27 with Endpoint

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

the class NetworkUniIslServiceTest method selfLoopWhenUnknown.

@Test
public void selfLoopWhenUnknown() {
    NetworkUniIslService service = new NetworkUniIslService(carrier);
    Endpoint endpointA = Endpoint.of(alphaDatapath, 1);
    Endpoint endpointZ = Endpoint.of(alphaDatapath, 2);
    service.uniIslSetup(endpointA, null);
    verifyNoMoreInteractions(carrier);
    Isl selfLoopIsl = makeIslBuilder(endpointA, endpointZ).build();
    service.uniIslDiscovery(endpointA, IslMapper.INSTANCE.map(selfLoopIsl));
    verifyNoMoreInteractions(carrier);
    // ensure following discovery will be processed
    Endpoint endpointBeta3 = Endpoint.of(betaDatapath, 3);
    verifyIslCanBeDiscovered(service, makeIslBuilder(endpointA, endpointBeta3).build());
}
Also used : Isl(org.openkilda.model.Isl) Endpoint(org.openkilda.wfm.share.model.Endpoint) Test(org.junit.Test)

Example 28 with Endpoint

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

the class NetworkUniIslServiceTest method newIslFromUnknownToDownToUp.

@Test
public void newIslFromUnknownToDownToUp() {
    NetworkUniIslService service = new NetworkUniIslService(carrier);
    Endpoint endpoint1 = Endpoint.of(alphaDatapath, 1);
    Endpoint endpoint2 = Endpoint.of(alphaDatapath, 2);
    Switch alphaSwitch = Switch.builder().switchId(alphaDatapath).build();
    Switch betaSwitch = Switch.builder().switchId(betaDatapath).build();
    Isl islAtoB = Isl.builder().srcSwitch(alphaSwitch).srcPort(1).destSwitch(betaSwitch).destPort(1).build();
    Isl islAtoB2 = Isl.builder().srcSwitch(alphaSwitch).srcPort(2).destSwitch(betaSwitch).destPort(2).build();
    Isl islAtoB3 = Isl.builder().srcSwitch(alphaSwitch).srcPort(1).destSwitch(betaSwitch).destPort(3).build();
    service.uniIslSetup(endpoint1, islAtoB);
    service.uniIslSetup(endpoint2, null);
    service.uniIslFail(endpoint1);
    service.uniIslPhysicalDown(endpoint2);
    resetMocks();
    IslInfoData disco1 = IslMapper.INSTANCE.map(islAtoB3);
    IslInfoData disco2 = IslMapper.INSTANCE.map(islAtoB2);
    service.uniIslDiscovery(endpoint1, disco1);
    service.uniIslDiscovery(endpoint2, disco2);
    System.out.println(mockingDetails(carrier).printInvocations());
    verify(carrier).notifyIslMove(endpoint1, IslReference.of(islAtoB));
    verify(carrier).notifyIslUp(endpoint1, IslReference.of(islAtoB3), new IslDataHolder(islAtoB2));
    verify(carrier).notifyIslUp(endpoint2, IslReference.of(islAtoB2), new IslDataHolder(islAtoB2));
}
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)

Example 29 with Endpoint

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

the class NetworkUniIslServiceTest method fromDownToBfd.

@Test
public void fromDownToBfd() {
    NetworkUniIslService service = new NetworkUniIslService(carrier);
    Endpoint endpoint = Endpoint.of(alphaDatapath, 1);
    Endpoint remote = Endpoint.of(betaDatapath, 2);
    Isl link = Isl.builder().srcSwitch(Switch.builder().switchId(endpoint.getDatapath()).build()).srcPort(endpoint.getPortNumber()).destPort(remote.getPortNumber()).destSwitch(Switch.builder().switchId(remote.getDatapath()).build()).build();
    service.uniIslSetup(endpoint, link);
    service.uniIslPhysicalDown(endpoint);
    resetMocks();
    service.uniIslBfdStatusUpdate(endpoint, BfdStatusUpdate.UP);
    // System.out.println(mockingDetails(carrier).printInvocations());
    verify(carrier).notifyBfdStatus(endpoint, IslReference.of(link), BfdStatusUpdate.UP);
}
Also used : Isl(org.openkilda.model.Isl) Endpoint(org.openkilda.wfm.share.model.Endpoint) Test(org.junit.Test)

Example 30 with Endpoint

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

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