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());
}
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);
}
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());
}
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);
}
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());
}
Aggregations