use of org.openkilda.messaging.info.InfoMessage in project open-kilda by telstra.
the class HealthCheckBolt method execute.
@Override
public void execute(Tuple input) {
String request = input.getString(0);
try {
Message message = MAPPER.readValue(request, Message.class);
if (message instanceof CommandMessage) {
Values values = new Values(Utils.MAPPER.writeValueAsString(new InfoMessage(healthCheck, System.currentTimeMillis(), message.getCorrelationId(), Destination.NORTHBOUND)));
collector.emit(Topic.HEALTH_CHECK, input, values);
}
} catch (IOException exception) {
logger.error("Could not deserialize message: ", request, exception);
} finally {
collector.ack(input);
}
}
use of org.openkilda.messaging.info.InfoMessage in project open-kilda by telstra.
the class SpeakerBoltTest method testAddSwitchValues.
@Test
public void testAddSwitchValues() throws Exception {
List<Values> values = speakerBolt.addSwitch(switchMessage);
assertEquals(3, values.size());
int count = 0;
for (Values value : values) {
InfoMessage infoMessage = mapper.readValue((String) value.get(1), InfoMessage.class);
if (count < 2) {
assertThat(infoMessage.getData(), instanceOf(SwitchInfoData.class));
SwitchInfoData sw = (SwitchInfoData) infoMessage.getData();
assertEquals("00:00:" + dpid, sw.getSwitchId());
} else {
assertThat(infoMessage.getData(), instanceOf(PortInfoData.class));
PortInfoData port = (PortInfoData) infoMessage.getData();
assertEquals("00:00:" + dpid, port.getSwitchId());
if (port.getPortNo() == localLinkPort) {
assertEquals(PortChangeType.UP, port.getState());
} else {
assertEquals(PortChangeType.DOWN, port.getState());
}
}
count++;
}
}
use of org.openkilda.messaging.info.InfoMessage in project open-kilda by telstra.
the class CacheTopologyTest method sendFlowUpdate.
private static void sendFlowUpdate(ImmutablePair<Flow, Flow> flow) throws IOException {
System.out.println("Flow Topology: Send Flow Creation Request");
String correlationId = UUID.randomUUID().toString();
FlowInfoData data = new FlowInfoData(flow.getLeft().getFlowId(), flow, FlowOperation.CREATE, correlationId);
// TODO: as part of getting rid of OutputTopic, used TopoDiscoTopic. This feels wrong for
// Flows.
InfoMessage message = new InfoMessage(data, System.currentTimeMillis(), correlationId);
sendMessage(message, topology.getConfig().getKafkaTopoCacheTopic());
}
use of org.openkilda.messaging.info.InfoMessage in project open-kilda by telstra.
the class CacheTopologyTest method sendNetworkDump.
private static void sendNetworkDump(NetworkInfoData data) throws IOException {
System.out.println("Topology-Engine: Send Network Dump");
InfoMessage info = new InfoMessage(data, 0, UUID.randomUUID().toString(), Destination.WFM_CACHE);
sendMessage(info, topology.getConfig().getKafkaTopoCacheTopic());
}
use of org.openkilda.messaging.info.InfoMessage in project open-kilda by telstra.
the class CacheTopologyTest method cacheReceivesFlowTopologyUpdatesAndSendsToTopologyEngine.
@Test
public void cacheReceivesFlowTopologyUpdatesAndSendsToTopologyEngine() throws Exception {
System.out.println("Flow Update Test");
teConsumer.clear();
sendFlowUpdate(thirdFlow);
ConsumerRecord<String, String> flow = teConsumer.pollMessage();
assertNotNull(flow);
assertNotNull(flow.value());
InfoMessage infoMessage = objectMapper.readValue(flow.value(), InfoMessage.class);
FlowInfoData infoData = (FlowInfoData) infoMessage.getData();
assertNotNull(infoData);
assertEquals(thirdFlow, infoData.getPayload());
}
Aggregations