Search in sources :

Example 1 with IslDataHolder

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

the class DiscoveryPollMonitor method actualFlush.

@Override
protected void actualFlush(Endpoint endpoint, Isl persistentView) {
    IslEndpointPollStatus pollStatus = discoveryData.get(endpoint);
    IslDataHolder islData = makeAggregatedIslData(pollStatus.getIslData(), discoveryData.get(reference.getOpposite(endpoint)).getIslData());
    if (islData == null) {
        log.error("There is no ISL data available for {}, unable to calculate available_bandwidth", reference);
    } else {
        persistentView.setSpeed(islData.getSpeed());
        persistentView.setMaxBandwidth(islData.getMaximumBandwidth());
        persistentView.setDefaultMaxBandwidth(islData.getEffectiveMaximumBandwidth());
    }
    persistentView.setActualStatus(pollStatus.getStatus());
}
Also used : IslEndpointPollStatus(org.openkilda.wfm.topology.network.model.IslEndpointPollStatus) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder)

Example 2 with IslDataHolder

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

the class NetworkUniIslService method uniIslDiscovery.

/**
 * .
 */
public void uniIslDiscovery(Endpoint endpoint, IslInfoData speakerDiscoveryEvent) {
    log.debug("Uni-ISL service receive DISCOVERED notification for {}", endpoint);
    IslReference reference = lookupEndpointData(endpoint);
    IslReference effectiveReference = IslReference.of(speakerDiscoveryEvent);
    IslDataHolder islData = new IslDataHolder(speakerDiscoveryEvent);
    if (isIslReferenceUsable(reference)) {
        if (reference.equals(effectiveReference)) {
            carrier.notifyIslUp(endpoint, reference, islData);
            return;
        }
        carrier.notifyIslMove(endpoint, reference);
    }
    if (!effectiveReference.isSelfLoop()) {
        carrier.notifyIslUp(endpoint, effectiveReference, islData);
        carrier.exhaustedPollModeUpdateRequest(endpoint, false);
    } else {
        log.error("Self looped ISL discovery received: {}", effectiveReference);
    }
    endpointData.put(endpoint, effectiveReference);
}
Also used : IslReference(org.openkilda.wfm.share.model.IslReference) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder)

Example 3 with IslDataHolder

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

the class NetworkIslServiceTest method repeatOnTransientDbErrors.

@Test
public void repeatOnTransientDbErrors() {
    mockPersistenceIsl(endpointAlpha1, endpointBeta2, null);
    mockPersistenceIsl(endpointBeta2, endpointAlpha1, null);
    mockPersistenceLinkProps(endpointAlpha1, endpointBeta2, null);
    mockPersistenceLinkProps(endpointBeta2, endpointAlpha1, null);
    mockPersistenceBandwidthAllocation(endpointAlpha1, endpointBeta2, 0);
    mockPersistenceBandwidthAllocation(endpointBeta2, endpointAlpha1, 0);
    /*TODO: reimplement with new datamodel
           doThrow(new PersistenceException("force createOrUpdate to fail"))
                .when(islRepository)
                .add(argThat(
                        link -> endpointAlpha1.getDatapath().equals(link.getSrcSwitchId())
                                && Objects.equals(endpointAlpha1.getPortNumber(), link.getSrcPort())));*/
    IslReference reference = new IslReference(endpointAlpha1, endpointBeta2);
    service.islUp(endpointAlpha1, reference, new IslDataHolder(100, 1, 100));
    assertEquals(new SwitchId(1), endpointAlpha1.getDatapath());
    assertEquals(1, endpointAlpha1.getPortNumber());
}
Also used : IslReference(org.openkilda.wfm.share.model.IslReference) SwitchId(org.openkilda.model.SwitchId) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder) Test(org.junit.Test)

Example 4 with IslDataHolder

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

the class NetworkIslServiceTest method pollDiscoveryResetsPortDownStatus.

@Test
public void pollDiscoveryResetsPortDownStatus() {
    IslReference reference = preparePortDownStatusReset();
    // only destination endpoint status is cleaned
    verifyZeroInteractions(dashboardLogger);
    service.islUp(reference.getSource(), reference, new IslDataHolder(100, 100, 100));
    // only destination endpoint status is cleaned
    verifyZeroInteractions(dashboardLogger);
    service.islUp(reference.getDest(), reference, new IslDataHolder(100, 100, 100));
    verify(dashboardLogger).onIslUp(eq(reference), any());
    verifyNoMoreInteractions(dashboardLogger);
}
Also used : IslReference(org.openkilda.wfm.share.model.IslReference) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder) Test(org.junit.Test)

Example 5 with IslDataHolder

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

the class NetworkIslServiceTest method initialUp.

@Test
@Ignore("incomplete")
public void initialUp() {
    persistenceManager = InMemoryGraphPersistenceManager.newInstance();
    persistenceManager.install();
    emulateEmptyPersistentDb();
    SwitchRepository switchRepository = persistenceManager.getRepositoryFactory().createSwitchRepository();
    Switch swA = Switch.builder().switchId(endpointAlpha1.getDatapath()).description("alpha").build();
    switchRepository.add(swA);
    switchPropertiesRepository.add(SwitchProperties.builder().multiTable(false).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).switchObj(swA).build());
    Switch swB = Switch.builder().switchId(endpointBeta2.getDatapath()).description("alpha").build();
    switchRepository.add(swB);
    switchPropertiesRepository.add(SwitchProperties.builder().multiTable(false).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).switchObj(swB).build());
    IslReference ref = new IslReference(endpointAlpha1, endpointBeta2);
    IslDataHolder islData = new IslDataHolder(1000, 1000, 1000);
    service = new NetworkIslService(carrier, persistenceManager, options);
    service.islUp(ref.getSource(), ref, islData);
    System.out.println(mockingDetails(carrier).printInvocations());
    System.out.println(mockingDetails(islRepository).printInvocations());
}
Also used : Switch(org.openkilda.model.Switch) IslReference(org.openkilda.wfm.share.model.IslReference) SwitchRepository(org.openkilda.persistence.repositories.SwitchRepository) IslDataHolder(org.openkilda.wfm.topology.network.model.IslDataHolder) Ignore(org.junit.Ignore) 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