@Test public void processDeleted() throws Exception { final List<RoutingDefinition> outcome = new ArrayList<>(); Mockito.when(routingService.removeRouteForCurrentService()).thenReturn(true); final RoutingDefinition deadman = leftSide.get(0); reactor.getRoutingServiceMap().put(deadman.getIpAddress(), routingService); reactor.processDeleted(mapDifference, outcome); Assert.assertEquals(0, outcome.size()); }
@VisibleForTesting void processDeleted(final MapDifference<IpAddress, RoutingDefinition> routingDifference, final List<RoutingDefinition> outcomingRouteDefinitions) { routingDifference.entriesOnlyOnLeft().forEach((vIpAddress, routingDef) -> { final Routing routingService = routingServiceMap.remove(vIpAddress); if (routingService != null) { findSxpNodesOnVirtualIp(vIpAddress).forEach(SxpNode::shutdown); final boolean succeeded = routingService.removeRouteForCurrentService(); if (!succeeded) { LOG.warn("Route cannot be closed (D): {}", routingService); outcomingRouteDefinitions.add(RouteUtil.createOperationalRouteDefinition(routingDef, false, "route can not be closed (by remove)")); } } }); }
RouteReactorImpl implements RouteReactor { @VisibleForTesting void processDeleted(final MapDifference<IpAddress, RoutingDefinition> routingDifference, final List<RoutingDefinition> outcomingRouteDefinitions) { routingDifference.entriesOnlyOnLeft().forEach((vIpAddress, routingDef) -> { final Routing routingService = routingServiceMap.remove(vIpAddress); if (routingService != null) { findSxpNodesOnVirtualIp(vIpAddress).forEach(SxpNode::shutdown); final boolean succeeded = routingService.removeRouteForCurrentService(); if (!succeeded) { LOG.warn("Route cannot be closed (D): {}", routingService); outcomingRouteDefinitions.add(RouteUtil.createOperationalRouteDefinition(routingDef, false, "route can not be closed (by remove)")); } } }); } }
RouteReactorImpl implements RouteReactor { @VisibleForTesting void processDeleted(final MapDifference<IpAddress, RoutingDefinition> routingDifference, final List<RoutingDefinition> outcomingRouteDefinitions) { routingDifference.entriesOnlyOnLeft().forEach((vIpAddress, routingDef) -> { final Routing routingService = routingServiceMap.remove(vIpAddress); if (routingService != null) { findSxpNodesOnVirtualIp(vIpAddress).forEach(SxpNode::shutdown); final boolean succeeded = routingService.removeRouteForCurrentService(); if (!succeeded) { LOG.warn("Route cannot be closed (D): {}", routingService); outcomingRouteDefinitions.add(RouteUtil.createOperationalRouteDefinition(routingDef, false, "route can not be closed (by remove)")); } } }); } RouteReactorImpl(final DataBroker dataBroker, final RoutingServiceFactory routingServiceFactory); }
RouteReactorImpl implements RouteReactor { @VisibleForTesting void processDeleted(final MapDifference<IpAddress, RoutingDefinition> routingDifference, final List<RoutingDefinition> outcomingRouteDefinitions) { routingDifference.entriesOnlyOnLeft().forEach((vIpAddress, routingDef) -> { final Routing routingService = routingServiceMap.remove(vIpAddress); if (routingService != null) { findSxpNodesOnVirtualIp(vIpAddress).forEach(SxpNode::shutdown); final boolean succeeded = routingService.removeRouteForCurrentService(); if (!succeeded) { LOG.warn("Route cannot be closed (D): {}", routingService); outcomingRouteDefinitions.add(RouteUtil.createOperationalRouteDefinition(routingDef, false, "route can not be closed (by remove)")); } } }); } RouteReactorImpl(final DataBroker dataBroker, final RoutingServiceFactory routingServiceFactory); @Override FluentFuture<? extends CommitInfo> updateRouting(@Nullable final SxpClusterRoute oldRoute,
                                                            @Nullable final SxpClusterRoute newRoute); @Override FluentFuture<? extends CommitInfo> wipeRouting(); }
RouteReactorImpl implements RouteReactor { @VisibleForTesting void processDeleted(final MapDifference<IpAddress, RoutingDefinition> routingDifference, final List<RoutingDefinition> outcomingRouteDefinitions) { routingDifference.entriesOnlyOnLeft().forEach((vIpAddress, routingDef) -> { final Routing routingService = routingServiceMap.remove(vIpAddress); if (routingService != null) { findSxpNodesOnVirtualIp(vIpAddress).forEach(SxpNode::shutdown); final boolean succeeded = routingService.removeRouteForCurrentService(); if (!succeeded) { LOG.warn("Route cannot be closed (D): {}", routingService); outcomingRouteDefinitions.add(RouteUtil.createOperationalRouteDefinition(routingDef, false, "route can not be closed (by remove)")); } } }); } RouteReactorImpl(final DataBroker dataBroker, final RoutingServiceFactory routingServiceFactory); @Override FluentFuture<? extends CommitInfo> updateRouting(@Nullable final SxpClusterRoute oldRoute,
                                                            @Nullable final SxpClusterRoute newRoute); @Override FluentFuture<? extends CommitInfo> wipeRouting();  }