use of org.openkilda.wfm.topology.flowhs.service.yflow.YFlowValidationHubCarrier in project open-kilda by telstra.
the class DumpYFlowResourcesAction method perform.
@Override
protected void perform(State from, State to, Event event, YFlowValidationContext context, YFlowValidationFsm stateMachine) {
String yFlowId = stateMachine.getYFlowId();
YFlow yFlow = yFlowRepository.findById(yFlowId).orElseThrow(() -> new FlowProcessingException(ErrorType.NOT_FOUND, format("Y-flow %s not found", yFlowId)));
log.debug("Start validating y-flow {} resources", yFlowId);
List<SwitchId> switchIds = Stream.of(yFlow.getSharedEndpoint().getSwitchId(), yFlow.getYPoint(), yFlow.getProtectedPathYPoint()).filter(Objects::nonNull).collect(Collectors.toList());
int switchCount = switchIds.size();
stateMachine.setAwaitingRules(switchCount);
stateMachine.setAwaitingMeters(switchCount);
log.debug("Send commands to get rules & meters on {} switches", switchCount);
YFlowValidationHubCarrier carrier = stateMachine.getCarrier();
switchIds.forEach(switchId -> {
carrier.sendSpeakerRequest(yFlowId, new DumpRulesForFlowHsRequest(switchId));
carrier.sendSpeakerRequest(yFlowId, new DumpMetersForFlowHsRequest(switchId));
});
}
Aggregations