Search in sources :

Example 6 with Headers

use of org.openkilda.server42.control.messaging.flowrtt.Headers in project open-kilda by telstra.

the class FlowHandler method notifyDeactivateFlowMonitoring.

@Override
public void notifyDeactivateFlowMonitoring(SwitchId switchId, String flowId, boolean isForward) {
    RemoveFlow removeFlow = RemoveFlow.builder().flowId(flowId).headers(buildHeader()).direction(isForward ? FlowDirection.FORWARD : FlowDirection.REVERSE).build();
    emit(STREAM_CONTROL_COMMANDS_ID, getCurrentTuple(), new Values(switchId.toString(), removeFlow));
}
Also used : RemoveFlow(org.openkilda.server42.control.messaging.flowrtt.RemoveFlow) Values(org.apache.storm.tuple.Values)

Example 7 with Headers

use of org.openkilda.server42.control.messaging.flowrtt.Headers in project open-kilda by telstra.

the class IslHandler method notifyActivateIslMonitoring.

@Override
public void notifyActivateIslMonitoring(SwitchId switchId, int port) {
    AddIsl addIsl = AddIsl.builder().headers(buildHeader()).switchId(switchId).port(port).build();
    emit(STREAM_CONTROL_COMMANDS_ID, getCurrentTuple(), new Values(switchId.toString(), addIsl));
}
Also used : Values(org.apache.storm.tuple.Values) AddIsl(org.openkilda.server42.control.messaging.islrtt.AddIsl)

Example 8 with Headers

use of org.openkilda.server42.control.messaging.flowrtt.Headers in project open-kilda by telstra.

the class KafkaController method getIslList.

@GetMapping(value = "/isl")
@ResponseBody
private DeferredResult<ResponseEntity<?>> getIslList(@RequestParam String switchId) throws InterruptedException, ExecutionException, TimeoutException {
    Headers headers = buildHeader();
    String correlationId = headers.getCorrelationId();
    send(switchId, ListIslsRequest.builder().headers(headers).switchId(new SwitchId(switchId)).build());
    DeferredResult<ResponseEntity<?>> deferredResult = new DeferredResult<>(500L);
    deferredResult.onTimeout(() -> {
        deferredResult.setErrorResult(ResponseEntity.status(HttpStatus.REQUEST_TIMEOUT).body("Request timeout occurred."));
        deferredResultConcurrentHashMap.remove(correlationId);
    });
    deferredResult.onCompletion(() -> deferredResultConcurrentHashMap.remove(correlationId));
    deferredResult.onError((Throwable throwable) -> {
        deferredResult.setErrorResult(ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(throwable));
        deferredResultConcurrentHashMap.remove(correlationId);
    });
    deferredResultConcurrentHashMap.put(correlationId, deferredResult);
    return deferredResult;
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) Headers(org.openkilda.server42.control.messaging.flowrtt.Headers) SwitchId(org.openkilda.model.SwitchId) DeferredResult(org.springframework.web.context.request.async.DeferredResult) GetMapping(org.springframework.web.bind.annotation.GetMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 9 with Headers

use of org.openkilda.server42.control.messaging.flowrtt.Headers in project open-kilda by telstra.

the class IslHandler method sendListOfIslPortsBySwitchId.

@Override
public void sendListOfIslPortsBySwitchId(SwitchId switchId, Set<Integer> islPorts) {
    ListIslPortsOnSwitch listIslPortsOnSwitch = ListIslPortsOnSwitch.builder().headers(buildHeader()).switchId(switchId).islPorts(islPorts).build();
    emit(STREAM_CONTROL_COMMANDS_ID, getCurrentTuple(), new Values(switchId.toString(), listIslPortsOnSwitch));
}
Also used : ListIslPortsOnSwitch(org.openkilda.server42.control.messaging.islrtt.ListIslPortsOnSwitch) Values(org.apache.storm.tuple.Values)

Example 10 with Headers

use of org.openkilda.server42.control.messaging.flowrtt.Headers in project open-kilda by telstra.

the class IslHandler method processDeactivateIslMonitoringOnSwitch.

/**
 * Deactivate monitoring for ISLs on provided switch.
 *
 * @param switchId specify the ISL endpoint.
 */
public void processDeactivateIslMonitoringOnSwitch(SwitchId switchId) {
    ClearIsls clearIsls = ClearIsls.builder().headers(buildHeader()).switchId(switchId).build();
    emit(STREAM_CONTROL_COMMANDS_ID, getCurrentTuple(), new Values(switchId.toString(), clearIsls));
}
Also used : ClearIsls(org.openkilda.server42.control.messaging.islrtt.ClearIsls) Values(org.apache.storm.tuple.Values)

Aggregations

Values (org.apache.storm.tuple.Values)7 Any (com.google.protobuf.Any)4 Headers (org.openkilda.server42.control.messaging.flowrtt.Headers)4 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)3 CommandPacket (org.openkilda.server42.control.messaging.Control.CommandPacket)3 CommandPacketResponse (org.openkilda.server42.control.messaging.Control.CommandPacketResponse)3 ClearFlows (org.openkilda.server42.control.messaging.flowrtt.ClearFlows)3 HashSet (java.util.HashSet)2 Test (org.junit.Test)2 SwitchId (org.openkilda.model.SwitchId)2 AddFlow (org.openkilda.server42.control.messaging.flowrtt.AddFlow)2 FlowRttControl (org.openkilda.server42.control.messaging.flowrtt.FlowRttControl)2 ListFlowsRequest (org.openkilda.server42.control.messaging.flowrtt.ListFlowsRequest)2 ListFlowsResponse (org.openkilda.server42.control.messaging.flowrtt.ListFlowsResponse)2 RemoveFlow (org.openkilda.server42.control.messaging.flowrtt.RemoveFlow)2 AddIsl (org.openkilda.server42.control.messaging.islrtt.AddIsl)2 ClearIsls (org.openkilda.server42.control.messaging.islrtt.ClearIsls)2 IslRttControl (org.openkilda.server42.control.messaging.islrtt.IslRttControl)2 ListIslsResponse (org.openkilda.server42.control.messaging.islrtt.ListIslsResponse)2 KafkaHandler (org.springframework.kafka.annotation.KafkaHandler)2