@Test public void testComputeRoutableIps() { String c1 = "c1"; String v1 = "v1"; Prefix prefix = Prefix.parse("1.0.0.0/8"); MockFib fib = MockFib.builder() .setFibEntries( ImmutableMap.of( Ip.ZERO, ImmutableSet.of( new FibEntry( new FibForward(Ip.ZERO, "iface"), ImmutableList.of( StaticRoute.builder() .setAdministrativeCost(1) .setNetwork(prefix) .build()))))) .build(); Map<String, Map<String, Fib>> fibs = ImmutableMap.of(c1, ImmutableMap.of(v1, fib)); Map<String, Map<String, IpSpace>> result = ForwardingAnalysisImpl.computeRoutableIps(fibs); assertThat( result, equalTo( ImmutableMap.of( c1, ImmutableMap.of( v1, IpWildcardSetIpSpace.builder().including(IpWildcard.create(prefix)).build())))); }
@VisibleForTesting static Map<String, Map<String, IpSpace>> computeRoutableIps(Map<String, Map<String, Fib>> fibs) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeRoutableIps").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return toImmutableMap( fibs, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> new IpWildcardSetIpSpace( ImmutableSortedSet.of(), vrfEntry.getValue().allEntries().stream() .map( fibEntry -> IpWildcard.create(fibEntry.getTopLevelRoute().getNetwork())) .collect(ImmutableSortedSet.toImmutableSortedSet(natural()))))); } finally { span.finish(); } }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { @VisibleForTesting static Map<String, Map<String, IpSpace>> computeRoutableIps(Map<String, Map<String, Fib>> fibs) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeRoutableIps").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return toImmutableMap( fibs, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> new IpWildcardSetIpSpace( ImmutableSortedSet.of(), vrfEntry.getValue().allEntries().stream() .map( fibEntry -> IpWildcard.create(fibEntry.getTopLevelRoute().getNetwork())) .collect(ImmutableSortedSet.toImmutableSortedSet(natural()))))); } finally { span.finish(); } } }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { @VisibleForTesting static Map<String, Map<String, IpSpace>> computeRoutableIps(Map<String, Map<String, Fib>> fibs) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeRoutableIps").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return toImmutableMap( fibs, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> new IpWildcardSetIpSpace( ImmutableSortedSet.of(), vrfEntry.getValue().allEntries().stream() .map( fibEntry -> IpWildcard.create(fibEntry.getTopLevelRoute().getNetwork())) .collect(ImmutableSortedSet.toImmutableSortedSet(natural()))))); } 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, IpSpace>> computeRoutableIps(Map<String, Map<String, Fib>> fibs) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeRoutableIps").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return toImmutableMap( fibs, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> new IpWildcardSetIpSpace( ImmutableSortedSet.of(), vrfEntry.getValue().allEntries().stream() .map( fibEntry -> IpWildcard.create(fibEntry.getTopLevelRoute().getNetwork())) .collect(ImmutableSortedSet.toImmutableSortedSet(natural()))))); } 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, IpSpace>> computeRoutableIps(Map<String, Map<String, Fib>> fibs) { Span span = GlobalTracer.get().buildSpan("ForwardingAnalysisImpl.computeRoutableIps").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; return toImmutableMap( fibs, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> new IpWildcardSetIpSpace( ImmutableSortedSet.of(), vrfEntry.getValue().allEntries().stream() .map( fibEntry -> IpWildcard.create(fibEntry.getTopLevelRoute().getNetwork())) .collect(ImmutableSortedSet.toImmutableSortedSet(natural()))))); } 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();  }