Search in sources :

Example 16 with BasicRuleStatement

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

the class DefaultTransitionGeneratorTest method testVisitDropAclIn.

@Test
public void testVisitDropAclIn() {
    SynthesizerInput input = MockSynthesizerInput.builder().setEnabledNodes(ImmutableSet.of(NODE1, NODE2)).build();
    Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(DropAclIn.State.INSTANCE)));
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropAclIn(NODE1), DropAclIn.INSTANCE)));
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropAclIn(NODE2), DropAclIn.INSTANCE)));
}
Also used : MockSynthesizerInput(org.batfish.z3.MockSynthesizerInput) SynthesizerInput(org.batfish.z3.SynthesizerInput) NodeDropAclIn(org.batfish.z3.state.NodeDropAclIn) TransformationRuleStatement(org.batfish.z3.expr.TransformationRuleStatement) RuleStatement(org.batfish.z3.expr.RuleStatement) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement) Test(org.junit.Test)

Example 17 with BasicRuleStatement

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

the class DefaultTransitionGeneratorTest method testVisitAclPermit.

@Test
public void testVisitAclPermit() {
    SynthesizerInput input = MockSynthesizerInput.builder().setAclActions(aclActions()).build();
    Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(AclPermit.State.INSTANCE)));
    // MatchPermitLine
    assertThat(rules, hasItem(new BasicRuleStatement(new AclLineMatch(NODE1, ACL1, 0), new AclPermit(NODE1, ACL1))));
    assertThat(rules, hasItem(new BasicRuleStatement(new AclLineMatch(NODE1, ACL1, 2), new AclPermit(NODE1, ACL1))));
    assertThat(rules, hasItem(new BasicRuleStatement(new AclLineMatch(NODE1, ACL2, 1), new AclPermit(NODE1, ACL2))));
    assertThat(rules, hasItem(new BasicRuleStatement(new AclLineMatch(NODE1, ACL2, 3), new AclPermit(NODE1, ACL2))));
    assertThat(rules, hasItem(new BasicRuleStatement(new AclLineMatch(NODE2, ACL1, 0), new AclPermit(NODE2, ACL1))));
    assertThat(rules, hasItem(new BasicRuleStatement(new AclLineMatch(NODE2, ACL1, 2), new AclPermit(NODE2, ACL1))));
    assertThat(rules, hasItem(new BasicRuleStatement(new AclLineMatch(NODE2, ACL2, 1), new AclPermit(NODE2, ACL2))));
    assertThat(rules, hasItem(new BasicRuleStatement(new AclLineMatch(NODE2, ACL2, 3), new AclPermit(NODE2, ACL2))));
}
Also used : AclLineMatch(org.batfish.z3.state.AclLineMatch) MockSynthesizerInput(org.batfish.z3.MockSynthesizerInput) SynthesizerInput(org.batfish.z3.SynthesizerInput) TransformationRuleStatement(org.batfish.z3.expr.TransformationRuleStatement) RuleStatement(org.batfish.z3.expr.RuleStatement) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement) AclPermit(org.batfish.z3.state.AclPermit) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement) Test(org.junit.Test)

Example 18 with BasicRuleStatement

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

the class DefaultTransitionGeneratorTest method testVisitNodeDrop.

@Test
public void testVisitNodeDrop() {
    SynthesizerInput input = MockSynthesizerInput.builder().setEnabledNodes(ImmutableSet.of(NODE1, NODE2)).build();
    Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(NodeDrop.State.INSTANCE)));
    // CopyNodeDropAcl
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropAcl(NODE1), new NodeDrop(NODE1))));
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropAcl(NODE2), new NodeDrop(NODE2))));
    // CopyNodeDropNoRoute
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropNoRoute(NODE1), new NodeDrop(NODE1))));
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropNoRoute(NODE2), new NodeDrop(NODE2))));
    // CopyNodeDropNullRoute
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropNullRoute(NODE1), new NodeDrop(NODE1))));
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropNullRoute(NODE2), new NodeDrop(NODE2))));
}
Also used : NodeDropAcl(org.batfish.z3.state.NodeDropAcl) NodeDrop(org.batfish.z3.state.NodeDrop) NodeDropNoRoute(org.batfish.z3.state.NodeDropNoRoute) NodeDropNullRoute(org.batfish.z3.state.NodeDropNullRoute) MockSynthesizerInput(org.batfish.z3.MockSynthesizerInput) SynthesizerInput(org.batfish.z3.SynthesizerInput) TransformationRuleStatement(org.batfish.z3.expr.TransformationRuleStatement) RuleStatement(org.batfish.z3.expr.RuleStatement) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement) Test(org.junit.Test)

Example 19 with BasicRuleStatement

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

the class DefaultTransitionGeneratorTest method testVisitAccept.

@Test
public void testVisitAccept() {
    SynthesizerInput input = MockSynthesizerInput.builder().setEnabledNodes(ImmutableSet.of(NODE1, NODE2)).build();
    Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(Accept.State.INSTANCE)));
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeAccept(NODE1), Accept.INSTANCE)));
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeAccept(NODE2), Accept.INSTANCE)));
}
Also used : MockSynthesizerInput(org.batfish.z3.MockSynthesizerInput) SynthesizerInput(org.batfish.z3.SynthesizerInput) TransformationRuleStatement(org.batfish.z3.expr.TransformationRuleStatement) RuleStatement(org.batfish.z3.expr.RuleStatement) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement) NodeAccept(org.batfish.z3.state.NodeAccept) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement) Test(org.junit.Test)

Example 20 with BasicRuleStatement

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

the class DefaultTransitionGeneratorTest method testVisitDropNullRoute.

@Test
public void testVisitDropNullRoute() {
    SynthesizerInput input = MockSynthesizerInput.builder().setEnabledNodes(ImmutableSet.of(NODE1, NODE2)).build();
    Set<RuleStatement> rules = ImmutableSet.copyOf(DefaultTransitionGenerator.generateTransitions(input, ImmutableSet.of(DropNullRoute.State.INSTANCE)));
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropNullRoute(NODE1), DropNullRoute.INSTANCE)));
    assertThat(rules, hasItem(new BasicRuleStatement(new NodeDropNullRoute(NODE2), DropNullRoute.INSTANCE)));
}
Also used : NodeDropNullRoute(org.batfish.z3.state.NodeDropNullRoute) MockSynthesizerInput(org.batfish.z3.MockSynthesizerInput) SynthesizerInput(org.batfish.z3.SynthesizerInput) TransformationRuleStatement(org.batfish.z3.expr.TransformationRuleStatement) RuleStatement(org.batfish.z3.expr.RuleStatement) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement) Test(org.junit.Test)

Aggregations

BasicRuleStatement (org.batfish.z3.expr.BasicRuleStatement)44 RuleStatement (org.batfish.z3.expr.RuleStatement)37 TransformationRuleStatement (org.batfish.z3.expr.TransformationRuleStatement)35 SynthesizerInput (org.batfish.z3.SynthesizerInput)34 Test (org.junit.Test)29 MockSynthesizerInput (org.batfish.z3.MockSynthesizerInput)28 ImmutableList (com.google.common.collect.ImmutableList)12 BooleanExpr (org.batfish.z3.expr.BooleanExpr)12 NotExpr (org.batfish.z3.expr.NotExpr)12 PreOut (org.batfish.z3.state.PreOut)11 AclLineMatch (org.batfish.z3.state.AclLineMatch)10 NodeDropAclIn (org.batfish.z3.state.NodeDropAclIn)10 NodeDropAclOut (org.batfish.z3.state.NodeDropAclOut)10 NodeDropNoRoute (org.batfish.z3.state.NodeDropNoRoute)10 NodeDropNullRoute (org.batfish.z3.state.NodeDropNullRoute)10 StateExpr (org.batfish.z3.expr.StateExpr)9 AclDeny (org.batfish.z3.state.AclDeny)9 AclLineNoMatch (org.batfish.z3.state.AclLineNoMatch)9 AclPermit (org.batfish.z3.state.AclPermit)9 NodeAccept (org.batfish.z3.state.NodeAccept)9