@Test public void testComputeNextVrfIpsByNodeVrf() { String c1 = "c1"; String v1 = "v1"; String v2 = "v2"; Map<String, Map<String, Fib>> fibs = ImmutableMap.of( c1, ImmutableMap.of( v1, MockFib.builder() .setMatchingIps(ImmutableMap.of(P1, P1_1.toIpSpace())) .setFibEntries( ImmutableMap.of( Ip.ZERO, ImmutableSet.of( new FibEntry( new FibNextVrf(v2), ImmutableList.of( StaticRoute.builder() .setAdmin(1) .setNetwork(P1) .setNextVrf(v2) .build()))))) .build(), v2, MockFib.builder() .setMatchingIps(ImmutableMap.of(P2, P2_2.toIpSpace())) .setFibEntries( ImmutableMap.of( Ip.ZERO, ImmutableSet.of( new FibEntry( new FibNextVrf(v1), ImmutableList.of( StaticRoute.builder() .setAdmin(1) .setNetwork(P2) .setNextVrf(v1) .build()))))) .build())); assertThat( computeNextVrfIpsByNodeVrf(computeMatchingIps(fibs), fibs), equalTo( ImmutableMap.of( c1, ImmutableMap.of( v1, ImmutableMap.of(v2, P1_1.toIpSpace()), v2, ImmutableMap.of(v1, P2_2.toIpSpace()))))); }
@VisibleForTesting static Map<String, Map<String, Map<String, IpSpace>>> computeNextVrfIpsByNodeVrf( Map<String, Map<String, Map<Prefix, IpSpace>>> matchingIps, Map<String, Map<String, Fib>> fibs) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeNextVrfIps").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return fibs.entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey , fibsByHostnameEntry -> { String hostname = fibsByHostnameEntry.getKey(); return fibsByHostnameEntry.getValue().entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey , fibsByVrfEntry -> computeNextVrfIps( fibsByVrfEntry.getValue(), matchingIps .get(hostname) .get(fibsByVrfEntry.getKey()) ))); })); } finally { span.finish(); } }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { @VisibleForTesting static Map<String, Map<String, Map<String, IpSpace>>> computeNextVrfIpsByNodeVrf( Map<String, Map<String, Map<Prefix, IpSpace>>> matchingIps, Map<String, Map<String, Fib>> fibs) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeNextVrfIps").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return fibs.entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey , fibsByHostnameEntry -> { String hostname = fibsByHostnameEntry.getKey(); return fibsByHostnameEntry.getValue().entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey , fibsByVrfEntry -> computeNextVrfIps( fibsByVrfEntry.getValue(), matchingIps .get(hostname) .get(fibsByVrfEntry.getKey()) ))); })); } finally { span.finish(); } } }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { @VisibleForTesting static Map<String, Map<String, Map<String, IpSpace>>> computeNextVrfIpsByNodeVrf( Map<String, Map<String, Map<Prefix, IpSpace>>> matchingIps, Map<String, Map<String, Fib>> fibs) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeNextVrfIps").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return fibs.entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey , fibsByHostnameEntry -> { String hostname = fibsByHostnameEntry.getKey(); return fibsByHostnameEntry.getValue().entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey , fibsByVrfEntry -> computeNextVrfIps( fibsByVrfEntry.getValue(), matchingIps .get(hostname) .get(fibsByVrfEntry.getKey()) ))); })); } 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, IpSpace>>> computeNextVrfIpsByNodeVrf( Map<String, Map<String, Map<Prefix, IpSpace>>> matchingIps, Map<String, Map<String, Fib>> fibs) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeNextVrfIps").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return fibs.entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey , fibsByHostnameEntry -> { String hostname = fibsByHostnameEntry.getKey(); return fibsByHostnameEntry.getValue().entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey , fibsByVrfEntry -> computeNextVrfIps( fibsByVrfEntry.getValue(), matchingIps .get(hostname) .get(fibsByVrfEntry.getKey()) ))); })); } 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, IpSpace>>> computeNextVrfIpsByNodeVrf( Map<String, Map<String, Map<Prefix, IpSpace>>> matchingIps, Map<String, Map<String, Fib>> fibs) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeNextVrfIps").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return fibs.entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey , fibsByHostnameEntry -> { String hostname = fibsByHostnameEntry.getKey(); return fibsByHostnameEntry.getValue().entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey , fibsByVrfEntry -> computeNextVrfIps( fibsByVrfEntry.getValue(), matchingIps .get(hostname) .get(fibsByVrfEntry.getKey()) ))); })); } 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();  }