@Test public void testComputeRoutesWithNextHopIpArpFalse() { String c1 = "c1"; String v1 = "v1"; String i1 = "i1"; AbstractRoute r1 = StaticRoute.builder() .setNetwork(P1) .setNextHopIp(P2.getStartIp()) .setAdministrativeCost(1) .build(); Map<String, Map<String, Map<String, Set<AbstractRoute>>>> routesWithNextHop = ImmutableMap.of(c1, ImmutableMap.of(v1, ImmutableMap.of(i1, ImmutableSet.of(r1)))); AbstractRoute ifaceRoute = new ConnectedRoute(P2, i1); Map<String, Map<String, Map<AbstractRoute, Map<String, Map<Ip, Set<AbstractRoute>>>>>> nextHopInterfacesByNodeVrf = ImmutableMap.of( c1, ImmutableMap.of( v1, ImmutableMap.of( r1, ImmutableMap.of( i1, ImmutableMap.of(r1.getNextHopIp(), ImmutableSet.of(ifaceRoute)))))); Map<String, Map<String, IpSpace>> someoneReplies = ImmutableMap.of(c1, ImmutableMap.of(i1, P2.getEndIp().toIpSpace())); Map<String, Map<String, Map<String, Set<AbstractRoute>>>> result = computeRoutesWithNextHopIpArpFalse( nextHopInterfacesByNodeVrf, routesWithNextHop, someoneReplies); assertThat( result, equalTo( ImmutableMap.of(c1, ImmutableMap.of(v1, ImmutableMap.of(i1, ImmutableSet.of(r1)))))); }
@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; return toImmutableMap( routesWithNextHop, Entry::getKey , nodeEntry -> { String hostname = nodeEntry.getKey(); Map<String, IpSpace> nodeSomeoneReplies = someoneReplies.getOrDefault(hostname, ImmutableMap.of()); return toImmutableMap( nodeEntry.getValue(), Entry::getKey, 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, ifaceEntry -> { String outInterface = ifaceEntry.getKey(); Set<AbstractRoute> candidateRoutes = ifaceEntry.getValue(); return computeRoutesWithNextHopIpArpFalseForInterface( nextHopInterfaces, outInterface, candidateRoutes, nodeSomeoneReplies); }); }); }); } finally { span.finish(); } }
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; return toImmutableMap( routesWithNextHop, Entry::getKey , nodeEntry -> { String hostname = nodeEntry.getKey(); Map<String, IpSpace> nodeSomeoneReplies = someoneReplies.getOrDefault(hostname, ImmutableMap.of()); return toImmutableMap( nodeEntry.getValue(), Entry::getKey, 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, ifaceEntry -> { String outInterface = ifaceEntry.getKey(); Set<AbstractRoute> candidateRoutes = ifaceEntry.getValue(); return computeRoutesWithNextHopIpArpFalseForInterface( nextHopInterfaces, outInterface, candidateRoutes, nodeSomeoneReplies); }); }); }); } finally { span.finish(); } } }
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; return toImmutableMap( routesWithNextHop, Entry::getKey , nodeEntry -> { String hostname = nodeEntry.getKey(); Map<String, IpSpace> nodeSomeoneReplies = someoneReplies.getOrDefault(hostname, ImmutableMap.of()); return toImmutableMap( nodeEntry.getValue(), Entry::getKey, 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, ifaceEntry -> { String outInterface = ifaceEntry.getKey(); Set<AbstractRoute> candidateRoutes = ifaceEntry.getValue(); return computeRoutesWithNextHopIpArpFalseForInterface( nextHopInterfaces, outInterface, candidateRoutes, nodeSomeoneReplies); }); }); }); } finally { span.finish(); } } ForwardingAnalysisImpl(
      Map<String, Configuration> configurations,
      Map<String, Map<String, Fib>> fibs,
      Topology topology,
      Map<Location, LocationInfo> locationInfo); }
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; return toImmutableMap( routesWithNextHop, Entry::getKey , nodeEntry -> { String hostname = nodeEntry.getKey(); Map<String, IpSpace> nodeSomeoneReplies = someoneReplies.getOrDefault(hostname, ImmutableMap.of()); return toImmutableMap( nodeEntry.getValue(), Entry::getKey, 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, ifaceEntry -> { String outInterface = ifaceEntry.getKey(); Set<AbstractRoute> candidateRoutes = ifaceEntry.getValue(); return computeRoutesWithNextHopIpArpFalseForInterface( nextHopInterfaces, outInterface, candidateRoutes, nodeSomeoneReplies); }); }); }); } finally { span.finish(); } } ForwardingAnalysisImpl(
      Map<String, Configuration> configurations,
      Map<String, Map<String, Fib>> fibs,
      Topology topology,
      Map<Location, LocationInfo> locationInfo); @Nonnull @Override Map<String, Map<String, Map<String, IpSpace>>> getAcceptsIps(); @Override Map<String, Map<String, IpSpace>> getArpReplies(); @Override Map<String, Map<String, Map<Edge, IpSpace>>> getArpTrueEdge(); @Override Map<String, Map<String, Map<String, IpSpace>>> getNextVrfIps(); @Override Map<String, Map<String, IpSpace>> getNullRoutedIps(); @Override Map<String, Map<String, IpSpace>> getRoutableIps(); @Override Map<String, Map<String, Map<String, IpSpace>>> getDeliveredToSubnet(); @Override Map<String, Map<String, Map<String, IpSpace>>> getExitsNetwork(); @Override Map<String, Map<String, Map<String, IpSpace>>> getNeighborUnreachable(); @Override Map<String, Map<String, Map<String, IpSpace>>> getInsufficientInfo(); }
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; return toImmutableMap( routesWithNextHop, Entry::getKey , nodeEntry -> { String hostname = nodeEntry.getKey(); Map<String, IpSpace> nodeSomeoneReplies = someoneReplies.getOrDefault(hostname, ImmutableMap.of()); return toImmutableMap( nodeEntry.getValue(), Entry::getKey, 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, ifaceEntry -> { String outInterface = ifaceEntry.getKey(); Set<AbstractRoute> candidateRoutes = ifaceEntry.getValue(); return computeRoutesWithNextHopIpArpFalseForInterface( nextHopInterfaces, outInterface, candidateRoutes, nodeSomeoneReplies); }); }); }); } finally { span.finish(); } } ForwardingAnalysisImpl(
      Map<String, Configuration> configurations,
      Map<String, Map<String, Fib>> fibs,
      Topology topology,
      Map<Location, LocationInfo> locationInfo); @Nonnull @Override Map<String, Map<String, Map<String, IpSpace>>> getAcceptsIps(); @Override Map<String, Map<String, IpSpace>> getArpReplies(); @Override Map<String, Map<String, Map<Edge, IpSpace>>> getArpTrueEdge(); @Override Map<String, Map<String, Map<String, IpSpace>>> getNextVrfIps(); @Override Map<String, Map<String, IpSpace>> getNullRoutedIps(); @Override Map<String, Map<String, IpSpace>> getRoutableIps(); @Override Map<String, Map<String, Map<String, IpSpace>>> getDeliveredToSubnet(); @Override Map<String, Map<String, Map<String, IpSpace>>> getExitsNetwork(); @Override Map<String, Map<String, Map<String, IpSpace>>> getNeighborUnreachable(); @Override Map<String, Map<String, Map<String, IpSpace>>> getInsufficientInfo();  }