16 package org.openkilda.northbound.controller;
18 import static java.util.Collections.singletonList;
55 import org.springframework.stereotype.Component;
57 import java.util.Collections;
58 import java.util.List;
60 import java.util.concurrent.ConcurrentHashMap;
68 static final String FLOW_ID =
"ff:00";
70 static final String ERROR_FLOW_ID =
"error-flow";
71 static final String TEST_SWITCH_ID =
"ff:01";
72 static final long TEST_SWITCH_RULE_COOKIE = 1L;
75 new FlowPayload(FLOW_ID, flowEndpoint, flowEndpoint, 10000,
false, FLOW_ID, null,
79 static final List<PathNodePayload> pathPayloadsList =
82 static final Flow flowModel =
new Flow(FLOW_ID, 10000,
false, 0L, FLOW_ID, null, SWITCH_ID,
90 private static final Map<String, CommandData> messages =
new ConcurrentHashMap<>();
117 public Object
poll(String correlationId) {
120 if (messages.containsKey(correlationId)) {
121 data = messages.remove(correlationId);
122 }
else if (messages.containsKey(SYSTEM_CORRELATION_ID)) {
123 data = messages.remove(SYSTEM_CORRELATION_ID);
128 return formatResponse(correlationId,
data);
143 private Message getReadFlowResponse(String flowId, String correlationId) {
144 if (ERROR_FLOW_ID.equals(flowId)) {
148 return new InfoMessage(FLOW_RESPONSE, 0, correlationId, Destination.NORTHBOUND);
void send(String topic, Message message)
Object poll(String correlationId)
static final String TIMEOUT_ERROR_MESSAGE
static final String SYSTEM_CORRELATION_ID
String getCorrelationId()