use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkIslServiceTest method prepareResurrection.
private IslReference prepareResurrection() {
setupIslStorageStub();
IslReference reference = prepareActiveIsl(true);
final Endpoint alphaEnd = reference.getSource();
final Endpoint zetaEnd = reference.getDest();
service.islDown(alphaEnd, reference, IslDownReason.POLL_TIMEOUT);
service.islDown(zetaEnd, reference, IslDownReason.POLL_TIMEOUT);
reset(carrier);
service.remove(reference);
verify(carrier).islDefaultRulesDelete(eq(alphaEnd), eq(zetaEnd));
verify(carrier).islDefaultRulesDelete(eq(zetaEnd), eq(alphaEnd));
verify(carrier).bfdDisableRequest(eq(alphaEnd));
verify(carrier).bfdDisableRequest(eq(zetaEnd));
verify(carrier).auxiliaryPollModeUpdateRequest(alphaEnd, false);
verify(carrier).auxiliaryPollModeUpdateRequest(zetaEnd, false);
verifyNoMoreInteractions(carrier);
Assert.assertTrue(islStorage.lookup(alphaEnd, zetaEnd).isPresent());
return reference;
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkBfdSessionServiceTest method setupCarrier.
private void setupCarrier() {
doAnswer(invocation -> {
Endpoint logical = invocation.getArgument(0);
boolean error = invocation.getArgument(1);
service.rotate(logical, error);
return null;
}).when(carrier).sessionRotateRequest(any(Endpoint.class), any(Boolean.class));
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkPortServiceTest method testEnableDiscoveryAfterOfflineOnlineCycle.
@Test
public void testEnableDiscoveryAfterOfflineOnlineCycle() {
Endpoint endpoint = Endpoint.of(alphaDatapath, 1);
when(portPropertiesRepository.getBySwitchIdAndPort(alphaDatapath, endpoint.getPortNumber())).thenReturn(Optional.empty()).thenReturn(Optional.of(PortProperties.builder().switchObj(getDefaultSwitch()).port(endpoint.getPortNumber()).discoveryEnabled(false).build()));
when(switchRepository.findById(alphaDatapath)).thenReturn(Optional.of(getDefaultSwitch()));
NetworkPortService service = makeService();
service.setup(endpoint, null);
service.updateOnlineMode(endpoint, OnlineStatus.ONLINE);
service.updateLinkStatus(endpoint, LinkStatus.UP);
verify(carrier).enableDiscoveryPoll(eq(endpoint));
service.updatePortProperties(endpoint, false);
verify(carrier).disableDiscoveryPoll(eq(endpoint));
service.updateOnlineMode(endpoint, OnlineStatus.OFFLINE);
service.updateOnlineMode(endpoint, OnlineStatus.ONLINE);
service.updateLinkStatus(endpoint, LinkStatus.UP);
// discovery still disabled
verify(carrier, times(1)).enableDiscoveryPoll(eq(endpoint));
service.updatePortProperties(endpoint, true);
verify(carrier, times(2)).enableDiscoveryPoll(eq(endpoint));
Endpoint remote = Endpoint.of(new SwitchId(endpoint.getDatapath().getId() + 1), 1);
IslInfoData discovery = new IslInfoData(new PathNode(endpoint.getDatapath(), endpoint.getPortNumber(), 0), new PathNode(remote.getDatapath(), remote.getPortNumber(), 0), IslChangeType.DISCOVERED, false);
service.discovery(endpoint, discovery);
verify(carrier).notifyPortDiscovered(eq(endpoint), eq(discovery));
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkPortServiceTest method testDiscoveryEventWhenDiscoveryDisabled.
@Test
public void testDiscoveryEventWhenDiscoveryDisabled() {
Endpoint endpoint = Endpoint.of(alphaDatapath, 1);
when(portPropertiesRepository.getBySwitchIdAndPort(alphaDatapath, endpoint.getPortNumber())).thenReturn(Optional.empty());
when(switchRepository.findById(alphaDatapath)).thenReturn(Optional.of(getDefaultSwitch()));
NetworkPortService service = makeService();
service.setup(endpoint, null);
service.updateOnlineMode(endpoint, OnlineStatus.ONLINE);
service.updateLinkStatus(endpoint, LinkStatus.UP);
verify(carrier).enableDiscoveryPoll(eq(endpoint));
verify(carrier, never()).notifyPortDiscovered(eq(endpoint), any(IslInfoData.class));
service.updatePortProperties(endpoint, false);
verify(carrier).disableDiscoveryPoll(eq(endpoint));
Endpoint remote = Endpoint.of(new SwitchId(endpoint.getDatapath().getId() + 1), 1);
IslInfoData discovery = new IslInfoData(new PathNode(endpoint.getDatapath(), endpoint.getPortNumber(), 0), new PathNode(remote.getDatapath(), remote.getPortNumber(), 0), IslChangeType.DISCOVERED, false);
service.discovery(endpoint, discovery);
verify(carrier, never()).notifyPortDiscovered(eq(endpoint), any(IslInfoData.class));
}
use of org.openkilda.wfm.share.model.Endpoint 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);
}
Aggregations