@Test public void activateWhenPolicyIsNull() { GeneratedRoute gr = _builder.setNetwork(Prefix.ZERO).build(); Builder newRoute = GeneratedRouteHelper.activateGeneratedRoute(gr, null, ImmutableSet.of()); assertThat(newRoute, notNullValue()); }
@Nullable public static GeneratedRoute.Builder activateGeneratedRoute( GeneratedRoute generatedRoute, @Nullable RoutingPolicy policy, Set<AnnotatedRoute<AbstractRoute>> contributingRoutes) { GeneratedRoute.Builder grb = generatedRoute.toBuilder(); if (generatedRoute.getDiscard()) { grb.setNextHopInterface(Interface.NULL_INTERFACE_NAME); } if (policy == null) { return grb; } for (AnnotatedRoute<AbstractRoute> contributingCandidate : contributingRoutes) { if (policy.process(contributingCandidate, grb, Direction.OUT)) { if (!generatedRoute.getDiscard()) { grb.setNextHopIp(contributingCandidate.getAbstractRoute().getNextHopIp()); } return grb; } } return null; }
GeneratedRouteHelper { @Nullable public static GeneratedRoute.Builder activateGeneratedRoute( GeneratedRoute generatedRoute, @Nullable RoutingPolicy policy, Set<AnnotatedRoute<AbstractRoute>> contributingRoutes) { GeneratedRoute.Builder grb = generatedRoute.toBuilder(); if (generatedRoute.getDiscard()) { grb.setNextHopInterface(Interface.NULL_INTERFACE_NAME); } if (policy == null) { return grb; } for (AnnotatedRoute<AbstractRoute> contributingCandidate : contributingRoutes) { if (policy.process(contributingCandidate, grb, Direction.OUT)) { if (!generatedRoute.getDiscard()) { grb.setNextHopIp(contributingCandidate.getAbstractRoute().getNextHopIp()); } return grb; } } return null; } }
GeneratedRouteHelper { @Nullable public static GeneratedRoute.Builder activateGeneratedRoute( GeneratedRoute generatedRoute, @Nullable RoutingPolicy policy, Set<AnnotatedRoute<AbstractRoute>> contributingRoutes) { GeneratedRoute.Builder grb = generatedRoute.toBuilder(); if (generatedRoute.getDiscard()) { grb.setNextHopInterface(Interface.NULL_INTERFACE_NAME); } if (policy == null) { return grb; } for (AnnotatedRoute<AbstractRoute> contributingCandidate : contributingRoutes) { if (policy.process(contributingCandidate, grb, Direction.OUT)) { if (!generatedRoute.getDiscard()) { grb.setNextHopIp(contributingCandidate.getAbstractRoute().getNextHopIp()); } return grb; } } return null; }  }
GeneratedRouteHelper { @Nullable public static GeneratedRoute.Builder activateGeneratedRoute( GeneratedRoute generatedRoute, @Nullable RoutingPolicy policy, Set<AnnotatedRoute<AbstractRoute>> contributingRoutes) { GeneratedRoute.Builder grb = generatedRoute.toBuilder(); if (generatedRoute.getDiscard()) { grb.setNextHopInterface(Interface.NULL_INTERFACE_NAME); } if (policy == null) { return grb; } for (AnnotatedRoute<AbstractRoute> contributingCandidate : contributingRoutes) { if (policy.process(contributingCandidate, grb, Direction.OUT)) { if (!generatedRoute.getDiscard()) { grb.setNextHopIp(contributingCandidate.getAbstractRoute().getNextHopIp()); } return grb; } } return null; }  @Nullable static GeneratedRoute.Builder activateGeneratedRoute(
      GeneratedRoute generatedRoute,
      @Nullable RoutingPolicy policy,
      Set<AnnotatedRoute<AbstractRoute>> contributingRoutes); }
GeneratedRouteHelper { @Nullable public static GeneratedRoute.Builder activateGeneratedRoute( GeneratedRoute generatedRoute, @Nullable RoutingPolicy policy, Set<AnnotatedRoute<AbstractRoute>> contributingRoutes) { GeneratedRoute.Builder grb = generatedRoute.toBuilder(); if (generatedRoute.getDiscard()) { grb.setNextHopInterface(Interface.NULL_INTERFACE_NAME); } if (policy == null) { return grb; } for (AnnotatedRoute<AbstractRoute> contributingCandidate : contributingRoutes) { if (policy.process(contributingCandidate, grb, Direction.OUT)) { if (!generatedRoute.getDiscard()) { grb.setNextHopIp(contributingCandidate.getAbstractRoute().getNextHopIp()); } return grb; } } return null; }  @Nullable static GeneratedRoute.Builder activateGeneratedRoute(
      GeneratedRoute generatedRoute,
      @Nullable RoutingPolicy policy,
      Set<AnnotatedRoute<AbstractRoute>> contributingRoutes);  }