use of org.openkilda.rulemanager.DataAdapter in project open-kilda by telstra.
the class YFlowRuleManagerProcessingAction method buildYFlowSpeakerData.
private Map<SwitchId, List<SpeakerData>> buildYFlowSpeakerData(YFlow yFlow) {
List<FlowPath> flowPaths = yFlow.getSubFlows().stream().map(YSubFlow::getFlow).map(Flow::getPaths).flatMap(Collection::stream).collect(toList());
Set<SwitchId> switchIds = Sets.newHashSet(yFlow.getSharedEndpoint().getSwitchId(), yFlow.getYPoint(), yFlow.getProtectedPathYPoint());
Set<PathId> pathIds = flowPaths.stream().map(FlowPath::getPathId).collect(Collectors.toSet());
DataAdapter dataAdapter = PersistenceDataAdapter.builder().persistenceManager(persistenceManager).switchIds(switchIds).pathIds(pathIds).build();
return ruleManager.buildRulesForYFlow(flowPaths, dataAdapter).stream().collect(Collectors.groupingBy(SpeakerData::getSwitchId, Collectors.mapping(Function.identity(), toList())));
}
use of org.openkilda.rulemanager.DataAdapter in project open-kilda by telstra.
the class UpdateYFlowRulesAction method buildYFlowOfCommands.
private List<OfCommand> buildYFlowOfCommands(SwitchId switchId, PathId pathId) {
DataAdapter dataAdapter = PersistenceDataAdapter.builder().persistenceManager(persistenceManager).switchIds(singleton(switchId)).pathIds(singleton(pathId)).build();
List<SpeakerData> speakerData = ruleManager.buildRulesForSwitch(switchId, dataAdapter);
return speakerData.stream().filter(data -> data instanceof FlowSpeakerData).map(data -> new FlowCommand((FlowSpeakerData) data)).collect(toList());
}
Aggregations