use of org.openkilda.messaging.info.event.SwitchState in project open-kilda by telstra.
the class CacheBolt method onSwitchUp.
private void onSwitchUp(SwitchInfoData sw, Tuple tuple) throws IOException {
logger.info("Switch {} is {}", sw.getSwitchId(), sw.getState().getType());
if (networkCache.cacheContainsSwitch(sw.getSwitchId())) {
SwitchState prevState = networkCache.getSwitch(sw.getSwitchId()).getState();
networkCache.updateSwitch(sw);
if (prevState == SwitchState.CACHED) {
String switchId = sw.getSwitchId();
List<PortInfoData> ports = cacheWarmingService.getPortsForDiscovering(switchId);
logger.info("Found {} links for discovery", ports.size());
sendPortCachedEvent(ports);
List<? extends CommandData> commands = cacheWarmingService.getFlowCommands(switchId);
sendFlowCommands(commands);
}
} else {
networkCache.createSwitch(sw);
}
}
Aggregations