use of org.openkilda.rulemanager.GroupSpeakerData in project open-kilda by telstra.
the class SwitchValidateFsm method validateEnter.
protected void validateEnter(SwitchValidateState from, SwitchValidateState to, SwitchValidateEvent event, SwitchValidateContext context) {
SwitchId switchId = getSwitchId();
Set<PathId> flowPathIds = flowPathRepository.findBySegmentSwitch(switchId).stream().map(FlowPath::getPathId).collect(Collectors.toSet());
flowPathIds.addAll(flowPathRepository.findByEndpointSwitch(switchId).stream().map(FlowPath::getPathId).collect(Collectors.toSet()));
PersistenceDataAdapter dataAdapter = PersistenceDataAdapter.builder().persistenceManager(persistenceManager).switchIds(Collections.singleton(switchId)).pathIds(flowPathIds).keepMultitableForFlow(true).build();
List<SpeakerData> expectedEntities = ruleManager.buildRulesForSwitch(switchId, dataAdapter);
List<FlowSpeakerData> expectedRules = filterSpeakerData(expectedEntities, FlowSpeakerData.class);
List<MeterSpeakerData> expectedMeters = filterSpeakerData(expectedEntities, MeterSpeakerData.class);
List<GroupSpeakerData> expectedGroups = filterSpeakerData(expectedEntities, GroupSpeakerData.class);
validateRules(expectedRules);
validateMeters(expectedMeters);
validateGroups(expectedGroups);
validateLogicalPorts();
}
use of org.openkilda.rulemanager.GroupSpeakerData in project open-kilda by telstra.
the class RecordHandler method dumpRuleMangerGroupsRequest.
private void dumpRuleMangerGroupsRequest(SwitchId switchId, java.util.function.Consumer<MessageData> sender) {
try {
logger.debug("Loading installed groups for switch {}", switchId);
List<OFGroupDescStatsEntry> ofGroupDescStatsEntries = context.getSwitchManager().dumpGroups(DatapathId.of(switchId.toLong()));
List<GroupSpeakerData> groups = ofGroupDescStatsEntries.stream().map(OfGroupConverter.INSTANCE::convertToGroupSpeakerData).collect(Collectors.toList());
GroupDumpResponse response = GroupDumpResponse.builder().switchId(switchId).groupSpeakerData(groups).build();
sender.accept(response);
} catch (SwitchOperationException e) {
logger.error("Dumping of groups on switch '{}' was unsuccessful: {}", switchId, e.getMessage());
ErrorData errorData = anError(ErrorType.NOT_FOUND).withMessage(e.getMessage()).withDescription("The switch was not found when requesting a groups dump.").buildData();
sender.accept(errorData);
}
}
Aggregations