use of org.batfish.datamodel.routing_policy.expr.RegexAsPathSetElem in project batfish by batfish.
the class BatfishCompressor method matchExternalTraffic.
/**
* Create a filter that only allows traffic for those prefixes if it came from outside. EXTERNAL =
* (protocol is bgp or ibgp) and (the AS path is not an internal path) MATCH = destination matches
* the prefixTrie GUARD = EXTERNAL or MATCH (only allow this traffic through)
*/
@Nonnull
private BooleanExpr matchExternalTraffic() {
List<AsPathSetElem> elements = new ArrayList<>();
elements.add(new RegexAsPathSetElem(_internalRegex));
ExplicitAsPathSet expr = new ExplicitAsPathSet(elements);
MatchAsPath matchPath = new MatchAsPath(expr);
MatchProtocol mpBgp = new MatchProtocol(RoutingProtocol.BGP);
MatchProtocol mpIbgp = new MatchProtocol(RoutingProtocol.IBGP);
Disjunction d = new Disjunction();
List<BooleanExpr> disjuncts = new ArrayList<>();
disjuncts.add(mpBgp);
disjuncts.add(mpIbgp);
d.setDisjuncts(disjuncts);
Not n = new Not(matchPath);
Conjunction c = new Conjunction();
List<BooleanExpr> conjuncts = new ArrayList<>();
conjuncts.add(d);
conjuncts.add(n);
c.setConjuncts(conjuncts);
return c;
}
Aggregations