@Test public void testComputeArpTrueEdge() { IpSpace nextHopIpSpace = new MockIpSpace(1); IpSpace dstIpSpace = new MockIpSpace(2); Edge e1 = Edge.of("c1", "i1", "c2", "i2"); Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeDestIp = ImmutableMap.of("c1", ImmutableMap.of("v1", ImmutableMap.of(e1, dstIpSpace))); Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeNextHopIp = ImmutableMap.of("c1", ImmutableMap.of("v1", ImmutableMap.of(e1, nextHopIpSpace))); Map<String, Map<String, Map<Edge, IpSpace>>> result = computeArpTrueEdge(arpTrueEdgeDestIp, arpTrueEdgeNextHopIp); assertThat( result, hasEntry( equalTo("c1"), hasEntry( equalTo("v1"), hasEntry( equalTo(e1), isAclIpSpaceThat( hasLines( containsInAnyOrder( AclIpSpaceLine.permit(nextHopIpSpace), AclIpSpaceLine.permit(dstIpSpace)))))))); }
@VisibleForTesting static Map<String, Map<String, Map<Edge, IpSpace>>> computeArpTrueEdge( Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeDestIp, Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeNextHopIp) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeArpTrueEdge").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return toImmutableMap( arpTrueEdgeDestIp, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> { Map<Edge, IpSpace> dstIp = vrfEntry.getValue(); Map<Edge, IpSpace> nextHopIp = arpTrueEdgeNextHopIp.get(nodeEntry.getKey()).get(vrfEntry.getKey()); return Sets.union(dstIp.keySet(), nextHopIp.keySet()).stream() .collect( ImmutableMap.toImmutableMap( Function.identity(), edge -> AclIpSpace.union(dstIp.get(edge), nextHopIp.get(edge)))); })); } finally { span.finish(); } }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { @VisibleForTesting static Map<String, Map<String, Map<Edge, IpSpace>>> computeArpTrueEdge( Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeDestIp, Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeNextHopIp) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeArpTrueEdge").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return toImmutableMap( arpTrueEdgeDestIp, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> { Map<Edge, IpSpace> dstIp = vrfEntry.getValue(); Map<Edge, IpSpace> nextHopIp = arpTrueEdgeNextHopIp.get(nodeEntry.getKey()).get(vrfEntry.getKey()); return Sets.union(dstIp.keySet(), nextHopIp.keySet()).stream() .collect( ImmutableMap.toImmutableMap( Function.identity(), edge -> AclIpSpace.union(dstIp.get(edge), nextHopIp.get(edge)))); })); } finally { span.finish(); } } }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { @VisibleForTesting static Map<String, Map<String, Map<Edge, IpSpace>>> computeArpTrueEdge( Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeDestIp, Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeNextHopIp) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeArpTrueEdge").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return toImmutableMap( arpTrueEdgeDestIp, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> { Map<Edge, IpSpace> dstIp = vrfEntry.getValue(); Map<Edge, IpSpace> nextHopIp = arpTrueEdgeNextHopIp.get(nodeEntry.getKey()).get(vrfEntry.getKey()); return Sets.union(dstIp.keySet(), nextHopIp.keySet()).stream() .collect( ImmutableMap.toImmutableMap( Function.identity(), edge -> AclIpSpace.union(dstIp.get(edge), nextHopIp.get(edge)))); })); } 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<Edge, IpSpace>>> computeArpTrueEdge( Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeDestIp, Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeNextHopIp) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeArpTrueEdge").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return toImmutableMap( arpTrueEdgeDestIp, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> { Map<Edge, IpSpace> dstIp = vrfEntry.getValue(); Map<Edge, IpSpace> nextHopIp = arpTrueEdgeNextHopIp.get(nodeEntry.getKey()).get(vrfEntry.getKey()); return Sets.union(dstIp.keySet(), nextHopIp.keySet()).stream() .collect( ImmutableMap.toImmutableMap( Function.identity(), edge -> AclIpSpace.union(dstIp.get(edge), nextHopIp.get(edge)))); })); } 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<Edge, IpSpace>>> computeArpTrueEdge( Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeDestIp, Map<String, Map<String, Map<Edge, IpSpace>>> arpTrueEdgeNextHopIp) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeArpTrueEdge").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return toImmutableMap( arpTrueEdgeDestIp, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> { Map<Edge, IpSpace> dstIp = vrfEntry.getValue(); Map<Edge, IpSpace> nextHopIp = arpTrueEdgeNextHopIp.get(nodeEntry.getKey()).get(vrfEntry.getKey()); return Sets.union(dstIp.keySet(), nextHopIp.keySet()).stream() .collect( ImmutableMap.toImmutableMap( Function.identity(), edge -> AclIpSpace.union(dstIp.get(edge), nextHopIp.get(edge)))); })); } 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();  }