Search in sources :

Example 1 with PrefixMatchExpr

use of org.batfish.z3.expr.PrefixMatchExpr 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));
}
Also used : BoolExpr(com.microsoft.z3.BoolExpr) BoolExprTransformer.toBoolExpr(org.batfish.z3.expr.visitors.BoolExprTransformer.toBoolExpr) PrefixMatchExpr(org.batfish.z3.expr.PrefixMatchExpr) BooleanExpr(org.batfish.z3.expr.BooleanExpr) Test(org.junit.Test)

Example 2 with PrefixMatchExpr

use of org.batfish.z3.expr.PrefixMatchExpr in project batfish by batfish.

the class SimplifierTest method testSimplifyWrappers.

/**
 * Test that wrapper expressions are changed by simplification
 */
@Test
public void testSimplifyWrappers() {
    BooleanExpr headerSpaceMatchExpr = new HeaderSpaceMatchExpr(IpAccessListLine.builder().build());
    BooleanExpr prefixMatchExpr = new PrefixMatchExpr(BasicHeaderField.DST_IP, Prefix.ZERO);
    BooleanExpr rangeMatchExpr = RangeMatchExpr.greaterThanOrEqualTo(BasicHeaderField.DST_IP, 123456L, 10);
    assertThat(simplifyBooleanExpr(CurrentIsOriginalExpr.INSTANCE), not(equalTo(CurrentIsOriginalExpr.INSTANCE)));
    assertThat(simplifyBooleanExpr(headerSpaceMatchExpr), not(equalTo(headerSpaceMatchExpr)));
    assertThat(simplifyBooleanExpr(prefixMatchExpr), not(equalTo(prefixMatchExpr)));
    assertThat(simplifyBooleanExpr(rangeMatchExpr), not(equalTo(rangeMatchExpr)));
    assertThat(simplifyBooleanExpr(SaneExpr.INSTANCE), not(equalTo(SaneExpr.INSTANCE)));
}
Also used : PrefixMatchExpr(org.batfish.z3.expr.PrefixMatchExpr) HeaderSpaceMatchExpr(org.batfish.z3.expr.HeaderSpaceMatchExpr) BooleanExpr(org.batfish.z3.expr.BooleanExpr) Simplifier.simplifyBooleanExpr(org.batfish.z3.expr.visitors.Simplifier.simplifyBooleanExpr) Test(org.junit.Test)

Aggregations

BooleanExpr (org.batfish.z3.expr.BooleanExpr)2 PrefixMatchExpr (org.batfish.z3.expr.PrefixMatchExpr)2 Test (org.junit.Test)2 BoolExpr (com.microsoft.z3.BoolExpr)1 HeaderSpaceMatchExpr (org.batfish.z3.expr.HeaderSpaceMatchExpr)1 BoolExprTransformer.toBoolExpr (org.batfish.z3.expr.visitors.BoolExprTransformer.toBoolExpr)1 Simplifier.simplifyBooleanExpr (org.batfish.z3.expr.visitors.Simplifier.simplifyBooleanExpr)1