Search in sources :

Example 31 with Isl

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

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

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

the class NetworkUniIslServiceTest method fromUptoBfdToUp.

@Test
public void fromUptoBfdToUp() {
    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);
    resetMocks();
    service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.UP);
    service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.KILL);
    // System.out.println(mockingDetails(carrier).printInvocations());
    InOrder order = inOrder(carrier);
    order.verify(carrier).notifyBfdStatus(endpoint1, IslReference.of(islA1toB1), BfdStatusUpdate.UP);
    order.verify(carrier).notifyBfdStatus(endpoint1, IslReference.of(islA1toB1), BfdStatusUpdate.KILL);
}
Also used : Isl(org.openkilda.model.Isl) InOrder(org.mockito.InOrder) Endpoint(org.openkilda.wfm.share.model.Endpoint) Switch(org.openkilda.model.Switch) IslInfoData(org.openkilda.messaging.info.event.IslInfoData) Test(org.junit.Test)

Example 34 with Isl

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

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

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