use of org.openkilda.wfm.topology.network.model.IslDataHolder in project open-kilda by telstra.
the class NetworkIslServiceTest method prepareActiveIsl.
private IslReference prepareActiveIsl(boolean isMultitable) {
// prepare data
final Isl islAlphaBeta = makeIsl(endpointAlpha1, endpointBeta2, isMultitable).build();
final Isl islBetaAlpha = makeIsl(endpointBeta2, endpointAlpha1, isMultitable).build();
// setup alpha -> beta half
IslReference reference = new IslReference(endpointAlpha1, endpointBeta2);
service.islUp(endpointAlpha1, reference, new IslDataHolder(islAlphaBeta));
verifyNoMoreInteractions(dashboardLogger);
// setup beta -> alpha half
service.islUp(endpointBeta2, reference, new IslDataHolder(islBetaAlpha));
if (isMultitable) {
service.islDefaultRuleInstalled(reference, new InstallIslDefaultRulesResult(endpointAlpha1.getDatapath(), endpointAlpha1.getPortNumber(), endpointBeta2.getDatapath(), endpointBeta2.getPortNumber(), true));
service.islDefaultRuleInstalled(reference, new InstallIslDefaultRulesResult(endpointBeta2.getDatapath(), endpointBeta2.getPortNumber(), endpointAlpha1.getDatapath(), endpointAlpha1.getPortNumber(), true));
}
verify(dashboardLogger).onIslUp(eq(reference), any());
reset(dashboardLogger);
reset(carrier);
return reference;
}
use of org.openkilda.wfm.topology.network.model.IslDataHolder in project open-kilda by telstra.
the class NetworkIslServiceTest method considerLinkPropsDataOnCreate.
@Test
public void considerLinkPropsDataOnCreate() {
setupIslStorageStub();
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.islUp(endpointAlpha1, reference, new IslDataHolder(200L, 200L, 200L));
service.islUp(endpointBeta2, reference, new IslDataHolder(200L, 200L, 200L));
verifyIslBandwidthUpdate(50L, 200L);
}
use of org.openkilda.wfm.topology.network.model.IslDataHolder 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);
}
use of org.openkilda.wfm.topology.network.model.IslDataHolder in project open-kilda by telstra.
the class NetworkIslServiceTest method considerRecoveryAfterRoundTrip.
@Test
public void considerRecoveryAfterRoundTrip() {
setupIslStorageStub();
final IslReference reference = prepareActiveIsl();
service.roundTripStatusNotification(reference, new RoundTripStatus(reference.getSource(), IslStatus.ACTIVE));
service.islDown(reference.getSource(), reference, IslDownReason.POLL_TIMEOUT);
service.islDown(reference.getDest(), reference, IslDownReason.POLL_TIMEOUT);
// still up because of active round trip discovery
verify(dashboardLogger, times(0)).onIslDown(eq(reference), any());
// restore one-way discovery status
service.islUp(reference.getSource(), reference, new IslDataHolder(200L, 200L, 200L));
service.islUp(reference.getDest(), reference, new IslDataHolder(200L, 200L, 200L));
// remove round trip discovery
service.roundTripStatusNotification(reference, new RoundTripStatus(reference.getSource(), IslStatus.INACTIVE));
// must not fail, because of successful discovery notifications
verify(dashboardLogger, times(0)).onIslDown(eq(reference), any());
}
use of org.openkilda.wfm.topology.network.model.IslDataHolder 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));
}
Aggregations