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