use of org.batfish.z3.expr.BooleanExpr in project batfish by batfish.
the class BoolExprTransformerTest method testVisitPrefixMatchExpr.
@Test
public void testVisitPrefixMatchExpr() {
BooleanExpr expr = new PrefixMatchExpr(BasicHeaderField.SRC_IP, Prefix.parse("1.2.3.4/5"));
assertThat(toBoolExpr(expr, _input, _nodContext), instanceOf(BoolExpr.class));
}
use of org.batfish.z3.expr.BooleanExpr in project batfish by batfish.
the class BoolExprTransformerTest method testVisitOrExpr.
@Test
public void testVisitOrExpr() {
BooleanExpr p1Batfish = newBooleanAtom();
BooleanExpr p2Batfish = newBooleanAtom();
BoolExpr p1Z3 = toBoolExpr(p1Batfish, _input, _nodContext);
BoolExpr p2Z3 = toBoolExpr(p2Batfish, _input, _nodContext);
assertThat(toBoolExpr(new OrExpr(of(p1Batfish, p2Batfish)), _input, _nodContext), equalTo(_ctx.mkOr(p1Z3, p2Z3)));
}
use of org.batfish.z3.expr.BooleanExpr in project batfish by batfish.
the class IpSpaceBooleanExprTransformerTest method testVisitIpWildcard.
@Test
public void testVisitIpWildcard() {
IpWildcard wildcard = new IpWildcard(new Ip("1.2.0.4"), new Ip(0x0000FF00L));
BooleanExpr matchExpr = wildcard.accept(SRC_IP_SPACE_BOOLEAN_EXPR_TRANSFORMER);
assertThat(matchExpr, equalTo(HeaderSpaceMatchExpr.matchSrcIp(ImmutableSet.of(wildcard))));
}
use of org.batfish.z3.expr.BooleanExpr in project batfish by batfish.
the class IpSpaceBooleanExprTransformerTest method testVisitUniverseIpSpace.
@Test
public void testVisitUniverseIpSpace() {
BooleanExpr expr = UniverseIpSpace.INSTANCE.accept(SRC_IP_SPACE_BOOLEAN_EXPR_TRANSFORMER);
assertThat(expr, equalTo(TrueExpr.INSTANCE));
}
use of org.batfish.z3.expr.BooleanExpr in project batfish by batfish.
the class IpSpaceBooleanExprTransformerTest method testVisitAclIpSpace.
@Test
public void testVisitAclIpSpace() {
AclIpSpace ipSpace = AclIpSpace.builder().thenRejecting(UniverseIpSpace.INSTANCE).thenPermitting(EmptyIpSpace.INSTANCE).build();
BooleanExpr expr = ipSpace.accept(SRC_IP_SPACE_BOOLEAN_EXPR_TRANSFORMER);
assertThat(expr, equalTo(new IfThenElse(// Matches UniverseIpSpace
TrueExpr.INSTANCE, // Reject
FalseExpr.INSTANCE, new IfThenElse(// Matches EmptyIpSpace
FalseExpr.INSTANCE, // Accept
TrueExpr.INSTANCE, // Matches nothing so reject
FalseExpr.INSTANCE))));
}
Aggregations