@Test public void shouldIgnoreEffectivelyDownStateIfSamePaths() throws RecoverableException, UnroutableFlowException { Flow origin = makeFlow(); preparePathComputation(origin.getFlowId(), make2SwitchesPathPair()); FlowRerouteService service = makeService(); FlowRerouteRequest request = new FlowRerouteRequest(origin.getFlowId(), false, true, false, Collections.emptySet(), null); service.handleRequest(currentRequestKey, request, commandContext); FlowSegmentRequest speakerRequest; while ((speakerRequest = requests.poll()) != null) { produceAsyncResponse(service, speakerRequest); } Flow result = verifyFlowStatus(origin.getFlowId(), FlowStatus.UP); verifyNoPathReplace(origin, result); }
public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessage()); FlowRerouteFsm fsm = fsms.get(key); if (fsm != null) { removeIfFinished(fsm, key); } return; } final String flowId = reroute.getFlowId(); if (isRerouteAlreadyInProgress(flowId)) { carrier.sendRerouteResultStatus(flowId, new RerouteInProgressError(), commandContext.getCorrelationId()); return; } FlowRerouteFsm fsm = fsmFactory.newInstance(commandContext, flowId); fsms.put(key, fsm); FlowRerouteContext context = FlowRerouteContext.builder() .flowId(flowId) .affectedIsl(reroute.getAffectedIsl()) .forceReroute(reroute.isForce()) .ignoreBandwidth(reroute.isIgnoreBandwidth()) .effectivelyDown(reroute.isEffectivelyDown()) .rerouteReason(reroute.getReason()) .build(); fsmExecutor.fire(fsm, Event.NEXT, context); removeIfFinished(fsm, key); }
FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessage()); FlowRerouteFsm fsm = fsms.get(key); if (fsm != null) { removeIfFinished(fsm, key); } return; } final String flowId = reroute.getFlowId(); if (isRerouteAlreadyInProgress(flowId)) { carrier.sendRerouteResultStatus(flowId, new RerouteInProgressError(), commandContext.getCorrelationId()); return; } FlowRerouteFsm fsm = fsmFactory.newInstance(commandContext, flowId); fsms.put(key, fsm); FlowRerouteContext context = FlowRerouteContext.builder() .flowId(flowId) .affectedIsl(reroute.getAffectedIsl()) .forceReroute(reroute.isForce()) .ignoreBandwidth(reroute.isIgnoreBandwidth()) .effectivelyDown(reroute.isEffectivelyDown()) .rerouteReason(reroute.getReason()) .build(); fsmExecutor.fire(fsm, Event.NEXT, context); removeIfFinished(fsm, key); } }
FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessage()); FlowRerouteFsm fsm = fsms.get(key); if (fsm != null) { removeIfFinished(fsm, key); } return; } final String flowId = reroute.getFlowId(); if (isRerouteAlreadyInProgress(flowId)) { carrier.sendRerouteResultStatus(flowId, new RerouteInProgressError(), commandContext.getCorrelationId()); return; } FlowRerouteFsm fsm = fsmFactory.newInstance(commandContext, flowId); fsms.put(key, fsm); FlowRerouteContext context = FlowRerouteContext.builder() .flowId(flowId) .affectedIsl(reroute.getAffectedIsl()) .forceReroute(reroute.isForce()) .ignoreBandwidth(reroute.isIgnoreBandwidth()) .effectivelyDown(reroute.isEffectivelyDown()) .rerouteReason(reroute.getReason()) .build(); fsmExecutor.fire(fsm, Event.NEXT, context); removeIfFinished(fsm, key); } FlowRerouteService(FlowRerouteHubCarrier carrier, PersistenceManager persistenceManager,
                              PathComputer pathComputer, FlowResourcesManager flowResourcesManager,
                              int pathAllocationRetriesLimit, int pathAllocationRetryDelay,
                              int speakerCommandRetriesLimit); }
FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessage()); FlowRerouteFsm fsm = fsms.get(key); if (fsm != null) { removeIfFinished(fsm, key); } return; } final String flowId = reroute.getFlowId(); if (isRerouteAlreadyInProgress(flowId)) { carrier.sendRerouteResultStatus(flowId, new RerouteInProgressError(), commandContext.getCorrelationId()); return; } FlowRerouteFsm fsm = fsmFactory.newInstance(commandContext, flowId); fsms.put(key, fsm); FlowRerouteContext context = FlowRerouteContext.builder() .flowId(flowId) .affectedIsl(reroute.getAffectedIsl()) .forceReroute(reroute.isForce()) .ignoreBandwidth(reroute.isIgnoreBandwidth()) .effectivelyDown(reroute.isEffectivelyDown()) .rerouteReason(reroute.getReason()) .build(); fsmExecutor.fire(fsm, Event.NEXT, context); removeIfFinished(fsm, key); } FlowRerouteService(FlowRerouteHubCarrier carrier, PersistenceManager persistenceManager,
                              PathComputer pathComputer, FlowResourcesManager flowResourcesManager,
                              int pathAllocationRetriesLimit, int pathAllocationRetryDelay,
                              int speakerCommandRetriesLimit); void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext); void handleAsyncResponse(String key, SpeakerFlowSegmentResponse flowResponse); void handleTimeout(String key); }
FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessage()); FlowRerouteFsm fsm = fsms.get(key); if (fsm != null) { removeIfFinished(fsm, key); } return; } final String flowId = reroute.getFlowId(); if (isRerouteAlreadyInProgress(flowId)) { carrier.sendRerouteResultStatus(flowId, new RerouteInProgressError(), commandContext.getCorrelationId()); return; } FlowRerouteFsm fsm = fsmFactory.newInstance(commandContext, flowId); fsms.put(key, fsm); FlowRerouteContext context = FlowRerouteContext.builder() .flowId(flowId) .affectedIsl(reroute.getAffectedIsl()) .forceReroute(reroute.isForce()) .ignoreBandwidth(reroute.isIgnoreBandwidth()) .effectivelyDown(reroute.isEffectivelyDown()) .rerouteReason(reroute.getReason()) .build(); fsmExecutor.fire(fsm, Event.NEXT, context); removeIfFinished(fsm, key); } FlowRerouteService(FlowRerouteHubCarrier carrier, PersistenceManager persistenceManager,
                              PathComputer pathComputer, FlowResourcesManager flowResourcesManager,
                              int pathAllocationRetriesLimit, int pathAllocationRetryDelay,
                              int speakerCommandRetriesLimit); void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext); void handleAsyncResponse(String key, SpeakerFlowSegmentResponse flowResponse); void handleTimeout(String key);  }