@Test public void test_srcOrDstIps() { Ip srcOrDstIp = Ip.parse("1.2.3.4"); HeaderSpace headerSpace = HeaderSpace.builder().setSrcOrDstIps(srcOrDstIp.toIpSpace()).build(); BDD bdd = _toBDD.toBDD(headerSpace); BDD dstIpBDD = _pkt.getDstIp().value(srcOrDstIp.asLong()); BDD srcIpBDD = _pkt.getSrcIp().value(srcOrDstIp.asLong()); assertThat(bdd, equalTo(dstIpBDD.or(srcIpBDD))); Ip dstIp = Ip.parse("1.1.1.1"); headerSpace = HeaderSpace.builder() .setDstIps(dstIp.toIpSpace()) .setSrcOrDstIps(srcOrDstIp.toIpSpace()) .build(); bdd = _toBDD.toBDD(headerSpace); dstIpBDD = _pkt.getDstIp().value(dstIp.asLong()); assertThat(bdd, equalTo(srcIpBDD.and(dstIpBDD))); Ip srcIp = Ip.parse("2.2.2.2"); headerSpace = HeaderSpace.builder() .setDstIps(dstIp.toIpSpace()) .setSrcIps(srcIp.toIpSpace()) .setSrcOrDstIps(srcOrDstIp.toIpSpace()) .build(); bdd = _toBDD.toBDD(headerSpace); assertThat(bdd, isZero()); }
@Nullable private BDD toBDD(Collection<Integer> ints, BDDInteger var) { if (ints == null || ints.isEmpty()) { return null; } return _bddOps.or(ints.stream().map(var::value).collect(Collectors.toList())); }
HeaderSpaceToBDD { @Nullable private BDD toBDD(Collection<Integer> ints, BDDInteger var) { if (ints == null || ints.isEmpty()) { return null; } return _bddOps.or(ints.stream().map(var::value).collect(Collectors.toList())); } }
HeaderSpaceToBDD { @Nullable private BDD toBDD(Collection<Integer> ints, BDDInteger var) { if (ints == null || ints.isEmpty()) { return null; } return _bddOps.or(ints.stream().map(var::value).collect(Collectors.toList())); } HeaderSpaceToBDD(BDDPacket bddPacket, Map<String, IpSpace> namedIpSpaces); }
HeaderSpaceToBDD { @Nullable private BDD toBDD(Collection<Integer> ints, BDDInteger var) { if (ints == null || ints.isEmpty()) { return null; } return _bddOps.or(ints.stream().map(var::value).collect(Collectors.toList())); } HeaderSpaceToBDD(BDDPacket bddPacket, Map<String, IpSpace> namedIpSpaces); IpSpaceToBDD getDstIpSpaceToBdd(); IpSpaceToBDD getSrcIpSpaceToBdd(); BDD toBDD(HeaderSpace headerSpace); }
HeaderSpaceToBDD { @Nullable private BDD toBDD(Collection<Integer> ints, BDDInteger var) { if (ints == null || ints.isEmpty()) { return null; } return _bddOps.or(ints.stream().map(var::value).collect(Collectors.toList())); } HeaderSpaceToBDD(BDDPacket bddPacket, Map<String, IpSpace> namedIpSpaces); IpSpaceToBDD getDstIpSpaceToBdd(); IpSpaceToBDD getSrcIpSpaceToBdd(); BDD toBDD(HeaderSpace headerSpace);  }