Search in sources :

Example 1 with BfdSessionData

use of org.openkilda.wfm.topology.network.model.BfdSessionData in project open-kilda by telstra.

the class NetworkBfdLogicalPortService method enableUpdate.

private void enableUpdate(Endpoint physical, IslReference reference, BfdProperties properties) {
    logServiceCall("ENABLE/UPDATE physical={}, reference={}, properties={}", physical, reference, properties);
    BfdLogicalPortFsm controller = lookupControllerCreateIfMissing(physical);
    BfdLogicalPortFsmContext context = BfdLogicalPortFsmContext.builder().sessionData(new BfdSessionData(reference, properties)).build();
    handle(controller, Event.ENABLE_UPDATE, context);
}
Also used : BfdSessionData(org.openkilda.wfm.topology.network.model.BfdSessionData) BfdLogicalPortFsmContext(org.openkilda.wfm.topology.network.controller.bfd.BfdLogicalPortFsm.BfdLogicalPortFsmContext) BfdLogicalPortFsm(org.openkilda.wfm.topology.network.controller.bfd.BfdLogicalPortFsm)

Example 2 with BfdSessionData

use of org.openkilda.wfm.topology.network.model.BfdSessionData in project open-kilda by telstra.

the class NetworkBfdSessionServiceTest method failOnCriticalErrors.

@Test
public void failOnCriticalErrors() {
    BfdSession initialBfdSession = makeBfdSession(1);
    NoviBfdSession removeRequestPayload = forceCleanupAfterInit(initialBfdSession);
    // push speaker error(critical) response
    mockBfdSessionLookup(initialBfdSession);
    BfdSessionResponse removeResponse = new BfdSessionResponse(removeRequestPayload, NoviBfdSession.Errors.SWITCH_RESPONSE_ERROR);
    service.speakerResponse(alphaLogicalEndpoint, removeRequestKey, removeResponse);
    verify(carrier).bfdFailNotification(alphaEndpoint);
    verifyNoMoreInteractions(carrier);
    verifyNoMoreInteractions(bfdSessionRepository);
    resetCarrier();
    reset(bfdSessionRepository);
    // make one more remove attempt on next enable/update request
    service.enableUpdate(alphaLogicalEndpoint, alphaEndpoint.getPortNumber(), new BfdSessionData(alphaToBetaIslRef, genericBfdProperties));
    verify(carrier).sendWorkerBfdSessionDeleteRequest(removeRequestPayload);
    verifyNoMoreInteractions(carrier);
}
Also used : BfdSessionData(org.openkilda.wfm.topology.network.model.BfdSessionData) BfdSession(org.openkilda.model.BfdSession) NoviBfdSession(org.openkilda.messaging.model.NoviBfdSession) BfdSessionResponse(org.openkilda.messaging.floodlight.response.BfdSessionResponse) NoviBfdSession(org.openkilda.messaging.model.NoviBfdSession) Test(org.junit.Test)

Example 3 with BfdSessionData

use of org.openkilda.wfm.topology.network.model.BfdSessionData in project open-kilda by telstra.

the class NetworkBfdLogicalPortServiceTest method portDeleteDelayedResponse.

@Test
public void portDeleteDelayedResponse() {
    NetworkBfdLogicalPortService service = makeService();
    final String deleteRequestId = doDisableOnReadyPort(service);
    service.apply(physical, reference, propertiesEnabled);
    verifyNoInteractions(carrier);
    final String createRequestId = "port-create-request";
    when(carrier.createLogicalPort(eq(logical), eq(physical.getPortNumber()))).thenReturn(createRequestId);
    service.portDel(logical);
    verify(carrier).createLogicalPort(eq(logical), eq(physical.getPortNumber()));
    reset(carrier);
    service.workerSuccess(createRequestId, logical, makePortCreateResponse(physical, logical));
    verifyNoInteractions(carrier);
    DeleteLogicalPortResponse deleteResponse = new DeleteLogicalPortResponse(logical.getDatapath().toString(), logical.getPortNumber(), true);
    service.workerSuccess(deleteRequestId, logical, deleteResponse);
    service.portAdd(logical, physical.getPortNumber());
    verify(carrier).enableUpdateSession(eq(logical), eq(physical.getPortNumber()), eq(new BfdSessionData(reference, propertiesEnabled)));
}
Also used : BfdSessionData(org.openkilda.wfm.topology.network.model.BfdSessionData) DeleteLogicalPortResponse(org.openkilda.messaging.info.grpc.DeleteLogicalPortResponse) Test(org.junit.Test)

Example 4 with BfdSessionData

use of org.openkilda.wfm.topology.network.model.BfdSessionData in project open-kilda by telstra.

the class NetworkBfdLogicalPortServiceTest method enableDuringCleanup.

@Test
public void enableDuringCleanup() {
    NetworkBfdLogicalPortService service = makeService();
    switchOnlineStatusMonitor.update(physical.getDatapath(), true);
    service.portAdd(logical, physical.getPortNumber());
    service.apply(physical, reference, propertiesEnabled);
    verify(carrier).logicalPortControllerAddNotification(eq(physical));
    reset(carrier);
    final String deleteRequestId = "port-delete-request";
    when(carrier.deleteLogicalPort(eq(logical))).thenReturn(deleteRequestId);
    service.disable(physical);
    service.sessionCompleteNotification(physical);
    verify(carrier).deleteLogicalPort(eq(logical));
    reset(carrier);
    final String createRequestId = "port-create-request";
    when(carrier.createLogicalPort(eq(logical), eq(physical.getPortNumber()))).thenReturn(createRequestId);
    BfdProperties altProperties = new BfdProperties(Duration.ofMillis(propertiesEnabled.getInterval().toMillis() + 100), (short) (propertiesEnabled.getMultiplier() + 1));
    service.apply(physical, reference, altProperties);
    service.portDel(logical);
    service.portAdd(logical, physical.getPortNumber());
    verify(carrier).enableUpdateSession(eq(logical), eq(physical.getPortNumber()), eq(new BfdSessionData(reference, altProperties)));
}
Also used : BfdSessionData(org.openkilda.wfm.topology.network.model.BfdSessionData) BfdProperties(org.openkilda.model.BfdProperties) Test(org.junit.Test)

Example 5 with BfdSessionData

use of org.openkilda.wfm.topology.network.model.BfdSessionData in project open-kilda by telstra.

the class NetworkBfdLogicalPortServiceTest method portDeleteDelayedPortEvent.

@Test
public void portDeleteDelayedPortEvent() {
    NetworkBfdLogicalPortService service = makeService();
    final String deleteRequestId = doDisableOnReadyPort(service);
    service.apply(physical, reference, propertiesEnabled);
    verifyNoInteractions(carrier);
    final String createRequestId1 = "port-create-request-1";
    when(carrier.createLogicalPort(eq(logical), eq(physical.getPortNumber()))).thenReturn(createRequestId1);
    DeleteLogicalPortResponse deleteResponse = new DeleteLogicalPortResponse(logical.getDatapath().toString(), logical.getPortNumber(), true);
    service.workerSuccess(deleteRequestId, logical, deleteResponse);
    verify(carrier).createLogicalPort(eq(logical), eq(physical.getPortNumber()));
    reset(carrier);
    final String createRequestId2 = "port-create-request-2";
    when(carrier.createLogicalPort(eq(logical), eq(physical.getPortNumber()))).thenReturn(createRequestId2);
    service.portDel(logical);
    verify(carrier).createLogicalPort(eq(logical), eq(physical.getPortNumber()));
    reset(carrier);
    service.workerSuccess(createRequestId1, logical, makePortCreateResponse(physical, logical));
    verifyNoInteractions(carrier);
    service.portAdd(logical, physical.getPortNumber());
    verify(carrier).enableUpdateSession(eq(logical), eq(physical.getPortNumber()), eq(new BfdSessionData(reference, propertiesEnabled)));
}
Also used : BfdSessionData(org.openkilda.wfm.topology.network.model.BfdSessionData) DeleteLogicalPortResponse(org.openkilda.messaging.info.grpc.DeleteLogicalPortResponse) Test(org.junit.Test)

Aggregations

BfdSessionData (org.openkilda.wfm.topology.network.model.BfdSessionData)12 Test (org.junit.Test)9 NoviBfdSession (org.openkilda.messaging.model.NoviBfdSession)7 BfdSession (org.openkilda.model.BfdSession)6 BfdSessionResponse (org.openkilda.messaging.floodlight.response.BfdSessionResponse)5 BfdProperties (org.openkilda.model.BfdProperties)4 DeleteLogicalPortResponse (org.openkilda.messaging.info.grpc.DeleteLogicalPortResponse)2 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 Duration (java.time.Duration)1 Optional (java.util.Optional)1 Assert (org.junit.Assert)1 Before (org.junit.Before)1 RunWith (org.junit.runner.RunWith)1 ArgumentCaptor (org.mockito.ArgumentCaptor)1 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)1 ArgumentMatchers.argThat (org.mockito.ArgumentMatchers.argThat)1 Mock (org.mockito.Mock)1 Mockito (org.mockito.Mockito)1 Mockito.atLeastOnce (org.mockito.Mockito.atLeastOnce)1