use of org.openkilda.wfm.share.model.Endpoint 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());
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkWatcherServiceTest method discovery.
@Test
public void discovery() {
NetworkWatcherService w = makeService();
w.addWatch(Endpoint.of(new SwitchId(1), 1), 1);
w.addWatch(Endpoint.of(new SwitchId(1), 2), 1);
w.addWatch(Endpoint.of(new SwitchId(2), 1), 2);
w.addWatch(Endpoint.of(new SwitchId(2), 1), 2);
w.addWatch(Endpoint.of(new SwitchId(2), 2), 3);
assertThat(w.getConfirmedPackets().size(), is(0));
assertThat(w.getTimeouts().size(), is(3));
verify(carrier, times(5)).sendDiscovery(any(DiscoverIslCommandData.class));
w.confirmation(Endpoint.of(new SwitchId(1), 1), 0);
w.confirmation(Endpoint.of(new SwitchId(2), 1), 2);
assertThat(w.getConfirmedPackets().size(), is(2));
PathNode source = new PathNode(new SwitchId(1), 1, 0);
PathNode destination = new PathNode(new SwitchId(2), 1, 0);
IslInfoData islAlphaBeta = IslInfoData.builder().source(source).destination(destination).packetId(0L).build();
IslInfoData islBetaAlpha = IslInfoData.builder().source(destination).destination(source).packetId(2L).build();
w.discovery(islAlphaBeta);
w.discovery(islBetaAlpha);
w.tick(100);
assertThat(w.getConfirmedPackets().size(), is(0));
verify(carrier).oneWayDiscoveryReceived(eq(new Endpoint(islAlphaBeta.getSource())), eq(0L), eq(islAlphaBeta), anyLong());
verify(carrier).oneWayDiscoveryReceived(eq(new Endpoint(islBetaAlpha.getSource())), eq(2L), eq(islBetaAlpha), anyLong());
verify(carrier, times(2)).oneWayDiscoveryReceived(any(Endpoint.class), anyLong(), any(IslInfoData.class), anyLong());
assertThat(w.getTimeouts().size(), is(0));
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkSwitchServiceTest method portAddOnOnlineSwitch.
@Test
public void portAddOnOnlineSwitch() {
NetworkSwitchService service = new NetworkSwitchService(carrier, persistenceManager, options);
// prepare
SpeakerSwitchView speakerSwitchView = getSpeakerSwitchView().toBuilder().ports(emptyList()).build();
SwitchInfoData switchAddEvent = new SwitchInfoData(alphaDatapath, SwitchChangeType.ACTIVATED, alphaInetAddress.toString(), alphaDescription, speakerInetAddress.toString(), false, speakerSwitchView);
service.switchEvent(switchAddEvent);
verifySwitchSync(service);
// process
Endpoint endpoint = Endpoint.of(alphaDatapath, 1);
PortInfoData speakerPortEvent = new PortInfoData(endpoint.getDatapath(), endpoint.getPortNumber(), PortChangeType.ADD, true);
service.switchPortEvent(speakerPortEvent);
verify(carrier).sendSwitchStateChanged(alphaDatapath, SwitchStatus.ACTIVE);
verify(carrier).setupPortHandler(endpoint, null);
verify(carrier).setOnlineMode(endpoint, OnlineStatus.ONLINE);
verify(carrier).setPortLinkMode(endpoint, LinkStatus.UP);
verify(carrier).sendAffectedFlowRerouteRequest(alphaDatapath);
verifyNoMoreInteractions(carrier);
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class LinkOperationsServiceTest method verifyBfdProperties.
private void verifyBfdProperties(BfdProperties expectedValue) {
Endpoint source = Endpoint.of(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT);
Endpoint destination = Endpoint.of(TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT);
verifyBfdProperties(source, destination, expectedValue);
verifyBfdProperties(destination, source, expectedValue);
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class SwitchOperationsServiceTest method setUpOnce.
@BeforeClass
public static void setUpOnce() {
RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory();
switchRepository = repositoryFactory.createSwitchRepository();
switchPropertiesRepository = repositoryFactory.createSwitchPropertiesRepository();
portPropertiesRepository = repositoryFactory.createPortPropertiesRepository();
flowRepository = repositoryFactory.createFlowRepository();
mirrorGroupRepository = repositoryFactory.createMirrorGroupRepository();
flowMirrorPointsRepository = repositoryFactory.createFlowMirrorPointsRepository();
flowMirrorPathRepository = repositoryFactory.createFlowMirrorPathRepository();
lagLogicalPortRepository = repositoryFactory.createLagLogicalPortRepository();
SwitchOperationsServiceCarrier carrier = new SwitchOperationsServiceCarrier() {
@Override
public void requestSwitchSync(SwitchId switchId) {
}
@Override
public void enableServer42FlowRttOnSwitch(SwitchId switchId) {
}
@Override
public void disableServer42FlowRttOnSwitch(SwitchId switchId) {
}
@Override
public void enableServer42IslRttOnSwitch(SwitchId switchId) {
}
@Override
public void disableServer42IslRttOnSwitch(SwitchId switchId) {
}
};
ILinkOperationsServiceCarrier linkCarrier = new ILinkOperationsServiceCarrier() {
@Override
public void islBfdPropertiesChanged(Endpoint source, Endpoint destination) {
}
};
switchOperationsService = new SwitchOperationsService(persistenceManager.getRepositoryFactory(), persistenceManager.getTransactionManager(), carrier, linkCarrier);
}
Aggregations