@Test public void testComputeNeighborUnreachableOrExitsNetwork() { String c1 = "c1"; String v1 = "v1"; String i1 = "i1"; Map<String, Map<String, Map<String, IpSpace>>> arpFalseDestIp = ImmutableMap.of(c1, ImmutableMap.of(v1, ImmutableMap.of(i1, P1.getStartIp().toIpSpace()))); Map<String, Map<String, Map<String, IpSpace>>> arpFalseNextHopIp = ImmutableMap.of(c1, ImmutableMap.of(v1, ImmutableMap.of(i1, P1.getEndIp().toIpSpace()))); Map<String, Map<String, Map<String, IpSpace>>> result = union(arpFalseDestIp, arpFalseNextHopIp); assertThat( result, hasEntry( equalTo(c1), hasEntry(equalTo(v1), hasEntry(equalTo(i1), containsIp(P1.getStartIp()))))); assertThat( result, hasEntry( equalTo(c1), hasEntry(equalTo(v1), hasEntry(equalTo(i1), containsIp(P1.getEndIp()))))); assertThat( result, hasEntry( equalTo(c1), hasEntry(equalTo(v1), hasEntry(equalTo(i1), not(containsIp(P2.getEndIp())))))); }
static Map<String, Map<String, Map<String, IpSpace>>> union( Map<String, Map<String, Map<String, IpSpace>>> ipSpaces1, Map<String, Map<String, Map<String, IpSpace>>> ipSpaces2) { Span span = GlobalTracer.get().buildSpan("construct union").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; checkArgument( ipSpaces1.keySet().equals(ipSpaces2.keySet()), "Can't union with different nodes: %s and %s", ipSpaces1.keySet(), ipSpaces2.keySet()); return toImmutableMap( ipSpaces1, Entry::getKey, nodeEntry -> { Map<String, Map<String, IpSpace>> nodeIpSpace2 = ipSpaces2.get(nodeEntry.getKey()); checkArgument( nodeIpSpace2.keySet().equals(nodeEntry.getValue().keySet()), "Can't union with different VRFs in node %s: %s and %s", nodeEntry.getKey(), nodeEntry.getValue().keySet(), nodeIpSpace2.keySet()); return toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> { Map<String, IpSpace> vrfIpSpaces2 = nodeIpSpace2.get(vrfEntry.getKey()); checkArgument( vrfIpSpaces2.keySet().equals(vrfEntry.getValue().keySet()), "Can't union with different interfaces in node %s VRF %s: %s and %s", nodeEntry.getKey(), vrfEntry.getKey(), vrfEntry.getValue().keySet(), vrfIpSpaces2.keySet()); return toImmutableMap( vrfEntry.getValue(), Entry::getKey, ifaceEntry -> AclIpSpace.union( ifaceEntry.getValue(), vrfIpSpaces2.get(ifaceEntry.getKey()))); }); }); } finally { span.finish(); } }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { static Map<String, Map<String, Map<String, IpSpace>>> union( Map<String, Map<String, Map<String, IpSpace>>> ipSpaces1, Map<String, Map<String, Map<String, IpSpace>>> ipSpaces2) { Span span = GlobalTracer.get().buildSpan("construct union").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; checkArgument( ipSpaces1.keySet().equals(ipSpaces2.keySet()), "Can't union with different nodes: %s and %s", ipSpaces1.keySet(), ipSpaces2.keySet()); return toImmutableMap( ipSpaces1, Entry::getKey, nodeEntry -> { Map<String, Map<String, IpSpace>> nodeIpSpace2 = ipSpaces2.get(nodeEntry.getKey()); checkArgument( nodeIpSpace2.keySet().equals(nodeEntry.getValue().keySet()), "Can't union with different VRFs in node %s: %s and %s", nodeEntry.getKey(), nodeEntry.getValue().keySet(), nodeIpSpace2.keySet()); return toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> { Map<String, IpSpace> vrfIpSpaces2 = nodeIpSpace2.get(vrfEntry.getKey()); checkArgument( vrfIpSpaces2.keySet().equals(vrfEntry.getValue().keySet()), "Can't union with different interfaces in node %s VRF %s: %s and %s", nodeEntry.getKey(), vrfEntry.getKey(), vrfEntry.getValue().keySet(), vrfIpSpaces2.keySet()); return toImmutableMap( vrfEntry.getValue(), Entry::getKey, ifaceEntry -> AclIpSpace.union( ifaceEntry.getValue(), vrfIpSpaces2.get(ifaceEntry.getKey()))); }); }); } finally { span.finish(); } } }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { static Map<String, Map<String, Map<String, IpSpace>>> union( Map<String, Map<String, Map<String, IpSpace>>> ipSpaces1, Map<String, Map<String, Map<String, IpSpace>>> ipSpaces2) { Span span = GlobalTracer.get().buildSpan("construct union").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; checkArgument( ipSpaces1.keySet().equals(ipSpaces2.keySet()), "Can't union with different nodes: %s and %s", ipSpaces1.keySet(), ipSpaces2.keySet()); return toImmutableMap( ipSpaces1, Entry::getKey, nodeEntry -> { Map<String, Map<String, IpSpace>> nodeIpSpace2 = ipSpaces2.get(nodeEntry.getKey()); checkArgument( nodeIpSpace2.keySet().equals(nodeEntry.getValue().keySet()), "Can't union with different VRFs in node %s: %s and %s", nodeEntry.getKey(), nodeEntry.getValue().keySet(), nodeIpSpace2.keySet()); return toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> { Map<String, IpSpace> vrfIpSpaces2 = nodeIpSpace2.get(vrfEntry.getKey()); checkArgument( vrfIpSpaces2.keySet().equals(vrfEntry.getValue().keySet()), "Can't union with different interfaces in node %s VRF %s: %s and %s", nodeEntry.getKey(), vrfEntry.getKey(), vrfEntry.getValue().keySet(), vrfIpSpaces2.keySet()); return toImmutableMap( vrfEntry.getValue(), Entry::getKey, ifaceEntry -> AclIpSpace.union( ifaceEntry.getValue(), vrfIpSpaces2.get(ifaceEntry.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 { static Map<String, Map<String, Map<String, IpSpace>>> union( Map<String, Map<String, Map<String, IpSpace>>> ipSpaces1, Map<String, Map<String, Map<String, IpSpace>>> ipSpaces2) { Span span = GlobalTracer.get().buildSpan("construct union").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; checkArgument( ipSpaces1.keySet().equals(ipSpaces2.keySet()), "Can't union with different nodes: %s and %s", ipSpaces1.keySet(), ipSpaces2.keySet()); return toImmutableMap( ipSpaces1, Entry::getKey, nodeEntry -> { Map<String, Map<String, IpSpace>> nodeIpSpace2 = ipSpaces2.get(nodeEntry.getKey()); checkArgument( nodeIpSpace2.keySet().equals(nodeEntry.getValue().keySet()), "Can't union with different VRFs in node %s: %s and %s", nodeEntry.getKey(), nodeEntry.getValue().keySet(), nodeIpSpace2.keySet()); return toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> { Map<String, IpSpace> vrfIpSpaces2 = nodeIpSpace2.get(vrfEntry.getKey()); checkArgument( vrfIpSpaces2.keySet().equals(vrfEntry.getValue().keySet()), "Can't union with different interfaces in node %s VRF %s: %s and %s", nodeEntry.getKey(), vrfEntry.getKey(), vrfEntry.getValue().keySet(), vrfIpSpaces2.keySet()); return toImmutableMap( vrfEntry.getValue(), Entry::getKey, ifaceEntry -> AclIpSpace.union( ifaceEntry.getValue(), vrfIpSpaces2.get(ifaceEntry.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 { static Map<String, Map<String, Map<String, IpSpace>>> union( Map<String, Map<String, Map<String, IpSpace>>> ipSpaces1, Map<String, Map<String, Map<String, IpSpace>>> ipSpaces2) { Span span = GlobalTracer.get().buildSpan("construct union").start(); try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) { assert scope != null; checkArgument( ipSpaces1.keySet().equals(ipSpaces2.keySet()), "Can't union with different nodes: %s and %s", ipSpaces1.keySet(), ipSpaces2.keySet()); return toImmutableMap( ipSpaces1, Entry::getKey, nodeEntry -> { Map<String, Map<String, IpSpace>> nodeIpSpace2 = ipSpaces2.get(nodeEntry.getKey()); checkArgument( nodeIpSpace2.keySet().equals(nodeEntry.getValue().keySet()), "Can't union with different VRFs in node %s: %s and %s", nodeEntry.getKey(), nodeEntry.getValue().keySet(), nodeIpSpace2.keySet()); return toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> { Map<String, IpSpace> vrfIpSpaces2 = nodeIpSpace2.get(vrfEntry.getKey()); checkArgument( vrfIpSpaces2.keySet().equals(vrfEntry.getValue().keySet()), "Can't union with different interfaces in node %s VRF %s: %s and %s", nodeEntry.getKey(), vrfEntry.getKey(), vrfEntry.getValue().keySet(), vrfIpSpaces2.keySet()); return toImmutableMap( vrfEntry.getValue(), Entry::getKey, ifaceEntry -> AclIpSpace.union( ifaceEntry.getValue(), vrfIpSpaces2.get(ifaceEntry.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();  }