use of org.batfish.datamodel.LineAction in project batfish by batfish.
the class DefaultTransitionGenerator method visitAclDeny.
@Override
public void visitAclDeny(AclDeny.State aclDeny) {
// MatchDenyLine
_input.getAclActions().forEach((node, nodeAcls) -> nodeAcls.forEach((acl, linesActions) -> {
int lineNumber = 0;
for (LineAction linesAction : linesActions) {
if (linesAction == LineAction.REJECT) {
_rules.add(new BasicRuleStatement(new AclLineMatch(node, acl, lineNumber), new AclDeny(node, acl)));
}
lineNumber++;
}
}));
// MatchNoLines
_input.getAclActions().entrySet().stream().flatMap(aclActionsEntryByNode -> {
String hostname = aclActionsEntryByNode.getKey();
return aclActionsEntryByNode.getValue().entrySet().stream().map(aclActionsEntryByAclName -> {
String acl = aclActionsEntryByAclName.getKey();
List<LineAction> lineActions = aclActionsEntryByAclName.getValue();
AclDeny deny = new AclDeny(hostname, acl);
if (lineActions.isEmpty()) {
return new BasicRuleStatement(deny);
} else {
int lastLine = lineActions.size() - 1;
return new BasicRuleStatement(new AclLineNoMatch(hostname, acl, lastLine), deny);
}
});
}).forEach(_rules::add);
}
Aggregations