@Test public void testDefaultToIcmpPing() { PacketHeaderConstraints phc = PacketHeaderConstraints.builder().setIpProtocols(ImmutableSet.of(IpProtocol.ICMP)).build(); Builder builder = toFlow(new BDDPacket(), phc, UniverseIpSpace.INSTANCE, UniverseIpSpace.INSTANCE); assertThat(builder.getIcmpType(), equalTo(8)); assertThat(builder.getIcmpCode(), equalTo(0)); }
@VisibleForTesting public static Flow.Builder toFlow( BDDPacket pkt, PacketHeaderConstraints phc, IpSpace srcIps, IpSpace dstIps) throws IllegalArgumentException { return pkt.getFlow(toBDD(pkt, phc, srcIps, dstIps)) .orElseThrow(() -> new BatfishException("could not convert header constraints to flow")); }
PacketHeaderConstraintsUtil { @VisibleForTesting public static Flow.Builder toFlow( BDDPacket pkt, PacketHeaderConstraints phc, IpSpace srcIps, IpSpace dstIps) throws IllegalArgumentException { return pkt.getFlow(toBDD(pkt, phc, srcIps, dstIps)) .orElseThrow(() -> new BatfishException("could not convert header constraints to flow")); } }
PacketHeaderConstraintsUtil { @VisibleForTesting public static Flow.Builder toFlow( BDDPacket pkt, PacketHeaderConstraints phc, IpSpace srcIps, IpSpace dstIps) throws IllegalArgumentException { return pkt.getFlow(toBDD(pkt, phc, srcIps, dstIps)) .orElseThrow(() -> new BatfishException("could not convert header constraints to flow")); }  }
PacketHeaderConstraintsUtil { @VisibleForTesting public static Flow.Builder toFlow( BDDPacket pkt, PacketHeaderConstraints phc, IpSpace srcIps, IpSpace dstIps) throws IllegalArgumentException { return pkt.getFlow(toBDD(pkt, phc, srcIps, dstIps)) .orElseThrow(() -> new BatfishException("could not convert header constraints to flow")); }  static AclLineMatchExpr toAclLineMatchExpr(
      PacketHeaderConstraints phc, IpSpace srcIpSpace, IpSpace dstIpSpace); static AclLineMatchExpr toAclLineMatchExpr(PacketHeaderConstraints phc); static BDD toBDD(
      BDDPacket pkt, PacketHeaderConstraints phc, IpSpace srcIpSpace, IpSpace dstIpSpace); static BDD toBDD(
      BDDPacket pkt,
      PacketHeaderConstraints phc,
      Map<String, IpSpace> namedIpSpaces,
      IpSpace srcIpSpace,
      IpSpace dstIpSpace); @VisibleForTesting static Flow.Builder toFlow(
      BDDPacket pkt, PacketHeaderConstraints phc, IpSpace srcIps, IpSpace dstIps); }
PacketHeaderConstraintsUtil { @VisibleForTesting public static Flow.Builder toFlow( BDDPacket pkt, PacketHeaderConstraints phc, IpSpace srcIps, IpSpace dstIps) throws IllegalArgumentException { return pkt.getFlow(toBDD(pkt, phc, srcIps, dstIps)) .orElseThrow(() -> new BatfishException("could not convert header constraints to flow")); }  static AclLineMatchExpr toAclLineMatchExpr(
      PacketHeaderConstraints phc, IpSpace srcIpSpace, IpSpace dstIpSpace); static AclLineMatchExpr toAclLineMatchExpr(PacketHeaderConstraints phc); static BDD toBDD(
      BDDPacket pkt, PacketHeaderConstraints phc, IpSpace srcIpSpace, IpSpace dstIpSpace); static BDD toBDD(
      BDDPacket pkt,
      PacketHeaderConstraints phc,
      Map<String, IpSpace> namedIpSpaces,
      IpSpace srcIpSpace,
      IpSpace dstIpSpace); @VisibleForTesting static Flow.Builder toFlow(
      BDDPacket pkt, PacketHeaderConstraints phc, IpSpace srcIps, IpSpace dstIps); static final int DEFAULT_PACKET_LENGTH; }