class ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable {

  @VisibleForTesting
  static Map<String, Map<String, IpSpace>> computeSomeoneReplies(
      Topology topology, Map<String, Map<String, IpSpace>> arpReplies) {
    Span span =
        GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeSomeoneReplies").start();
    try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) {
      assert scope != null; // avoid unused warning
      Map<String, Map<String, AclIpSpace.Builder>> someoneRepliesByNode = new HashMap<>();
      topology
          .getEdges()
          .forEach(
              edge ->
                  someoneRepliesByNode
                      .computeIfAbsent(edge.getNode1(), n -> new HashMap<>())
                      .computeIfAbsent(edge.getInt1(), i -> AclIpSpace.builder())
                      .thenPermitting((arpReplies.get(edge.getNode2()).get(edge.getInt2()))));
      return someoneRepliesByNode.entrySet().stream()
          .collect(
              ImmutableMap.toImmutableMap(
                  Entry::getKey /* hostname */,
                  someoneRepliesByNodeEntry ->
                      someoneRepliesByNodeEntry.getValue().entrySet().stream()
                          .collect(
                              ImmutableMap.toImmutableMap(
                                  Entry::getKey /* interface */,
                                  someoneRepliesByInterfaceEntry ->
                                      someoneRepliesByInterfaceEntry.getValue().build()))));
    } finally {
      span.finish();
    }
  }

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

}