use of org.openkilda.messaging.ctrl.state.NetworkDump in project open-kilda by telstra.
the class CacheTopologyTest method cacheReceivesInfoDataBeforeNetworkDump.
@Test
public void cacheReceivesInfoDataBeforeNetworkDump() throws Exception {
System.out.println("Cache receives InfoData before NetworkDump Test");
sendClearState();
waitDumpRequest();
// Send switchUpdate info to not initialized bolt
sendData(sw);
// Bolt must fail that tuple
sendNetworkDumpRequest();
NetworkDump networkDump = getNetworkDump(ctrlConsumer.pollMessage());
assertTrue(CollectionUtils.isEmpty(networkDump.getSwitches()));
// Init bolt with dump from TE
sendNetworkDump(dump);
// Check if SwitchInfoData is ok
sendNetworkDumpRequest();
networkDump = getNetworkDump(ctrlConsumer.pollMessage());
assertFalse(CollectionUtils.isEmpty(networkDump.getSwitches()));
Set<String> flowIds = new HashSet<>(Arrays.asList(firstFlowId, secondFlowId));
ConsumerRecord<String, String> firstRecord = flowConsumer.pollMessage();
assertNotNull(firstRecord);
assertNotNull(firstRecord.value());
CommandMessage commandMessage = objectMapper.readValue(firstRecord.value(), CommandMessage.class);
FlowRestoreRequest commandData = (FlowRestoreRequest) commandMessage.getData();
assertNotNull(commandData);
assertTrue(flowIds.contains(commandData.getPayload().getLeft().getFlowId()));
ConsumerRecord<String, String> secondRecord = flowConsumer.pollMessage();
assertNotNull(secondRecord);
assertNotNull(secondRecord.value());
commandMessage = objectMapper.readValue(secondRecord.value(), CommandMessage.class);
commandData = (FlowRestoreRequest) commandMessage.getData();
assertNotNull(commandData);
assertTrue(flowIds.contains(commandData.getPayload().getLeft().getFlowId()));
}
use of org.openkilda.messaging.ctrl.state.NetworkDump in project open-kilda by telstra.
the class CacheBolt method dumpState.
@Override
public AbstractDumpState dumpState() {
NetworkDump networkDump = new NetworkDump(networkCache.dumpSwitches(), networkCache.dumpIsls());
FlowDump flowDump = new FlowDump(flowCache.dumpFlows());
return new CacheBoltState(networkDump, flowDump);
}
Aggregations