Search in sources :

Example 51 with Endpoint

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());
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) Test(org.junit.Test)

Example 52 with Endpoint

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);
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) SwitchId(org.openkilda.model.SwitchId) Test(org.junit.Test)

Example 53 with Endpoint

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);
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) SwitchId(org.openkilda.model.SwitchId) Test(org.junit.Test)

Example 54 with Endpoint

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);
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) SwitchId(org.openkilda.model.SwitchId) Test(org.junit.Test)

Example 55 with Endpoint

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);
}
Also used : Isl(org.openkilda.model.Isl) Endpoint(org.openkilda.wfm.share.model.Endpoint) Switch(org.openkilda.model.Switch) Test(org.junit.Test)

Aggregations

Endpoint (org.openkilda.wfm.share.model.Endpoint)72 Test (org.junit.Test)33 Isl (org.openkilda.model.Isl)17 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)13 SwitchId (org.openkilda.model.SwitchId)10 Switch (org.openkilda.model.Switch)8 IslReference (org.openkilda.wfm.share.model.IslReference)8 PathNode (org.openkilda.messaging.info.event.PathNode)7 Instant (java.time.Instant)6 IslDataHolder (org.openkilda.wfm.topology.network.model.IslDataHolder)6 HashSet (java.util.HashSet)4 Set (java.util.Set)4 DiscoverIslCommandData (org.openkilda.messaging.command.discovery.DiscoverIslCommandData)4 IslNotFoundException (org.openkilda.wfm.error.IslNotFoundException)4 Values (org.apache.storm.tuple.Values)3 IslRoundTripLatency (org.openkilda.messaging.info.event.IslRoundTripLatency)3 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)3 CommandContext (org.openkilda.wfm.CommandContext)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 HashMap (java.util.HashMap)2