Search in sources :

Example 1 with DeleteLogicalPortResponse

use of org.openkilda.messaging.info.grpc.DeleteLogicalPortResponse in project open-kilda by telstra.

the class GrpcRouter method route.

private void route(Tuple input, InfoMessage message) throws PipelineException {
    InfoData payload = message.getData();
    String key = pullKey(input);
    if (payload instanceof CreateLogicalPortResponse) {
        emit(STREAM_BFD_WORKER_ID, input, makeBfdWorkerTuple(key, new BfdWorkerLogicalPortCreateResponse((CreateLogicalPortResponse) payload)));
    } else if (payload instanceof DeleteLogicalPortResponse) {
        emit(STREAM_BFD_WORKER_ID, input, makeBfdWorkerTuple(key, new BfdWorkerLogicalPortDeleteResponse((DeleteLogicalPortResponse) payload)));
    } else {
        log.debug("Ignore GRPC message {}: {}", payload.getClass().getName(), payload);
    }
}
Also used : BfdWorkerLogicalPortDeleteResponse(org.openkilda.wfm.topology.network.storm.bolt.bfd.worker.response.BfdWorkerLogicalPortDeleteResponse) CreateLogicalPortResponse(org.openkilda.messaging.info.grpc.CreateLogicalPortResponse) InfoData(org.openkilda.messaging.info.InfoData) BfdWorkerLogicalPortCreateResponse(org.openkilda.wfm.topology.network.storm.bolt.bfd.worker.response.BfdWorkerLogicalPortCreateResponse) DeleteLogicalPortResponse(org.openkilda.messaging.info.grpc.DeleteLogicalPortResponse)

Example 2 with DeleteLogicalPortResponse

use of org.openkilda.messaging.info.grpc.DeleteLogicalPortResponse 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 3 with DeleteLogicalPortResponse

use of org.openkilda.messaging.info.grpc.DeleteLogicalPortResponse 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)

Example 4 with DeleteLogicalPortResponse

use of org.openkilda.messaging.info.grpc.DeleteLogicalPortResponse in project open-kilda by telstra.

the class SwitchManagerHub method onWorkerResponse.

@Override
protected void onWorkerResponse(Tuple input) throws PipelineException {
    String key = KeyProvider.getParentKey(input.getStringByField(MessageKafkaTranslator.FIELD_ID_KEY));
    Message message = pullValue(input, MessageKafkaTranslator.FIELD_ID_PAYLOAD, Message.class);
    if (message instanceof InfoMessage) {
        InfoData data = ((InfoMessage) message).getData();
        if (data instanceof FlowDumpResponse) {
            validateService.handleFlowEntriesResponse(key, (FlowDumpResponse) data);
        } else if (data instanceof GroupDumpResponse) {
            validateService.handleGroupEntriesResponse(key, (GroupDumpResponse) data);
        } else if (data instanceof DumpLogicalPortsResponse) {
            validateService.handleLogicalPortResponse(key, (DumpLogicalPortsResponse) data);
        } else if (data instanceof MeterDumpResponse) {
            validateService.handleMeterEntriesResponse(key, (MeterDumpResponse) data);
        } else if (data instanceof SwitchMeterData) {
            handleMetersResponse(key, (SwitchMeterData) data);
        } else if (data instanceof FlowInstallResponse) {
            syncService.handleInstallRulesResponse(key);
        } else if (data instanceof FlowRemoveResponse) {
            syncService.handleRemoveRulesResponse(key);
        } else if (data instanceof FlowReinstallResponse) {
            syncService.handleReinstallDefaultRulesResponse(key, (FlowReinstallResponse) data);
        } else if (data instanceof DeleteMeterResponse) {
            syncService.handleRemoveMetersResponse(key);
        } else if (data instanceof ModifyMeterResponse) {
            syncService.handleModifyMetersResponse(key);
        } else if (data instanceof InstallGroupResponse) {
            syncService.handleInstallGroupResponse(key);
        } else if (data instanceof ModifyGroupResponse) {
            syncService.handleModifyGroupResponse(key);
        } else if (data instanceof DeleteGroupResponse) {
            syncService.handleDeleteGroupResponse(key);
        } else if (data instanceof SwitchRulesResponse) {
            switchRuleService.rulesResponse(key, (SwitchRulesResponse) data);
        } else if (data instanceof CreateLogicalPortResponse) {
            createLagPortService.handleGrpcResponse(key, (CreateLogicalPortResponse) data);
            syncService.handleCreateLogicalPortResponse(key);
        } else if (data instanceof DeleteLogicalPortResponse) {
            deleteLagPortService.handleGrpcResponse(key, (DeleteLogicalPortResponse) data);
            syncService.handleDeleteLogicalPortResponse(key);
        } else {
            log.warn("Receive unexpected InfoData for key {}: {}", key, data);
        }
    } else if (message instanceof ErrorMessage) {
        log.warn("Receive ErrorMessage for key {}", key);
        validateService.handleTaskError(key, (ErrorMessage) message);
        syncService.handleTaskError(key, (ErrorMessage) message);
        createLagPortService.handleTaskError(key, (ErrorMessage) message);
        deleteLagPortService.handleTaskError(key, (ErrorMessage) message);
    }
}
Also used : DumpLogicalPortsResponse(org.openkilda.messaging.info.grpc.DumpLogicalPortsResponse) SwitchMeterData(org.openkilda.messaging.info.meter.SwitchMeterData) FlowDumpResponse(org.openkilda.messaging.info.flow.FlowDumpResponse) FlowReinstallResponse(org.openkilda.messaging.info.flow.FlowReinstallResponse) InfoMessage(org.openkilda.messaging.info.InfoMessage) CommandMessage(org.openkilda.messaging.command.CommandMessage) Message(org.openkilda.messaging.Message) ErrorMessage(org.openkilda.messaging.error.ErrorMessage) ModifyMeterResponse(org.openkilda.messaging.info.switches.ModifyMeterResponse) DeleteMeterResponse(org.openkilda.messaging.info.switches.DeleteMeterResponse) FlowInstallResponse(org.openkilda.messaging.info.flow.FlowInstallResponse) DeleteLogicalPortResponse(org.openkilda.messaging.info.grpc.DeleteLogicalPortResponse) FlowRemoveResponse(org.openkilda.messaging.info.flow.FlowRemoveResponse) CreateLogicalPortResponse(org.openkilda.messaging.info.grpc.CreateLogicalPortResponse) DeleteGroupResponse(org.openkilda.messaging.info.switches.DeleteGroupResponse) GroupDumpResponse(org.openkilda.messaging.info.group.GroupDumpResponse) InfoMessage(org.openkilda.messaging.info.InfoMessage) InfoData(org.openkilda.messaging.info.InfoData) InstallGroupResponse(org.openkilda.messaging.info.switches.InstallGroupResponse) SwitchRulesResponse(org.openkilda.messaging.info.switches.SwitchRulesResponse) MeterDumpResponse(org.openkilda.messaging.info.meter.MeterDumpResponse) ModifyGroupResponse(org.openkilda.messaging.info.switches.ModifyGroupResponse) ErrorMessage(org.openkilda.messaging.error.ErrorMessage)

Aggregations

DeleteLogicalPortResponse (org.openkilda.messaging.info.grpc.DeleteLogicalPortResponse)4 Test (org.junit.Test)2 InfoData (org.openkilda.messaging.info.InfoData)2 CreateLogicalPortResponse (org.openkilda.messaging.info.grpc.CreateLogicalPortResponse)2 BfdSessionData (org.openkilda.wfm.topology.network.model.BfdSessionData)2 Message (org.openkilda.messaging.Message)1 CommandMessage (org.openkilda.messaging.command.CommandMessage)1 ErrorMessage (org.openkilda.messaging.error.ErrorMessage)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 FlowDumpResponse (org.openkilda.messaging.info.flow.FlowDumpResponse)1 FlowInstallResponse (org.openkilda.messaging.info.flow.FlowInstallResponse)1 FlowReinstallResponse (org.openkilda.messaging.info.flow.FlowReinstallResponse)1 FlowRemoveResponse (org.openkilda.messaging.info.flow.FlowRemoveResponse)1 GroupDumpResponse (org.openkilda.messaging.info.group.GroupDumpResponse)1 DumpLogicalPortsResponse (org.openkilda.messaging.info.grpc.DumpLogicalPortsResponse)1 MeterDumpResponse (org.openkilda.messaging.info.meter.MeterDumpResponse)1 SwitchMeterData (org.openkilda.messaging.info.meter.SwitchMeterData)1 DeleteGroupResponse (org.openkilda.messaging.info.switches.DeleteGroupResponse)1 DeleteMeterResponse (org.openkilda.messaging.info.switches.DeleteMeterResponse)1 InstallGroupResponse (org.openkilda.messaging.info.switches.InstallGroupResponse)1