use of org.batfish.z3.expr.QueryStatement in project batfish by batfish.
the class StandardReachabilityQuerySynthesizer method getReachabilityProgram.
@Override
public ReachabilityProgram getReachabilityProgram(SynthesizerInput input) {
ImmutableList.Builder<RuleStatement> rules = ImmutableList.builder();
List<StateExpr> finalActions = computeFinalActions();
ImmutableList.Builder<BooleanExpr> queryPreconditions = ImmutableList.<BooleanExpr>builder().add(SaneExpr.INSTANCE).add(getSrcNattedConstraint());
finalActions.stream().map(finalAction -> new BasicRuleStatement(new AndExpr(queryPreconditions.build()), ImmutableSet.of(finalAction), Query.INSTANCE)).forEach(rules::add);
addOriginateRules(rules);
return ReachabilityProgram.builder().setInput(input).setQueries(ImmutableList.of(new QueryStatement(Query.INSTANCE))).setRules(rules.build()).build();
}
use of org.batfish.z3.expr.QueryStatement 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();
}
Aggregations