class ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable {

  @VisibleForTesting
  static Map<String, Map<String, Map<String, Set<AbstractRoute>>>>
      computeRoutesWithNextHopIpArpFalse(
          Map<String, Map<String, Map<AbstractRoute, Map<String, Map<Ip, Set<AbstractRoute>>>>>>
              nextHopInterfacesByNodeVrf,
          Map<String, Map<String, Map<String, Set<AbstractRoute>>>> routesWithNextHop,
          Map<String, Map<String, IpSpace>> someoneReplies) {
    Span span =
        GlobalTracer.get()
            .buildSpan("ForwardingAnalysisImpl.computeRoutesWithNextHopIpArpFalse")
            .start();
    try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) {
      assert scope != null; // avoid unused warning
      return toImmutableMap(
          routesWithNextHop,
          Entry::getKey /* hostname */,
          nodeEntry -> {
            String hostname = nodeEntry.getKey();
            Map<String, IpSpace> nodeSomeoneReplies =
                someoneReplies.getOrDefault(hostname, ImmutableMap.of());
            return toImmutableMap(
                nodeEntry.getValue(),
                Entry::getKey, /* vrf */
                vrfEntry -> {
                  String vrf = vrfEntry.getKey();
                  Map<AbstractRoute, Map<String, Map<Ip, Set<AbstractRoute>>>> nextHopInterfaces =
                      nextHopInterfacesByNodeVrf.get(hostname).get(vrf);
                  return toImmutableMap(
                      vrfEntry.getValue(),
                      Entry::getKey, /* outInterface */
                      ifaceEntry -> {
                        String outInterface = ifaceEntry.getKey();
                        Set<AbstractRoute> candidateRoutes = ifaceEntry.getValue();
                        return computeRoutesWithNextHopIpArpFalseForInterface(
                            nextHopInterfaces, outInterface, candidateRoutes, nodeSomeoneReplies);
                      });
                });
          });
    } finally {
      span.finish();
    }
  }

  public  ForwardingAnalysisImpl(
      Map<String, Configuration> configurations,
      Map<String, Map<String, Fib>> fibs,
      Topology topology,
      Map<Location, LocationInfo> locationInfo);

}