@Test public void testBuildRoutingStepFibNextVrf() { Prefix prefix = Prefix.parse("12.12.12.12/30"); FibNextVrf fibNextVrf = new FibNextVrf("iface1"); Set<FibEntry> fibEntries = ImmutableSet.of( new FibEntry( fibNextVrf, ImmutableList.of( StaticRoute.builder() .setNextHopIp(Ip.parse("2.2.2.2")) .setNetwork(prefix) .setAdministrativeCost(1) .build()))); RoutingStep routingStep = buildRoutingStep(fibNextVrf, fibEntries); assertThat(routingStep.getAction(), equalTo(StepAction.FORWARDED_TO_NEXT_VRF)); assertThat( routingStep.getDetail().getRoutes(), equalTo( ImmutableList.of( new RouteInfo(RoutingProtocol.STATIC, prefix, Ip.parse("2.2.2.2"), null)))); assertThat(routingStep.getDetail().getArpIp(), nullValue()); assertThat(routingStep.getDetail().getOutputInterface(), nullValue()); }
@VisibleForTesting static RoutingStep buildRoutingStep(FibAction fibAction, Set<FibEntry> fibEntries) { RoutingStep.Builder routingStepBuilder = RoutingStep.builder(); RoutingStepDetail.Builder routingStepDetailBuilder = RoutingStepDetail.builder().setRoutes(fibEntriesToRouteInfos(fibEntries)); fibAction.accept( new FibActionVisitor<Void>() { @Override public Void visitFibForward(FibForward fibForward) { routingStepDetailBuilder.setArpIp(fibForward.getArpIp()); routingStepDetailBuilder.setOutputInterface(fibForward.getInterfaceName()); routingStepBuilder.setAction(FORWARDED); return null; } @Override public Void visitFibNextVrf(FibNextVrf fibNextVrf) { routingStepBuilder.setAction(FORWARDED_TO_NEXT_VRF); return null; } @Override public Void visitFibNullRoute(FibNullRoute fibNullRoute) { routingStepBuilder.setAction(NULL_ROUTED); return null; } }); return routingStepBuilder.setDetail(routingStepDetailBuilder.build()).build(); }
FlowTracer { @VisibleForTesting static RoutingStep buildRoutingStep(FibAction fibAction, Set<FibEntry> fibEntries) { RoutingStep.Builder routingStepBuilder = RoutingStep.builder(); RoutingStepDetail.Builder routingStepDetailBuilder = RoutingStepDetail.builder().setRoutes(fibEntriesToRouteInfos(fibEntries)); fibAction.accept( new FibActionVisitor<Void>() { @Override public Void visitFibForward(FibForward fibForward) { routingStepDetailBuilder.setArpIp(fibForward.getArpIp()); routingStepDetailBuilder.setOutputInterface(fibForward.getInterfaceName()); routingStepBuilder.setAction(FORWARDED); return null; } @Override public Void visitFibNextVrf(FibNextVrf fibNextVrf) { routingStepBuilder.setAction(FORWARDED_TO_NEXT_VRF); return null; } @Override public Void visitFibNullRoute(FibNullRoute fibNullRoute) { routingStepBuilder.setAction(NULL_ROUTED); return null; } }); return routingStepBuilder.setDetail(routingStepDetailBuilder.build()).build(); } }
FlowTracer { @VisibleForTesting static RoutingStep buildRoutingStep(FibAction fibAction, Set<FibEntry> fibEntries) { RoutingStep.Builder routingStepBuilder = RoutingStep.builder(); RoutingStepDetail.Builder routingStepDetailBuilder = RoutingStepDetail.builder().setRoutes(fibEntriesToRouteInfos(fibEntries)); fibAction.accept( new FibActionVisitor<Void>() { @Override public Void visitFibForward(FibForward fibForward) { routingStepDetailBuilder.setArpIp(fibForward.getArpIp()); routingStepDetailBuilder.setOutputInterface(fibForward.getInterfaceName()); routingStepBuilder.setAction(FORWARDED); return null; } @Override public Void visitFibNextVrf(FibNextVrf fibNextVrf) { routingStepBuilder.setAction(FORWARDED_TO_NEXT_VRF); return null; } @Override public Void visitFibNullRoute(FibNullRoute fibNullRoute) { routingStepBuilder.setAction(NULL_ROUTED); return null; } }); return routingStepBuilder.setDetail(routingStepDetailBuilder.build()).build(); } @VisibleForTesting  FlowTracer(
      TracerouteEngineImplContext tracerouteContext,
      Configuration currentConfig,
      @Nullable String ingressInterface,
      Node currentNode,
      TraceRecorder traceRecorder,
      @Nullable NodeInterfacePair lastHopNodeAndOutgoingInterface,
      List<FirewallSessionTraceInfo> newSessions,
      Flow originalFlow,
      @Nonnull String vrfName,
      List<HopInfo> hops,
      List<Step<?>> steps,
      Stack<Breadcrumb> breadcrumbs,
      Flow currentFlow,
      int origNewSessionsSize,
      int origBreadcrumbsSize); }
FlowTracer { @VisibleForTesting static RoutingStep buildRoutingStep(FibAction fibAction, Set<FibEntry> fibEntries) { RoutingStep.Builder routingStepBuilder = RoutingStep.builder(); RoutingStepDetail.Builder routingStepDetailBuilder = RoutingStepDetail.builder().setRoutes(fibEntriesToRouteInfos(fibEntries)); fibAction.accept( new FibActionVisitor<Void>() { @Override public Void visitFibForward(FibForward fibForward) { routingStepDetailBuilder.setArpIp(fibForward.getArpIp()); routingStepDetailBuilder.setOutputInterface(fibForward.getInterfaceName()); routingStepBuilder.setAction(FORWARDED); return null; } @Override public Void visitFibNextVrf(FibNextVrf fibNextVrf) { routingStepBuilder.setAction(FORWARDED_TO_NEXT_VRF); return null; } @Override public Void visitFibNullRoute(FibNullRoute fibNullRoute) { routingStepBuilder.setAction(NULL_ROUTED); return null; } }); return routingStepBuilder.setDetail(routingStepDetailBuilder.build()).build(); } @VisibleForTesting  FlowTracer(
      TracerouteEngineImplContext tracerouteContext,
      Configuration currentConfig,
      @Nullable String ingressInterface,
      Node currentNode,
      TraceRecorder traceRecorder,
      @Nullable NodeInterfacePair lastHopNodeAndOutgoingInterface,
      List<FirewallSessionTraceInfo> newSessions,
      Flow originalFlow,
      @Nonnull String vrfName,
      List<HopInfo> hops,
      List<Step<?>> steps,
      Stack<Breadcrumb> breadcrumbs,
      Flow currentFlow,
      int origNewSessionsSize,
      int origBreadcrumbsSize);  }
FlowTracer { @VisibleForTesting static RoutingStep buildRoutingStep(FibAction fibAction, Set<FibEntry> fibEntries) { RoutingStep.Builder routingStepBuilder = RoutingStep.builder(); RoutingStepDetail.Builder routingStepDetailBuilder = RoutingStepDetail.builder().setRoutes(fibEntriesToRouteInfos(fibEntries)); fibAction.accept( new FibActionVisitor<Void>() { @Override public Void visitFibForward(FibForward fibForward) { routingStepDetailBuilder.setArpIp(fibForward.getArpIp()); routingStepDetailBuilder.setOutputInterface(fibForward.getInterfaceName()); routingStepBuilder.setAction(FORWARDED); return null; } @Override public Void visitFibNextVrf(FibNextVrf fibNextVrf) { routingStepBuilder.setAction(FORWARDED_TO_NEXT_VRF); return null; } @Override public Void visitFibNullRoute(FibNullRoute fibNullRoute) { routingStepBuilder.setAction(NULL_ROUTED); return null; } }); return routingStepBuilder.setDetail(routingStepDetailBuilder.build()).build(); } @VisibleForTesting  FlowTracer(
      TracerouteEngineImplContext tracerouteContext,
      Configuration currentConfig,
      @Nullable String ingressInterface,
      Node currentNode,
      TraceRecorder traceRecorder,
      @Nullable NodeInterfacePair lastHopNodeAndOutgoingInterface,
      List<FirewallSessionTraceInfo> newSessions,
      Flow originalFlow,
      @Nonnull String vrfName,
      List<HopInfo> hops,
      List<Step<?>> steps,
      Stack<Breadcrumb> breadcrumbs,
      Flow currentFlow,
      int origNewSessionsSize,
      int origBreadcrumbsSize);   }