use of org.openkilda.wfm.topology.network.model.IslDataHolder in project open-kilda by telstra.
the class NetworkUniIslServiceTest method newIslFromUnknownToDownToUp.
@Test
public void newIslFromUnknownToDownToUp() {
NetworkUniIslService service = new NetworkUniIslService(carrier);
Endpoint endpoint1 = Endpoint.of(alphaDatapath, 1);
Endpoint endpoint2 = Endpoint.of(alphaDatapath, 2);
Switch alphaSwitch = Switch.builder().switchId(alphaDatapath).build();
Switch betaSwitch = Switch.builder().switchId(betaDatapath).build();
Isl islAtoB = Isl.builder().srcSwitch(alphaSwitch).srcPort(1).destSwitch(betaSwitch).destPort(1).build();
Isl islAtoB2 = Isl.builder().srcSwitch(alphaSwitch).srcPort(2).destSwitch(betaSwitch).destPort(2).build();
Isl islAtoB3 = Isl.builder().srcSwitch(alphaSwitch).srcPort(1).destSwitch(betaSwitch).destPort(3).build();
service.uniIslSetup(endpoint1, islAtoB);
service.uniIslSetup(endpoint2, null);
service.uniIslFail(endpoint1);
service.uniIslPhysicalDown(endpoint2);
resetMocks();
IslInfoData disco1 = IslMapper.INSTANCE.map(islAtoB3);
IslInfoData disco2 = IslMapper.INSTANCE.map(islAtoB2);
service.uniIslDiscovery(endpoint1, disco1);
service.uniIslDiscovery(endpoint2, disco2);
System.out.println(mockingDetails(carrier).printInvocations());
verify(carrier).notifyIslMove(endpoint1, IslReference.of(islAtoB));
verify(carrier).notifyIslUp(endpoint1, IslReference.of(islAtoB3), new IslDataHolder(islAtoB2));
verify(carrier).notifyIslUp(endpoint2, IslReference.of(islAtoB2), new IslDataHolder(islAtoB2));
}
use of org.openkilda.wfm.topology.network.model.IslDataHolder in project open-kilda by telstra.
the class NetworkUniIslServiceTest method verifyIslCanBeDiscovered.
private void verifyIslCanBeDiscovered(NetworkUniIslService service, Isl link) {
Endpoint endpointA = Endpoint.of(link.getSrcSwitchId(), link.getSrcPort());
Endpoint endpointZ = Endpoint.of(link.getDestSwitchId(), link.getDestPort());
service.uniIslDiscovery(endpointA, IslMapper.INSTANCE.map(link));
verify(carrier).notifyIslUp(endpointA, new IslReference(endpointA, endpointZ), new IslDataHolder(link));
verify(carrier).exhaustedPollModeUpdateRequest(endpointA, false);
verifyNoMoreInteractions(carrier);
reset(carrier);
}
use of org.openkilda.wfm.topology.network.model.IslDataHolder in project open-kilda by telstra.
the class DiscoveryPollMonitor method load.
@Override
public void load(Endpoint endpoint, Isl persistentView) {
super.load(endpoint, persistentView);
IslDataHolder islData = new IslDataHolder(persistentView);
IslEndpointPollStatus status = new IslEndpointPollStatus(islData, persistentView.getStatus());
discoveryData.put(endpoint, status);
cache.put(endpoint, status);
}
use of org.openkilda.wfm.topology.network.model.IslDataHolder in project open-kilda by telstra.
the class NetworkIslServiceTest method resurrectAfterRemoval.
@Test
public void resurrectAfterRemoval() {
IslReference reference = prepareResurrection();
service.islUp(reference.getSource(), reference, new IslDataHolder(1000, 1000, 1000));
testResurrection(reference, true);
}
use of org.openkilda.wfm.topology.network.model.IslDataHolder in project open-kilda by telstra.
the class NetworkIslServiceTest method continuousReplugVsRoundTripAlive.
@Test
public void continuousReplugVsRoundTripAlive() {
setupIslStorageStub();
IslReference referenceAlpha = prepareActiveIsl();
IslReference referenceBeta = new IslReference(Endpoint.of(referenceAlpha.getSource().getDatapath(), referenceAlpha.getSource().getPortNumber() + 1), referenceAlpha.getDest());
Instant lastSeen = clock.instant();
service.roundTripStatusNotification(referenceAlpha, new RoundTripStatus(referenceAlpha.getSource(), IslStatus.ACTIVE));
IslDataHolder alphaSource = new IslDataHolder(lookupIsl(referenceAlpha.getSource(), referenceAlpha.getDest()));
IslDataHolder alphaDest = new IslDataHolder(lookupIsl(referenceAlpha.getDest(), referenceAlpha.getSource()));
IslDataHolder betaSource = new IslDataHolder(makeIsl(referenceBeta.getSource(), referenceBeta.getDest(), false).build());
IslDataHolder betaDest = new IslDataHolder(makeIsl(referenceBeta.getDest(), referenceBeta.getSource(), false).build());
IslStatusUpdateNotification alphaNotification = new IslStatusUpdateNotification(referenceAlpha.getSource().getDatapath(), referenceAlpha.getSource().getPortNumber(), referenceAlpha.getDest().getDatapath(), referenceAlpha.getDest().getPortNumber(), IslStatus.MOVED);
IslStatusUpdateNotification betaNotification = new IslStatusUpdateNotification(referenceBeta.getSource().getDatapath(), referenceBeta.getSource().getPortNumber(), referenceBeta.getDest().getDatapath(), referenceBeta.getDest().getPortNumber(), IslStatus.MOVED);
for (int i = 0; i < 100; i++) {
// alpha -> beta
service.islMove(referenceAlpha.getSource(), referenceAlpha);
service.islUp(referenceBeta.getSource(), referenceBeta, betaSource);
service.islUp(referenceBeta.getDest(), referenceBeta, betaDest);
service.roundTripStatusNotification(referenceBeta, new RoundTripStatus(referenceBeta.getSource(), IslStatus.ACTIVE));
verifyStatus(referenceAlpha, IslStatus.MOVED);
verifyStatus(referenceBeta, IslStatus.ACTIVE);
verify(carrier, times(i + 1)).islStatusUpdateNotification(eq(alphaNotification));
verify(carrier, times(i + 1)).triggerReroute(argThat(entry -> entry instanceof RerouteAffectedFlows && Objects.equals(new PathNode(referenceAlpha.getSource().getDatapath(), referenceAlpha.getSource().getPortNumber(), 0), entry.getPathNode())));
verify(carrier, times(i + 1)).triggerReroute(argThat(entry -> entry instanceof RerouteInactiveFlows && Objects.equals(new PathNode(referenceBeta.getSource().getDatapath(), referenceBeta.getSource().getPortNumber(), 0), entry.getPathNode())));
// beta -> alpha
service.islMove(referenceBeta.getSource(), referenceBeta);
service.islUp(referenceAlpha.getSource(), referenceAlpha, alphaSource);
service.islUp(referenceAlpha.getDest(), referenceAlpha, alphaDest);
service.roundTripStatusNotification(referenceAlpha, new RoundTripStatus(referenceAlpha.getSource(), IslStatus.ACTIVE));
verifyStatus(referenceAlpha, IslStatus.ACTIVE);
verifyStatus(referenceBeta, IslStatus.MOVED);
verify(carrier, times(i + 1)).islStatusUpdateNotification(eq(betaNotification));
verify(carrier, times(i + 1)).triggerReroute(argThat(entry -> entry instanceof RerouteAffectedFlows && Objects.equals(new PathNode(referenceBeta.getSource().getDatapath(), referenceBeta.getSource().getPortNumber(), 0), entry.getPathNode())));
verify(carrier, times(i + 1)).triggerReroute(argThat(entry -> entry instanceof RerouteInactiveFlows && Objects.equals(new PathNode(referenceAlpha.getSource().getDatapath(), referenceAlpha.getSource().getPortNumber(), 0), entry.getPathNode())));
}
}
Aggregations