use of org.openkilda.wfm.share.model.Endpoint 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.wfm.share.model.Endpoint 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());
}
use of org.openkilda.wfm.share.model.Endpoint 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.share.model.Endpoint in project open-kilda by telstra.
the class NetworkUniIslServiceTest method fromDownToBfd.
@Test
public void fromDownToBfd() {
NetworkUniIslService service = new NetworkUniIslService(carrier);
Endpoint endpoint = Endpoint.of(alphaDatapath, 1);
Endpoint remote = Endpoint.of(betaDatapath, 2);
Isl link = Isl.builder().srcSwitch(Switch.builder().switchId(endpoint.getDatapath()).build()).srcPort(endpoint.getPortNumber()).destPort(remote.getPortNumber()).destSwitch(Switch.builder().switchId(remote.getDatapath()).build()).build();
service.uniIslSetup(endpoint, link);
service.uniIslPhysicalDown(endpoint);
resetMocks();
service.uniIslBfdStatusUpdate(endpoint, BfdStatusUpdate.UP);
// System.out.println(mockingDetails(carrier).printInvocations());
verify(carrier).notifyBfdStatus(endpoint, IslReference.of(link), BfdStatusUpdate.UP);
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkUniIslServiceTest method fromUptoBfdToDown.
@Test
public void fromUptoBfdToDown() {
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);
service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.UP);
resetMocks();
service.uniIslPhysicalDown(endpoint1);
service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.UP);
service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.DOWN);
service.uniIslBfdStatusUpdate(endpoint1, BfdStatusUpdate.UP);
// System.out.println(mockingDetails(carrier).printInvocations());
InOrder order = inOrder(carrier);
IslReference reference = IslReference.of(islA1toB1);
order.verify(carrier).notifyIslDown(endpoint1, reference, IslDownReason.PORT_DOWN);
order.verify(carrier).notifyBfdStatus(endpoint1, reference, BfdStatusUpdate.UP);
order.verify(carrier).notifyBfdStatus(endpoint1, reference, BfdStatusUpdate.DOWN);
order.verify(carrier).notifyBfdStatus(endpoint1, reference, BfdStatusUpdate.UP);
}
Aggregations