@Test public void testIsRelevantFor() { BDDRoute bddRoute = _anyRoute; IpSpaceToBDD ipSpaceToBDD = new IpSpaceToBDD(bddRoute.getPrefix()); PrefixRange range = new PrefixRange(Prefix.parse("1.0.0.0/8"), new SubRange(16, 24)); BDD rangeBdd = isRelevantFor(bddRoute, range); BDD notRangeBdd = rangeBdd.not(); BDD matchingPrefix = ipSpaceToBDD.toBDD(Ip.parse("1.1.1.1")); BDD nonMatchingPrefix = ipSpaceToBDD.toBDD(Ip.parse("2.2.2.2")); BDD len24 = bddRoute.getPrefixLength().value(24); BDD len8 = bddRoute.getPrefixLength().value(8); BDD len32 = bddRoute.getPrefixLength().value(32); assertTrue(matchingPrefix.and(len24).imp(rangeBdd).isOne()); assertTrue(matchingPrefix.and(len32).imp(notRangeBdd).isOne()); assertTrue(matchingPrefix.and(len8).imp(notRangeBdd).isOne()); assertTrue(nonMatchingPrefix.and(len24).imp(notRangeBdd).isOne()); }
public static BDD isRelevantFor(BDDRoute record, PrefixRange range) { Prefix p = range.getPrefix(); BDD prefixMatch = firstBitsEqual(record.getPrefix().getBitvec(), p, p.getPrefixLength()); BDDInteger prefixLength = record.getPrefixLength(); SubRange r = range.getLengthRange(); int lower = r.getStart(); int upper = r.getEnd(); BDD lenMatch = prefixLength.range(lower, upper); return lenMatch.and(prefixMatch); }
TransferBDD { public static BDD isRelevantFor(BDDRoute record, PrefixRange range) { Prefix p = range.getPrefix(); BDD prefixMatch = firstBitsEqual(record.getPrefix().getBitvec(), p, p.getPrefixLength()); BDDInteger prefixLength = record.getPrefixLength(); SubRange r = range.getLengthRange(); int lower = r.getStart(); int upper = r.getEnd(); BDD lenMatch = prefixLength.range(lower, upper); return lenMatch.and(prefixMatch); } }
TransferBDD { public static BDD isRelevantFor(BDDRoute record, PrefixRange range) { Prefix p = range.getPrefix(); BDD prefixMatch = firstBitsEqual(record.getPrefix().getBitvec(), p, p.getPrefixLength()); BDDInteger prefixLength = record.getPrefixLength(); SubRange r = range.getLengthRange(); int lower = r.getStart(); int upper = r.getEnd(); BDD lenMatch = prefixLength.range(lower, upper); return lenMatch.and(prefixMatch); } TransferBDD(Graph g, Configuration conf, List<Statement> statements); }
TransferBDD { public static BDD isRelevantFor(BDDRoute record, PrefixRange range) { Prefix p = range.getPrefix(); BDD prefixMatch = firstBitsEqual(record.getPrefix().getBitvec(), p, p.getPrefixLength()); BDDInteger prefixLength = record.getPrefixLength(); SubRange r = range.getLengthRange(); int lower = r.getStart(); int upper = r.getEnd(); BDD lenMatch = prefixLength.range(lower, upper); return lenMatch.and(prefixMatch); } TransferBDD(Graph g, Configuration conf, List<Statement> statements); static BDD firstBitsEqual(BDD[] bits, Prefix p, int length); static BDD isRelevantFor(BDDRoute record, PrefixRange range); TransferResult compute(@Nullable Set<Prefix> ignoredNetworks); Map<CommunityVar, Set<Integer>> getCommunityAtomicPredicates(); Configuration getConfiguration(); Graph getGraph(); }
TransferBDD { public static BDD isRelevantFor(BDDRoute record, PrefixRange range) { Prefix p = range.getPrefix(); BDD prefixMatch = firstBitsEqual(record.getPrefix().getBitvec(), p, p.getPrefixLength()); BDDInteger prefixLength = record.getPrefixLength(); SubRange r = range.getLengthRange(); int lower = r.getStart(); int upper = r.getEnd(); BDD lenMatch = prefixLength.range(lower, upper); return lenMatch.and(prefixMatch); } TransferBDD(Graph g, Configuration conf, List<Statement> statements); static BDD firstBitsEqual(BDD[] bits, Prefix p, int length); static BDD isRelevantFor(BDDRoute record, PrefixRange range); TransferResult compute(@Nullable Set<Prefix> ignoredNetworks); Map<CommunityVar, Set<Integer>> getCommunityAtomicPredicates(); Configuration getConfiguration(); Graph getGraph();  }