Search in sources :

Example 1 with PersistenceDataAdapter

use of org.openkilda.rulemanager.adapter.PersistenceDataAdapter 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();
}
Also used : PersistenceDataAdapter(org.openkilda.rulemanager.adapter.PersistenceDataAdapter) GroupSpeakerData(org.openkilda.rulemanager.GroupSpeakerData) SwitchId(org.openkilda.model.SwitchId) PathId(org.openkilda.model.PathId) MeterSpeakerData(org.openkilda.rulemanager.MeterSpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) FlowPath(org.openkilda.model.FlowPath) SpeakerData(org.openkilda.rulemanager.SpeakerData) MeterSpeakerData(org.openkilda.rulemanager.MeterSpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) GroupSpeakerData(org.openkilda.rulemanager.GroupSpeakerData)

Aggregations

FlowPath (org.openkilda.model.FlowPath)1 PathId (org.openkilda.model.PathId)1 SwitchId (org.openkilda.model.SwitchId)1 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)1 GroupSpeakerData (org.openkilda.rulemanager.GroupSpeakerData)1 MeterSpeakerData (org.openkilda.rulemanager.MeterSpeakerData)1 SpeakerData (org.openkilda.rulemanager.SpeakerData)1 PersistenceDataAdapter (org.openkilda.rulemanager.adapter.PersistenceDataAdapter)1