use of org.openkilda.messaging.payload.flow.FlowIdStatusPayload in project open-kilda by telstra.
the class FlowServiceImplTest method deleteFlow.
@Test
public void deleteFlow() throws Exception {
FlowEndpointPayload firstEndpoint = new FlowEndpointPayload(srcSwitchId, 10, 100);
FlowEndpointPayload secondEndpoint = new FlowEndpointPayload(dstSwitchId, 20, 100);
FlowPayload flowPayload = new FlowPayload(flowId, 0L, secondEndpoint, firstEndpoint, 10000L, "", "", OutputVlanType.NONE);
FlowIdStatusPayload flowIdStatusPayload = new FlowIdStatusPayload(flowId);
flowService.createFlow(flowPayload, DEFAULT_CORRELATION_ID);
flowService.deleteFlow(flowIdStatusPayload, DEFAULT_CORRELATION_ID);
Set<Flow> flows = flowRepository.findByFlowId(flowId);
assertNotNull(flows);
assertTrue(flows.isEmpty());
}
use of org.openkilda.messaging.payload.flow.FlowIdStatusPayload in project open-kilda by telstra.
the class CrudBolt method handlePushRequest.
private void handlePushRequest(String flowId, InfoMessage message, Tuple tuple) throws IOException {
logger.info("PUSH flow: {} :: {}", flowId, message);
FlowInfoData fid = (FlowInfoData) message.getData();
ImmutablePair<Flow, Flow> flow = fid.getPayload();
flowCache.pushFlow(flow);
Values northbound = new Values(new InfoMessage(new FlowStatusResponse(new FlowIdStatusPayload(flowId, FlowState.UP)), message.getTimestamp(), message.getCorrelationId(), Destination.NORTHBOUND));
outputCollector.emit(StreamType.RESPONSE.toString(), tuple, northbound);
}
use of org.openkilda.messaging.payload.flow.FlowIdStatusPayload in project open-kilda by telstra.
the class CrudBolt method handleUnpushRequest.
private void handleUnpushRequest(String flowId, InfoMessage message, Tuple tuple) throws IOException {
logger.info("UNPUSH flow: {} :: {}", flowId, message);
FlowInfoData fid = (FlowInfoData) message.getData();
flowCache.deleteFlow(flowId);
Values northbound = new Values(new InfoMessage(new FlowStatusResponse(new FlowIdStatusPayload(flowId, FlowState.DOWN)), message.getTimestamp(), message.getCorrelationId(), Destination.NORTHBOUND));
outputCollector.emit(StreamType.RESPONSE.toString(), tuple, northbound);
}
use of org.openkilda.messaging.payload.flow.FlowIdStatusPayload in project open-kilda by telstra.
the class CrudBolt method handleStatusRequest.
private void handleStatusRequest(String flowId, CommandMessage message, Tuple tuple) throws IOException {
ImmutablePair<Flow, Flow> flow = flowCache.getFlow(flowId);
FlowState status = flow.getLeft().getState();
logger.info("Status flow: {}={}", flowId, status);
Values northbound = new Values(new InfoMessage(new FlowStatusResponse(new FlowIdStatusPayload(flowId, status)), message.getTimestamp(), message.getCorrelationId(), Destination.NORTHBOUND));
outputCollector.emit(StreamType.RESPONSE.toString(), tuple, northbound);
}
use of org.openkilda.messaging.payload.flow.FlowIdStatusPayload in project open-kilda by telstra.
the class FlowTopologyTest method statusFlowTest.
@Test
public void statusFlowTest() throws Exception {
String flowId = UUID.randomUUID().toString();
ConsumerRecord<String, String> record;
createFlow(flowId);
record = cacheConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
record = nbConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
statusFlow(flowId);
record = nbConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
InfoMessage infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
assertNotNull(infoMessage);
FlowStatusResponse infoData = (FlowStatusResponse) infoMessage.getData();
assertNotNull(infoData);
FlowIdStatusPayload flowNbPayload = infoData.getPayload();
assertNotNull(flowNbPayload);
assertEquals(flowId, flowNbPayload.getId());
assertEquals(FlowState.ALLOCATED, flowNbPayload.getStatus());
}
Aggregations