Search in sources :

Example 41 with RuleStatement

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

the class AclReachabilityQuerySynthesizer method getReachabilityProgram.

@Override
public ReachabilityProgram getReachabilityProgram(SynthesizerInput input) {
    ReachabilityProgram.Builder builder = ReachabilityProgram.builder().setInput(input);
    ImmutableList.Builder<QueryStatement> queries = ImmutableList.builder();
    ImmutableList.Builder<RuleStatement> rules = ImmutableList.builder();
    for (int line = 0; line < _numLines; line++) {
        NumberedQuery query = new NumberedQuery(line);
        rules.add(new BasicRuleStatement(SaneExpr.INSTANCE, ImmutableSet.of(new AclLineMatch(_hostname, _aclName, line)), new NumberedQuery(line)));
        queries.add(new QueryStatement(query));
        _keys.add(new AclLine(_hostname, _aclName, line));
    }
    return builder.setInput(input).setQueries(queries.build()).setRules(rules.build()).build();
}
Also used : AclLineMatch(org.batfish.z3.state.AclLineMatch) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement) RuleStatement(org.batfish.z3.expr.RuleStatement) NumberedQuery(org.batfish.z3.state.NumberedQuery) ImmutableList(com.google.common.collect.ImmutableList) QueryStatement(org.batfish.z3.expr.QueryStatement) BasicRuleStatement(org.batfish.z3.expr.BasicRuleStatement)

Aggregations

Test (org.junit.Test)36 BasicRuleStatement (org.batfish.z3.expr.BasicRuleStatement)35 RuleStatement (org.batfish.z3.expr.RuleStatement)34 MockSynthesizerInput (org.batfish.z3.MockSynthesizerInput)30 SynthesizerInput (org.batfish.z3.SynthesizerInput)30 TransformationRuleStatement (org.batfish.z3.expr.TransformationRuleStatement)30 TestStateExpr (org.batfish.z3.expr.visitors.RelationCollectorTest.TestStateExpr)6 PreOut (org.batfish.z3.state.PreOut)6 PreOutEdge (org.batfish.z3.state.PreOutEdge)6 ImmutableList (com.google.common.collect.ImmutableList)5 Edge (org.batfish.datamodel.Edge)5 BooleanExpr (org.batfish.z3.expr.BooleanExpr)5 NotExpr (org.batfish.z3.expr.NotExpr)5 AclLineMatch (org.batfish.z3.state.AclLineMatch)5 AclPermit (org.batfish.z3.state.AclPermit)5 NodeDropAclIn (org.batfish.z3.state.NodeDropAclIn)5 NodeDropNoRoute (org.batfish.z3.state.NodeDropNoRoute)5 PostOutEdge (org.batfish.z3.state.PostOutEdge)5 QueryStatement (org.batfish.z3.expr.QueryStatement)4 AclDeny (org.batfish.z3.state.AclDeny)4