@Test public void testBDDNetworkGraph_sourceNat_match() { IpSpaceAssignment assignment = IpSpaceAssignment.builder() .assign( new InterfaceLocation(_net._srcNode.getHostname(), _net._link1Src.getName()), SOURCE_NAT_ACL_IP.toIpSpace()) .build(); Set<String> finalNodes = _net._configs.keySet(); Map<IngressLocation, BDD> acceptedBDDs = _graphFactory .bddReachabilityAnalysis( assignment, matchDst(_dstIface2Ip.toIpSpace()), ImmutableSet.of(), ImmutableSet.of(), finalNodes, ImmutableSet.of(ACCEPTED)) .getIngressLocationReachableBDDs(); Map<IngressLocation, BDD> deniedOutBDDs = _graphFactory .bddReachabilityAnalysis( assignment, matchDst(_dstIface2Ip.toIpSpace()), ImmutableSet.of(), ImmutableSet.of(), finalNodes, ImmutableSet.of(DENIED_IN)) .getIngressLocationReachableBDDs(); BDD natAclIpBDD = srcIpBDD(SOURCE_NAT_ACL_IP); BDD srcNatAclBDD = IpAccessListToBdd.toBDD(PKT, _net._link2SrcSourceNatAcl); assertThat(srcNatAclBDD, equalTo(natAclIpBDD)); List<MultipathInconsistency> inconsistencies = computeMultipathInconsistencyBDDs(acceptedBDDs, deniedOutBDDs).collect(Collectors.toList()); assertThat(inconsistencies, hasSize(1)); MultipathInconsistency inconsistency = inconsistencies.get(0); assertThat( inconsistency.getIngressLocation(), equalTo(IngressLocation.vrf(_srcName, DEFAULT_VRF_NAME))); }
@VisibleForTesting static Stream<MultipathInconsistency> computeMultipathInconsistencyBDDs( Map<IngressLocation, BDD> disposition1FlowBdds, Map<IngressLocation, BDD> disposition2FlowBdds) { checkArgument( disposition1FlowBdds.keySet().equals(disposition2FlowBdds.keySet()), "Queries must have the same IngressLocations"); return disposition1FlowBdds.entrySet().stream() .flatMap( entry -> { IngressLocation loc = entry.getKey(); BDD query1Bdd = entry.getValue(); BDD query2Bdd = disposition2FlowBdds.get(loc); BDD intersection = query1Bdd.and(query2Bdd); return intersection.isZero() ? Stream.empty() : Stream.of(new MultipathInconsistency(loc, intersection)); }); }
BDDMultipathInconsistency { @VisibleForTesting static Stream<MultipathInconsistency> computeMultipathInconsistencyBDDs( Map<IngressLocation, BDD> disposition1FlowBdds, Map<IngressLocation, BDD> disposition2FlowBdds) { checkArgument( disposition1FlowBdds.keySet().equals(disposition2FlowBdds.keySet()), "Queries must have the same IngressLocations"); return disposition1FlowBdds.entrySet().stream() .flatMap( entry -> { IngressLocation loc = entry.getKey(); BDD query1Bdd = entry.getValue(); BDD query2Bdd = disposition2FlowBdds.get(loc); BDD intersection = query1Bdd.and(query2Bdd); return intersection.isZero() ? Stream.empty() : Stream.of(new MultipathInconsistency(loc, intersection)); }); } }
BDDMultipathInconsistency { @VisibleForTesting static Stream<MultipathInconsistency> computeMultipathInconsistencyBDDs( Map<IngressLocation, BDD> disposition1FlowBdds, Map<IngressLocation, BDD> disposition2FlowBdds) { checkArgument( disposition1FlowBdds.keySet().equals(disposition2FlowBdds.keySet()), "Queries must have the same IngressLocations"); return disposition1FlowBdds.entrySet().stream() .flatMap( entry -> { IngressLocation loc = entry.getKey(); BDD query1Bdd = entry.getValue(); BDD query2Bdd = disposition2FlowBdds.get(loc); BDD intersection = query1Bdd.and(query2Bdd); return intersection.isZero() ? Stream.empty() : Stream.of(new MultipathInconsistency(loc, intersection)); }); } private  BDDMultipathInconsistency(); }
BDDMultipathInconsistency { @VisibleForTesting static Stream<MultipathInconsistency> computeMultipathInconsistencyBDDs( Map<IngressLocation, BDD> disposition1FlowBdds, Map<IngressLocation, BDD> disposition2FlowBdds) { checkArgument( disposition1FlowBdds.keySet().equals(disposition2FlowBdds.keySet()), "Queries must have the same IngressLocations"); return disposition1FlowBdds.entrySet().stream() .flatMap( entry -> { IngressLocation loc = entry.getKey(); BDD query1Bdd = entry.getValue(); BDD query2Bdd = disposition2FlowBdds.get(loc); BDD intersection = query1Bdd.and(query2Bdd); return intersection.isZero() ? Stream.empty() : Stream.of(new MultipathInconsistency(loc, intersection)); }); } private  BDDMultipathInconsistency(); static List<Flow> computeMultipathInconsistencies(
      BDDPacket bddPacket,
      Map<IngressLocation, BDD> disposition1FlowBdds,
      Map<IngressLocation, BDD> disposition2FlowBdds); }
BDDMultipathInconsistency { @VisibleForTesting static Stream<MultipathInconsistency> computeMultipathInconsistencyBDDs( Map<IngressLocation, BDD> disposition1FlowBdds, Map<IngressLocation, BDD> disposition2FlowBdds) { checkArgument( disposition1FlowBdds.keySet().equals(disposition2FlowBdds.keySet()), "Queries must have the same IngressLocations"); return disposition1FlowBdds.entrySet().stream() .flatMap( entry -> { IngressLocation loc = entry.getKey(); BDD query1Bdd = entry.getValue(); BDD query2Bdd = disposition2FlowBdds.get(loc); BDD intersection = query1Bdd.and(query2Bdd); return intersection.isZero() ? Stream.empty() : Stream.of(new MultipathInconsistency(loc, intersection)); }); } private  BDDMultipathInconsistency(); static List<Flow> computeMultipathInconsistencies(
      BDDPacket bddPacket,
      Map<IngressLocation, BDD> disposition1FlowBdds,
      Map<IngressLocation, BDD> disposition2FlowBdds);  }