use of org.openkilda.model.Isl in project open-kilda by telstra.
the class NetworkUniIslServiceTest method replugIntoSelfLoop.
@Test
public void replugIntoSelfLoop() {
NetworkUniIslService service = new NetworkUniIslService(carrier);
Endpoint endpointA = Endpoint.of(alphaDatapath, 1);
Endpoint endpointZ = Endpoint.of(betaDatapath, 2);
verifyNoMoreInteractions(carrier);
service.uniIslSetup(endpointA, null);
Isl genericIsl = makeIslBuilder(endpointA, endpointZ).build();
IslInfoData genericData = IslMapper.INSTANCE.map(genericIsl);
service.uniIslDiscovery(endpointA, genericData);
verify(carrier).notifyIslUp(eq(endpointA), eq(IslReference.of(genericIsl)), eq(new IslDataHolder(genericData)));
// replug into self-loop
Isl selfLoopIsl = makeIslBuilder(endpointA, Endpoint.of(endpointA.getDatapath(), endpointA.getPortNumber() + 1)).build();
IslInfoData selfLoopData = IslMapper.INSTANCE.map((selfLoopIsl));
service.uniIslDiscovery(endpointA, selfLoopData);
verify(carrier, times(1)).notifyIslMove(eq(endpointA), eq(IslReference.of(genericIsl)));
verify(carrier, times(0)).notifyIslUp(eq(endpointA), eq(IslReference.of(selfLoopIsl)), eq(new IslDataHolder(selfLoopData)));
service.uniIslDiscovery(endpointA, selfLoopData);
// no new move events and no discovery notifications for self-looped ISL
verify(carrier, times(1)).notifyIslMove(eq(endpointA), eq(IslReference.of(genericIsl)));
verify(carrier, times(0)).notifyIslUp(eq(endpointA), eq(IslReference.of(selfLoopIsl)), eq(new IslDataHolder(selfLoopData)));
}
use of org.openkilda.model.Isl in project open-kilda by telstra.
the class NetworkUniIslServiceTest method selfLoopWhenUp.
@Test
public void selfLoopWhenUp() {
NetworkUniIslService service = new NetworkUniIslService(carrier);
final Endpoint endpointAlpha1 = Endpoint.of(alphaDatapath, 1);
final Endpoint endpointAlpha2 = Endpoint.of(alphaDatapath, 2);
final Endpoint endpointBeta3 = Endpoint.of(betaDatapath, 3);
// setup
service.uniIslSetup(endpointAlpha1, null);
verifyNoMoreInteractions(carrier);
// initial (normal) discovery
Isl normalIsl = makeIslBuilder(endpointAlpha1, endpointBeta3).build();
service.uniIslDiscovery(endpointAlpha1, IslMapper.INSTANCE.map(normalIsl));
verify(carrier).notifyIslUp(endpointAlpha1, new IslReference(endpointAlpha1, endpointBeta3), new IslDataHolder(normalIsl));
verify(carrier).exhaustedPollModeUpdateRequest(endpointAlpha1, false);
verifyNoMoreInteractions(carrier);
reset(carrier);
// self loop must trigger ISL move
Isl selfLoopIsl = makeIslBuilder(endpointAlpha1, endpointAlpha2).build();
service.uniIslDiscovery(endpointAlpha1, IslMapper.INSTANCE.map(selfLoopIsl));
verify(carrier).notifyIslMove(endpointAlpha1, new IslReference(endpointAlpha1, endpointBeta3));
verifyNoMoreInteractions(carrier);
reset(carrier);
// ensure following discovery will be processed
verifyIslCanBeDiscovered(service, normalIsl);
}
use of org.openkilda.model.Isl in project open-kilda by telstra.
the class NetworkUniIslServiceTest method selfLoopWhenDownAndRemoteIsSet.
@Test
public void selfLoopWhenDownAndRemoteIsSet() {
NetworkUniIslService service = new NetworkUniIslService(carrier);
final Endpoint endpointAlpha1 = Endpoint.of(alphaDatapath, 1);
final Endpoint endpointAlpha2 = Endpoint.of(alphaDatapath, 2);
final Endpoint endpointBeta3 = Endpoint.of(betaDatapath, 3);
// setup
service.uniIslSetup(endpointAlpha1, null);
verifyNoMoreInteractions(carrier);
// initial (normal) discovery
Isl normalIsl = makeIslBuilder(endpointAlpha1, endpointBeta3).build();
service.uniIslDiscovery(endpointAlpha1, IslMapper.INSTANCE.map(normalIsl));
final IslReference reference = new IslReference(endpointAlpha1, endpointBeta3);
verify(carrier).notifyIslUp(endpointAlpha1, reference, new IslDataHolder(normalIsl));
verify(carrier).exhaustedPollModeUpdateRequest(endpointAlpha1, false);
verifyNoMoreInteractions(carrier);
reset(carrier);
// fail
service.uniIslFail(endpointAlpha1);
verify(carrier).notifyIslDown(endpointAlpha1, reference, IslDownReason.POLL_TIMEOUT);
reset(carrier);
// discovery (self-loop)
Isl selfLoopIsl = makeIslBuilder(endpointAlpha1, endpointAlpha2).build();
service.uniIslDiscovery(endpointAlpha1, IslMapper.INSTANCE.map(selfLoopIsl));
verify(carrier).notifyIslMove(endpointAlpha1, reference);
verifyNoMoreInteractions(carrier);
reset(carrier);
// ensure following discovery will be processed
verifyIslCanBeDiscovered(service, normalIsl);
}
use of org.openkilda.model.Isl in project open-kilda by telstra.
the class NetworkUniIslServiceTest method shouldProxyRoundTripStatus.
@Test
public void shouldProxyRoundTripStatus() {
final NetworkUniIslService service = new NetworkUniIslService(carrier);
final Endpoint endpointAlpha = Endpoint.of(alphaDatapath, 1);
final Endpoint endpointBeta = Endpoint.of(betaDatapath, 1);
service.uniIslSetup(endpointAlpha, null);
Switch alphaSwitch = Switch.builder().switchId(endpointAlpha.getDatapath()).build();
Switch betaSwitch = Switch.builder().switchId(endpointBeta.getDatapath()).build();
Isl islA1toB1 = Isl.builder().srcSwitch(alphaSwitch).srcPort(endpointAlpha.getPortNumber()).destSwitch(betaSwitch).destPort(endpointBeta.getPortNumber()).build();
IslInfoData discovery = IslMapper.INSTANCE.map(islA1toB1);
service.uniIslDiscovery(endpointAlpha, discovery);
verifyProxyRoundTripStatus(service, endpointAlpha, endpointBeta);
service.uniIslPhysicalDown(endpointAlpha);
verifyProxyRoundTripStatus(service, endpointAlpha, endpointBeta);
service.uniIslDiscovery(endpointAlpha, discovery);
verifyProxyRoundTripStatus(service, endpointAlpha, endpointBeta);
}
use of org.openkilda.model.Isl in project open-kilda by telstra.
the class NetworkUniIslServiceTest method selfLoopWhenDownAndRemoteIsNotSet.
@Test
public void selfLoopWhenDownAndRemoteIsNotSet() {
NetworkUniIslService service = new NetworkUniIslService(carrier);
final Endpoint endpointAlpha1 = Endpoint.of(alphaDatapath, 1);
final Endpoint endpointAlpha2 = Endpoint.of(alphaDatapath, 2);
final Endpoint endpointBeta3 = Endpoint.of(betaDatapath, 3);
// setup
service.uniIslSetup(endpointAlpha1, null);
verifyNoMoreInteractions(carrier);
// fail
service.uniIslPhysicalDown(endpointAlpha1);
verify(carrier).exhaustedPollModeUpdateRequest(endpointAlpha1, true);
verifyNoMoreInteractions(carrier);
// discovery (self-loop)
Isl selfLoopIsl = makeIslBuilder(endpointAlpha1, endpointAlpha2).build();
service.uniIslDiscovery(endpointAlpha1, IslMapper.INSTANCE.map(selfLoopIsl));
verify(carrier).exhaustedPollModeUpdateRequest(endpointAlpha1, true);
verifyNoMoreInteractions(carrier);
// ensure following discovery will be processed
verifyIslCanBeDiscovered(service, makeIslBuilder(endpointAlpha1, endpointBeta3).build());
}
Aggregations