use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkPortServiceTest method inOperationalUpDownPort.
@Test
public void inOperationalUpDownPort() {
NetworkPortService service = makeService();
Endpoint port1 = Endpoint.of(alphaDatapath, 1);
Endpoint port2 = Endpoint.of(alphaDatapath, 2);
service.setup(port1, null);
service.updateOnlineMode(port1, OnlineStatus.ONLINE);
service.setup(port2, null);
service.updateOnlineMode(port2, OnlineStatus.ONLINE);
verify(carrier).setupUniIslHandler(Endpoint.of(alphaDatapath, 2), null);
verifyZeroInteractions(dashboardLogger);
resetMocks();
// Port 1 from Unknown to UP then DOWN
service.updateLinkStatus(port1, LinkStatus.UP);
service.updateLinkStatus(port1, LinkStatus.DOWN);
verify(dashboardLogger).onPortUp(port1);
verify(dashboardLogger).onPortDown(port1);
verifyNoMoreInteractions(dashboardLogger);
verify(carrier).enableDiscoveryPoll(Endpoint.of(alphaDatapath, 1));
verify(carrier).disableDiscoveryPoll(Endpoint.of(alphaDatapath, 1));
verify(carrier).notifyPortPhysicalDown(Endpoint.of(alphaDatapath, 1));
resetMocks();
// Port 2 from Unknown to DOWN then UP
service.updateLinkStatus(port2, LinkStatus.DOWN);
service.updateLinkStatus(port2, LinkStatus.UP);
verify(dashboardLogger).onPortDown(port2);
verify(dashboardLogger).onPortUp(port2);
verifyNoMoreInteractions(dashboardLogger);
verify(carrier).notifyPortPhysicalDown(Endpoint.of(alphaDatapath, 2));
verify(carrier).enableDiscoveryPoll(Endpoint.of(alphaDatapath, 2));
// System.out.println(mockingDetails(carrier).printInvocations());
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkRoundTripDecisionMakerServiceTest method shouldIgnoreOutdatedPacket.
@Test
public void shouldIgnoreOutdatedPacket() {
final Endpoint endpoint = Endpoint.of(new SwitchId(1), 1);
final NetworkRoundTripDecisionMakerService service = makeService();
service.discovered(endpoint, 2L);
verify(carrier).linkRoundTripActive(endpoint);
verifyNoMoreInteractions(carrier);
// 3 seconds
clock.adjust(Duration.ofSeconds(3));
service.discovered(endpoint, 1L);
service.tick();
verifyNoMoreInteractions(carrier);
// 5 seconds
clock.adjust(Duration.ofSeconds(2));
service.tick();
// packetId == 1 must be ignored, so this endpoint must expire on seconds number 4 not on seconds number 7
verify(carrier).linkRoundTripInactive(endpoint);
verifyNoMoreInteractions(carrier);
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkRoundTripDecisionMakerServiceTest method registerExpandExpire.
@Test
public void registerExpandExpire() {
final Endpoint endpoint = Endpoint.of(new SwitchId(1), 1);
final NetworkRoundTripDecisionMakerService service = makeService();
service.discovered(endpoint, 1L);
verify(carrier).linkRoundTripActive(eq(endpoint));
verifyNoMoreInteractions(carrier);
// 3 seconds
clock.adjust(Duration.ofSeconds(3));
service.discovered(endpoint, 2L);
verify(carrier, times(2)).linkRoundTripActive(eq(endpoint));
service.tick();
verifyNoMoreInteractions(carrier);
// 5 seconds
clock.adjust(Duration.ofSeconds(2));
service.tick();
verifyNoMoreInteractions(carrier);
// 9 seconds
clock.adjust(Duration.ofSeconds(4));
service.tick();
verify(carrier).linkRoundTripInactive(endpoint);
verifyNoMoreInteractions(carrier);
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkRoundTripDecisionMakerServiceTest method shouldNotEmitAnyNotificationsAfterRemoval.
@Test
public void shouldNotEmitAnyNotificationsAfterRemoval() {
final Endpoint endpoint = Endpoint.of(new SwitchId(1), 1);
final NetworkRoundTripDecisionMakerService service = makeService();
service.discovered(endpoint, 1L);
verify(carrier).linkRoundTripActive(endpoint);
verifyNoMoreInteractions(carrier);
// 3 seconds
clock.adjust(Duration.ofSeconds(3));
service.tick();
service.clear(endpoint);
verifyNoMoreInteractions(carrier);
// 5 seconds
clock.adjust(Duration.ofSeconds(2));
service.tick();
verifyNoMoreInteractions(carrier);
}
use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.
the class NetworkUniIslServiceTest method newIslFromUnknownToDownWithRemote.
@Test
public void newIslFromUnknownToDownWithRemote() {
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();
service.uniIslSetup(endpoint1, islAtoB);
service.uniIslSetup(endpoint2, islAtoB2);
resetMocks();
service.uniIslFail(endpoint1);
service.uniIslPhysicalDown(endpoint2);
System.out.println(mockingDetails(carrier).printInvocations());
verify(carrier).notifyIslDown(endpoint1, IslReference.of(islAtoB), IslDownReason.POLL_TIMEOUT);
verify(carrier).notifyIslDown(endpoint2, IslReference.of(islAtoB2), IslDownReason.PORT_DOWN);
}
Aggregations